/[svn]/libgig/trunk/src/gig.h
ViewVC logotype

Diff of /libgig/trunk/src/gig.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1199 by persson, Sun May 20 10:11:39 2007 UTC revision 1524 by schoenebeck, Sun Nov 25 17:29:37 2007 UTC
# Line 323  namespace gig { Line 323  namespace gig {
323          progress_t();          progress_t();
324      };      };
325    
     class CRC {  
     private:  
         uint32_t value;  
         static const uint32_t* table;  
         static uint32_t* initTable();  
     public:  
         CRC() {  
             reset();  
         }  
         void reset() {  
             value = 0xffffffff;  
         }  
         void update(unsigned char* buf, int len) {  
             for (int i = 0 ; i < len ; i++) {  
                 value = table[(value ^ buf[i]) & 0xff] ^ (value >> 8);  
             }  
         }  
         uint32_t getValue() {  
             return value ^ 0xffffffff;  
         }  
     };  
   
326      // just symbol prototyping      // just symbol prototyping
327      class File;      class File;
328      class Instrument;      class Instrument;
# Line 418  namespace gig { Line 396  namespace gig {
396              // Filter              // Filter
397              bool               VCFEnabled;                    ///< If filter should be used.              bool               VCFEnabled;                    ///< If filter should be used.
398              vcf_type_t         VCFType;                       ///< Defines the general filter characteristic (lowpass, highpass, bandpass, etc.).              vcf_type_t         VCFType;                       ///< Defines the general filter characteristic (lowpass, highpass, bandpass, etc.).
399              vcf_cutoff_ctrl_t  VCFCutoffController;           ///< Specifies which external controller has influence on the filter cutoff frequency.              vcf_cutoff_ctrl_t  VCFCutoffController;           ///< Specifies which external controller has influence on the filter cutoff frequency. @deprecated Don't alter directly, use SetVCFCutoffController() instead!
400              bool               VCFCutoffControllerInvert;     ///< Inverts values coming from the defined cutoff controller              bool               VCFCutoffControllerInvert;     ///< Inverts values coming from the defined cutoff controller
401              uint8_t            VCFCutoff;                     ///< Max. cutoff frequency.              uint8_t            VCFCutoff;                     ///< Max. cutoff frequency.
402              curve_type_t       VCFVelocityCurve;              ///< Defines a transformation curve for the incoming velocity values, affecting the VCF.              curve_type_t       VCFVelocityCurve;              ///< Defines a transformation curve for the incoming velocity values, affecting the VCF. @deprecated Don't alter directly, use SetVCFVelocityCurve() instead!
403              uint8_t            VCFVelocityScale;              ///< (0-127) Amount velocity controls VCF cutoff frequency (only if no other VCF cutoff controller is defined, otherwise this is the minimum cutoff).              uint8_t            VCFVelocityScale;              ///< (0-127) Amount velocity controls VCF cutoff frequency (only if no other VCF cutoff controller is defined, otherwise this is the minimum cutoff). @deprecated Don't alter directly, use SetVCFVelocityScale() instead!
404              uint8_t            VCFVelocityDynamicRange;       ///< 0x04 = lowest, 0x00 = highest              uint8_t            VCFVelocityDynamicRange;       ///< 0x04 = lowest, 0x00 = highest . @deprecated Don't alter directly, use SetVCFVelocityDynamicRange() instead!
405              uint8_t            VCFResonance;                  ///< Firm internal filter resonance weight.              uint8_t            VCFResonance;                  ///< Firm internal filter resonance weight.
406              bool               VCFResonanceDynamic;           ///< If <i>true</i>: Increases the resonance Q according to changes of controllers that actually control the VCF cutoff frequency (EG2, ext. VCF MIDI controller).              bool               VCFResonanceDynamic;           ///< If <i>true</i>: Increases the resonance Q according to changes of controllers that actually control the VCF cutoff frequency (EG2, ext. VCF MIDI controller).
407              vcf_res_ctrl_t     VCFResonanceController;        ///< Specifies which external controller has influence on the filter resonance Q.              vcf_res_ctrl_t     VCFResonanceController;        ///< Specifies which external controller has influence on the filter resonance Q.
408              bool               VCFKeyboardTracking;           ///< If <i>true</i>: VCF cutoff frequence will be dependend to the note key position relative to the defined breakpoint value.              bool               VCFKeyboardTracking;           ///< If <i>true</i>: VCF cutoff frequence will be dependend to the note key position relative to the defined breakpoint value.
409              uint8_t            VCFKeyboardTrackingBreakpoint; ///< See VCFKeyboardTracking (0 - 127).              uint8_t            VCFKeyboardTrackingBreakpoint; ///< See VCFKeyboardTracking (0 - 127).
410              // Key Velocity Transformations              // Key Velocity Transformations
411              curve_type_t       VelocityResponseCurve;         ///< Defines a transformation curve to the incoming velocity values affecting amplitude (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead).              curve_type_t       VelocityResponseCurve;         ///< Defines a transformation curve to the incoming velocity values affecting amplitude (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead). @deprecated Don't alter directly, use SetVelocityResponseCurve() instead!
412              uint8_t            VelocityResponseDepth;         ///< Dynamic range of velocity affecting amplitude (0 - 4) (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead).              uint8_t            VelocityResponseDepth;         ///< Dynamic range of velocity affecting amplitude (0 - 4) (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead). @deprecated Don't alter directly, use SetVelocityResponseDepth() instead!
413              uint8_t            VelocityResponseCurveScaling;  ///< 0 - 127 (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead)              uint8_t            VelocityResponseCurveScaling;  ///< 0 - 127 (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead). @deprecated Don't alter directly, use SetVelocityResponseCurveScaling() instead!
414              curve_type_t       ReleaseVelocityResponseCurve;  ///< Defines a transformation curve to the incoming release veloctiy values affecting envelope times.              curve_type_t       ReleaseVelocityResponseCurve;  ///< Defines a transformation curve to the incoming release veloctiy values affecting envelope times. @deprecated Don't alter directly, use SetReleaseVelocityResponseCurve() instead!
415              uint8_t            ReleaseVelocityResponseDepth;  ///< Dynamic range of release velocity affecting envelope time (0 - 4).              uint8_t            ReleaseVelocityResponseDepth;  ///< Dynamic range of release velocity affecting envelope time (0 - 4). @deprecated Don't alter directly, use SetReleaseVelocityResponseDepth() instead!
416              uint8_t            ReleaseTriggerDecay;           ///< 0 - 8              uint8_t            ReleaseTriggerDecay;           ///< 0 - 8
417              // Mix / Layer              // Mix / Layer
418              crossfade_t        Crossfade;              crossfade_t        Crossfade;
# Line 463  namespace gig { Line 441  namespace gig {
441              double GetVelocityAttenuation(uint8_t MIDIKeyVelocity);              double GetVelocityAttenuation(uint8_t MIDIKeyVelocity);
442              double GetVelocityRelease(uint8_t MIDIKeyVelocity);              double GetVelocityRelease(uint8_t MIDIKeyVelocity);
443              double GetVelocityCutoff(uint8_t MIDIKeyVelocity);              double GetVelocityCutoff(uint8_t MIDIKeyVelocity);
444                void SetVelocityResponseCurve(curve_type_t curve);
445                void SetVelocityResponseDepth(uint8_t depth);
446                void SetVelocityResponseCurveScaling(uint8_t scaling);
447                void SetReleaseVelocityResponseCurve(curve_type_t curve);
448                void SetReleaseVelocityResponseDepth(uint8_t depth);
449                void SetVCFCutoffController(vcf_cutoff_ctrl_t controller);
450                void SetVCFVelocityCurve(curve_type_t curve);
451                void SetVCFVelocityDynamicRange(uint8_t range);
452                void SetVCFVelocityScale(uint8_t scaling);
453                Region* GetParent() const;
454              // derived methods              // derived methods
455              DLS::Sampler::AddSampleLoop;              DLS::Sampler::AddSampleLoop;
456              DLS::Sampler::DeleteSampleLoop;              DLS::Sampler::DeleteSampleLoop;
457              // overridden methods              // overridden methods
458                virtual void SetGain(int32_t gain);
459              virtual void UpdateChunks();              virtual void UpdateChunks();
460          protected:          protected:
461              uint8_t* VelocityTable; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number.              uint8_t* VelocityTable; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number.
462              DimensionRegion(RIFF::List* _3ewl);              DimensionRegion(Region* pParent, RIFF::List* _3ewl);
463                DimensionRegion(RIFF::List* _3ewl, const DimensionRegion& src);
464             ~DimensionRegion();             ~DimensionRegion();
465              friend class Region;              friend class Region;
466          private:          private:
# Line 509  namespace gig { Line 499  namespace gig {
499              double*                  pVelocityAttenuationTable;  ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion.              double*                  pVelocityAttenuationTable;  ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion.
500              double*                  pVelocityReleaseTable;      ///< Points to the velocity table corresponding to the release velocity parameters of this DimensionRegion              double*                  pVelocityReleaseTable;      ///< Points to the velocity table corresponding to the release velocity parameters of this DimensionRegion
501              double*                  pVelocityCutoffTable;       ///< Points to the velocity table corresponding to the filter velocity parameters of this DimensionRegion              double*                  pVelocityCutoffTable;       ///< Points to the velocity table corresponding to the filter velocity parameters of this DimensionRegion
502                Region*                  pRegion;
503    
504              leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController);              leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController);
505              _lev_ctrl_t     EncodeLeverageController(leverage_ctrl_t DecodedController);              _lev_ctrl_t     EncodeLeverageController(leverage_ctrl_t DecodedController);
506                double* GetReleaseVelocityTable(curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth);
507                double* GetCutoffVelocityTable(curve_type_t vcfVelocityCurve, uint8_t vcfVelocityDynamicRange, uint8_t vcfVelocityScale, vcf_cutoff_ctrl_t vcfCutoffController);
508              double* GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);              double* GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);
509              double* CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);              double* CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);
510      };      };
# Line 585  namespace gig { Line 578  namespace gig {
578              unsigned long        FileNo;                  ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig)              unsigned long        FileNo;                  ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig)
579              RIFF::Chunk*         pCk3gix;              RIFF::Chunk*         pCk3gix;
580              RIFF::Chunk*         pCkSmpl;              RIFF::Chunk*         pCkSmpl;
581              CRC                  crc;              uint32_t             crc;                     ///< CRC-32 checksum of the raw sample data
582    
583              Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0);              Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0);
584             ~Sample();             ~Sample();
# Line 628  namespace gig { Line 621  namespace gig {
621              DimensionRegion*        pDimensionRegions[256];   ///< Pointer array to the 32 (gig2) or 256 (gig3) possible dimension regions (reflects NULL for dimension regions not in use). Avoid to access the array directly and better use GetDimensionRegionByValue() instead, but of course in some cases it makes sense to use the array (e.g. iterating through all DimensionRegions). Use AddDimension() and DeleteDimension() to create a new dimension or delete an existing one (which will create or delete the respective dimension region(s) automatically).              DimensionRegion*        pDimensionRegions[256];   ///< Pointer array to the 32 (gig2) or 256 (gig3) possible dimension regions (reflects NULL for dimension regions not in use). Avoid to access the array directly and better use GetDimensionRegionByValue() instead, but of course in some cases it makes sense to use the array (e.g. iterating through all DimensionRegions). Use AddDimension() and DeleteDimension() to create a new dimension or delete an existing one (which will create or delete the respective dimension region(s) automatically).
622              unsigned int            Layers;                   ///< Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there is Layer dimension. The same information can of course also be obtained by accessing pDimensionDefinitions. Do not alter this value!              unsigned int            Layers;                   ///< Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there is Layer dimension. The same information can of course also be obtained by accessing pDimensionDefinitions. Do not alter this value!
623    
624                // own methods
625              DimensionRegion* GetDimensionRegionByValue(const uint DimValues[8]);              DimensionRegion* GetDimensionRegionByValue(const uint DimValues[8]);
626              DimensionRegion* GetDimensionRegionByBit(const uint8_t DimBits[8]);              DimensionRegion* GetDimensionRegionByBit(const uint8_t DimBits[8]);
627              Sample*          GetSample();              Sample*          GetSample();
628              void             AddDimension(dimension_def_t* pDimDef);              void             AddDimension(dimension_def_t* pDimDef);
629              void             DeleteDimension(dimension_def_t* pDimDef);              void             DeleteDimension(dimension_def_t* pDimDef);
630                // overridden methods
631                virtual void     SetKeyRange(uint16_t Low, uint16_t High);
632              virtual void     UpdateChunks();              virtual void     UpdateChunks();
633          protected:          protected:
634              Region(Instrument* pInstrument, RIFF::List* rgnList);              Region(Instrument* pInstrument, RIFF::List* rgnList);
# Line 667  namespace gig { Line 663  namespace gig {
663    
664              // derived methods from DLS::Resource              // derived methods from DLS::Resource
665              DLS::Resource::GetParent;              DLS::Resource::GetParent;
             // derived methods from DLS::Instrument  
             DLS::Instrument::MoveRegion;  
666              // overridden methods              // overridden methods
667              Region*   GetFirstRegion();              Region*   GetFirstRegion();
668              Region*   GetNextRegion();              Region*   GetNextRegion();
# Line 684  namespace gig { Line 678  namespace gig {
678             ~Instrument();             ~Instrument();
679              void UpdateRegionKeyTable();              void UpdateRegionKeyTable();
680              friend class File;              friend class File;
681                friend class Region; // so Region can call UpdateRegionKeyTable()
682      };      };
683    
684      /** @brief Group of Gigasampler objects      /** @brief Group of Gigasampler objects
# Line 754  namespace gig { Line 749  namespace gig {
749              Group*      AddGroup();              Group*      AddGroup();
750              void        DeleteGroup(Group* pGroup);              void        DeleteGroup(Group* pGroup);
751              void        DeleteGroupOnly(Group* pGroup);              void        DeleteGroupOnly(Group* pGroup);
752                void        SetAutoLoad(bool b);
753                bool        GetAutoLoad();
754              virtual    ~File();              virtual    ~File();
755              virtual void UpdateChunks();              virtual void UpdateChunks();
756          protected:          protected:
# Line 769  namespace gig { Line 766  namespace gig {
766              friend class Sample;              friend class Sample;
767              friend class Group; // so Group can access protected member pRIFF              friend class Group; // so Group can access protected member pRIFF
768          private:          private:
             static const DLS::Info::FixedStringLength FixedStringLengths[];  
769              std::list<Group*>*          pGroups;              std::list<Group*>*          pGroups;
770              std::list<Group*>::iterator GroupsIterator;              std::list<Group*>::iterator GroupsIterator;
771                bool                        bAutoLoad;
772      };      };
773    
774      /**      /**

Legend:
Removed from v.1199  
changed lines
  Added in v.1524

  ViewVC Help
Powered by ViewVC