gig.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   libgig - C++ cross-platform Gigasampler format file access library    *
00004  *                                                                         *
00005  *   Copyright (C) 2003-2006 by Christian Schoenebeck                      *
00006  *                              <cuse@users.sourceforge.net>               *
00007  *                                                                         *
00008  *   This library is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This library is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this library; if not, write to the Free Software           *
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00021  *   MA  02111-1307  USA                                                   *
00022  ***************************************************************************/
00023 
00024 #ifndef __GIG_H__
00025 #define __GIG_H__
00026 
00027 #include "DLS.h"
00028 
00029 #if WORDS_BIGENDIAN
00030 # define LIST_TYPE_3PRG 0x33707267
00031 # define LIST_TYPE_3EWL 0x3365776C
00032 # define LIST_TYPE_3GRI 0x33677269
00033 # define LIST_TYPE_3GNL 0x33676E6C
00034 # define CHUNK_ID_SMPL  0x736D706C
00035 # define CHUNK_ID_3GIX  0x33676978
00036 # define CHUNK_ID_3EWA  0x33657761
00037 # define CHUNK_ID_3LNK  0x336C6E6B
00038 # define CHUNK_ID_3EWG  0x33657767
00039 # define CHUNK_ID_EWAV  0x65776176
00040 # define CHUNK_ID_3GNM  0x33676E6D
00041 #else  // little endian
00042 # define LIST_TYPE_3PRG 0x67727033
00043 # define LIST_TYPE_3EWL 0x6C776533
00044 # define LIST_TYPE_3GRI 0x69726733
00045 # define LIST_TYPE_3GNL 0x6C6E6733
00046 # define CHUNK_ID_SMPL  0x6C706D73
00047 # define CHUNK_ID_3GIX  0x78696733
00048 # define CHUNK_ID_3EWA  0x61776533
00049 # define CHUNK_ID_3LNK  0x6B6E6C33
00050 # define CHUNK_ID_3EWG  0x67776533
00051 # define CHUNK_ID_EWAV  0x76617765
00052 # define CHUNK_ID_3GNM  0x6D6E6733
00053 #endif // WORDS_BIGENDIAN
00054 
00056 namespace gig {
00057 
00058     typedef std::string String;
00059 
00061     struct range_t {
00062         uint8_t low;  
00063         uint8_t high; 
00064     };
00065 
00067     struct buffer_t {
00068         void*         pStart;            
00069         unsigned long Size;              
00070         unsigned long NullExtensionSize; 
00071         buffer_t() {
00072             pStart            = NULL;
00073             Size              = 0;
00074             NullExtensionSize = 0;
00075         }
00076     };
00077 
00079     typedef enum {
00080         loop_type_normal        = 0x00000000,  
00081         loop_type_bidirectional = 0x00000001,  
00082         loop_type_backward      = 0x00000002   
00083     } loop_type_t;
00084 
00086     typedef enum {
00087         smpte_format_no_offset          = 0x00000000,  
00088         smpte_format_24_frames          = 0x00000018,  
00089         smpte_format_25_frames          = 0x00000019,  
00090         smpte_format_30_frames_dropping = 0x0000001D,  
00091         smpte_format_30_frames          = 0x0000001E   
00092     } smpte_format_t;
00093 
00095     typedef enum {
00096         curve_type_nonlinear = 0,
00097         curve_type_linear    = 1,
00098         curve_type_special   = 2,
00099         curve_type_unknown   = 0xffffffff
00100     } curve_type_t;
00101 
00103     typedef enum {
00104         dim_bypass_ctrl_none,
00105         dim_bypass_ctrl_94,   
00106         dim_bypass_ctrl_95    
00107     } dim_bypass_ctrl_t;
00108 
00110     typedef enum {
00111         lfo3_ctrl_internal            = 0x00, 
00112         lfo3_ctrl_modwheel            = 0x01, 
00113         lfo3_ctrl_aftertouch          = 0x02, 
00114         lfo3_ctrl_internal_modwheel   = 0x03, 
00115         lfo3_ctrl_internal_aftertouch = 0x04  
00116     } lfo3_ctrl_t;
00117 
00119     typedef enum {
00120         lfo2_ctrl_internal            = 0x00, 
00121         lfo2_ctrl_modwheel            = 0x01, 
00122         lfo2_ctrl_foot                = 0x02, 
00123         lfo2_ctrl_internal_modwheel   = 0x03, 
00124         lfo2_ctrl_internal_foot       = 0x04  
00125     } lfo2_ctrl_t;
00126 
00128     typedef enum {
00129         lfo1_ctrl_internal            = 0x00, 
00130         lfo1_ctrl_modwheel            = 0x01, 
00131         lfo1_ctrl_breath              = 0x02, 
00132         lfo1_ctrl_internal_modwheel   = 0x03, 
00133         lfo1_ctrl_internal_breath     = 0x04  
00134     } lfo1_ctrl_t;
00135 
00137     typedef enum {
00138         vcf_cutoff_ctrl_none         = 0x00,
00139         vcf_cutoff_ctrl_none2        = 0x01,  
00140         vcf_cutoff_ctrl_modwheel     = 0x81,  
00141         vcf_cutoff_ctrl_effect1      = 0x8c,  
00142         vcf_cutoff_ctrl_effect2      = 0x8d,  
00143         vcf_cutoff_ctrl_breath       = 0x82,  
00144         vcf_cutoff_ctrl_foot         = 0x84,  
00145         vcf_cutoff_ctrl_sustainpedal = 0xc0,  
00146         vcf_cutoff_ctrl_softpedal    = 0xc3,  
00147         vcf_cutoff_ctrl_genpurpose7  = 0xd2,  
00148         vcf_cutoff_ctrl_genpurpose8  = 0xd3,  
00149         vcf_cutoff_ctrl_aftertouch   = 0x80   
00150     } vcf_cutoff_ctrl_t;
00151 
00153     typedef enum {
00154         vcf_res_ctrl_none        = 0xffffffff,
00155         vcf_res_ctrl_genpurpose3 = 0,           
00156         vcf_res_ctrl_genpurpose4 = 1,           
00157         vcf_res_ctrl_genpurpose5 = 2,           
00158         vcf_res_ctrl_genpurpose6 = 3            
00159     } vcf_res_ctrl_t;
00160 
00169     struct leverage_ctrl_t {
00170         typedef enum {
00171             type_none              = 0x00, 
00172             type_channelaftertouch = 0x2f, 
00173             type_velocity          = 0xff, 
00174             type_controlchange     = 0xfe  
00175         } type_t;
00176 
00177         type_t type;              
00178         uint   controller_number; 
00179     };
00180 
00186     typedef leverage_ctrl_t attenuation_ctrl_t;
00187 
00193     typedef leverage_ctrl_t eg1_ctrl_t;
00194 
00200     typedef leverage_ctrl_t eg2_ctrl_t;
00201 
00209     typedef enum {
00210         dimension_none              = 0x00, 
00211         dimension_samplechannel     = 0x80, 
00212         dimension_layer             = 0x81, 
00213         dimension_velocity          = 0x82, 
00214         dimension_channelaftertouch = 0x83, 
00215         dimension_releasetrigger    = 0x84, 
00216         dimension_keyboard          = 0x85, 
00217         dimension_roundrobin        = 0x86, 
00218         dimension_random            = 0x87, 
00219         dimension_modwheel          = 0x01, 
00220         dimension_breath            = 0x02, 
00221         dimension_foot              = 0x04, 
00222         dimension_portamentotime    = 0x05, 
00223         dimension_effect1           = 0x0c, 
00224         dimension_effect2           = 0x0d, 
00225         dimension_genpurpose1       = 0x10, 
00226         dimension_genpurpose2       = 0x11, 
00227         dimension_genpurpose3       = 0x12, 
00228         dimension_genpurpose4       = 0x13, 
00229         dimension_sustainpedal      = 0x40, 
00230         dimension_portamento        = 0x41, 
00231         dimension_sostenutopedal    = 0x42, 
00232         dimension_softpedal         = 0x43, 
00233         dimension_genpurpose5       = 0x30, 
00234         dimension_genpurpose6       = 0x31, 
00235         dimension_genpurpose7       = 0x32, 
00236         dimension_genpurpose8       = 0x33, 
00237         dimension_effect1depth      = 0x5b, 
00238         dimension_effect2depth      = 0x5c, 
00239         dimension_effect3depth      = 0x5d, 
00240         dimension_effect4depth      = 0x5e, 
00241         dimension_effect5depth      = 0x5f  
00242     } dimension_t;
00243 
00248     typedef enum {
00249         split_type_normal,         
00250         split_type_bit             
00251     } split_type_t;
00252 
00254     struct dimension_def_t {
00255         dimension_t  dimension;  
00256         uint8_t      bits;       
00257         uint8_t      zones;      
00258         split_type_t split_type; 
00259         float        zone_size;  
00260     };
00261 
00263     typedef enum {
00264         vcf_type_lowpass      = 0x00,
00265         vcf_type_lowpassturbo = 0xff, 
00266         vcf_type_bandpass     = 0x01,
00267         vcf_type_highpass     = 0x02,
00268         vcf_type_bandreject   = 0x03
00269     } vcf_type_t;
00270 
00278     struct crossfade_t {
00279         #if WORDS_BIGENDIAN
00280         uint8_t out_end;    
00281         uint8_t out_start;  
00282         uint8_t in_end;     
00283         uint8_t in_start;   
00284         #else // little endian
00285         uint8_t in_start;   
00286         uint8_t in_end;     
00287         uint8_t out_start;  
00288         uint8_t out_end;    
00289         #endif // WORDS_BIGENDIAN
00290     };
00291 
00293     struct playback_state_t {
00294         unsigned long position;          
00295         bool          reverse;           
00296         unsigned long loop_cycles_left;  
00297     };
00298 
00311     struct progress_t {
00312         void (*callback)(progress_t*); 
00313         float factor;                  
00314         void* custom;                  
00315         float __range_min;             
00316         float __range_max;             
00317         progress_t();
00318     };
00319 
00320     // just symbol prototyping
00321     class File;
00322     class Instrument;
00323     class Sample;
00324     class Region;
00325     class Group;
00326 
00339     class DimensionRegion : protected DLS::Sampler {
00340         public:
00341             uint8_t            VelocityUpperLimit;            
00342             Sample*            pSample;                       
00343             // Sample Amplitude EG/LFO
00344             uint16_t           EG1PreAttack;                  
00345             double             EG1Attack;                     
00346             double             EG1Decay1;                     
00347             double             EG1Decay2;                     
00348             bool               EG1InfiniteSustain;            
00349             uint16_t           EG1Sustain;                    
00350             double             EG1Release;                    
00351             bool               EG1Hold;                       
00352             eg1_ctrl_t         EG1Controller;                 
00353             bool               EG1ControllerInvert;           
00354             uint8_t            EG1ControllerAttackInfluence;  
00355             uint8_t            EG1ControllerDecayInfluence;   
00356             uint8_t            EG1ControllerReleaseInfluence; 
00357             double             LFO1Frequency;                 
00358             uint16_t           LFO1InternalDepth;             
00359             uint16_t           LFO1ControlDepth;              
00360             lfo1_ctrl_t        LFO1Controller;                
00361             bool               LFO1FlipPhase;                 
00362             bool               LFO1Sync;                      
00363             // Filter Cutoff Frequency EG/LFO
00364             uint16_t           EG2PreAttack;                  
00365             double             EG2Attack;                     
00366             double             EG2Decay1;                     
00367             double             EG2Decay2;                     
00368             bool               EG2InfiniteSustain;            
00369             uint16_t           EG2Sustain;                    
00370             double             EG2Release;                    
00371             eg2_ctrl_t         EG2Controller;                 
00372             bool               EG2ControllerInvert;           
00373             uint8_t            EG2ControllerAttackInfluence;  
00374             uint8_t            EG2ControllerDecayInfluence;   
00375             uint8_t            EG2ControllerReleaseInfluence; 
00376             double             LFO2Frequency;                 
00377             uint16_t           LFO2InternalDepth;             
00378             uint16_t           LFO2ControlDepth;              
00379             lfo2_ctrl_t        LFO2Controller;                
00380             bool               LFO2FlipPhase;                 
00381             bool               LFO2Sync;                      
00382             // Sample Pitch EG/LFO
00383             double             EG3Attack;                     
00384             int16_t            EG3Depth;                      
00385             double             LFO3Frequency;                 
00386             int16_t            LFO3InternalDepth;             
00387             int16_t            LFO3ControlDepth;              
00388             lfo3_ctrl_t        LFO3Controller;                
00389             bool               LFO3Sync;                      
00390             // Filter
00391             bool               VCFEnabled;                    
00392             vcf_type_t         VCFType;                       
00393             vcf_cutoff_ctrl_t  VCFCutoffController;           
00394             bool               VCFCutoffControllerInvert;     
00395             uint8_t            VCFCutoff;                     
00396             curve_type_t       VCFVelocityCurve;              
00397             uint8_t            VCFVelocityScale;              
00398             uint8_t            VCFVelocityDynamicRange;       
00399             uint8_t            VCFResonance;                  
00400             bool               VCFResonanceDynamic;           
00401             vcf_res_ctrl_t     VCFResonanceController;        
00402             bool               VCFKeyboardTracking;           
00403             uint8_t            VCFKeyboardTrackingBreakpoint; 
00404             // Key Velocity Transformations
00405             curve_type_t       VelocityResponseCurve;         
00406             uint8_t            VelocityResponseDepth;         
00407             uint8_t            VelocityResponseCurveScaling;  
00408             curve_type_t       ReleaseVelocityResponseCurve;  
00409             uint8_t            ReleaseVelocityResponseDepth;  
00410             uint8_t            ReleaseTriggerDecay;           
00411             // Mix / Layer
00412             crossfade_t        Crossfade;
00413             bool               PitchTrack;                    
00414             dim_bypass_ctrl_t  DimensionBypass;               
00415             int8_t             Pan;                           
00416             bool               SelfMask;                      
00417             attenuation_ctrl_t AttenuationController;         
00418             bool               InvertAttenuationController;   
00419             uint8_t            AttenuationControllerThreshold;
00420             uint8_t            ChannelOffset;                 
00421             bool               SustainDefeat;                 
00422             bool               MSDecode;                      
00423             uint16_t           SampleStartOffset;             
00424             double             SampleAttenuation;             
00425 
00426             // derived attributes from DLS::Sampler
00427             DLS::Sampler::UnityNote;
00428             DLS::Sampler::FineTune;
00429             DLS::Sampler::Gain;
00430             DLS::Sampler::SampleLoops;
00431             DLS::Sampler::pSampleLoops;
00432 
00433             // own methods
00434             double GetVelocityAttenuation(uint8_t MIDIKeyVelocity);
00435             double GetVelocityRelease(uint8_t MIDIKeyVelocity);
00436             double GetVelocityCutoff(uint8_t MIDIKeyVelocity);
00437             // overridden methods
00438             virtual void UpdateChunks();
00439         protected:
00440             uint8_t* VelocityTable; 
00441             DimensionRegion(RIFF::List* _3ewl);
00442            ~DimensionRegion();
00443             friend class Region;
00444         private:
00445             typedef enum { 
00446                 _lev_ctrl_none              = 0x00,
00447                 _lev_ctrl_modwheel          = 0x03, 
00448                 _lev_ctrl_breath            = 0x05, 
00449                 _lev_ctrl_foot              = 0x07, 
00450                 _lev_ctrl_effect1           = 0x0d, 
00451                 _lev_ctrl_effect2           = 0x0f, 
00452                 _lev_ctrl_genpurpose1       = 0x11, 
00453                 _lev_ctrl_genpurpose2       = 0x13, 
00454                 _lev_ctrl_genpurpose3       = 0x15, 
00455                 _lev_ctrl_genpurpose4       = 0x17, 
00456                 _lev_ctrl_portamentotime    = 0x0b, 
00457                 _lev_ctrl_sustainpedal      = 0x01, 
00458                 _lev_ctrl_portamento        = 0x19, 
00459                 _lev_ctrl_sostenutopedal    = 0x1b, 
00460                 _lev_ctrl_softpedal         = 0x09, 
00461                 _lev_ctrl_genpurpose5       = 0x1d, 
00462                 _lev_ctrl_genpurpose6       = 0x1f, 
00463                 _lev_ctrl_genpurpose7       = 0x21, 
00464                 _lev_ctrl_genpurpose8       = 0x23, 
00465                 _lev_ctrl_effect1depth      = 0x25, 
00466                 _lev_ctrl_effect2depth      = 0x27, 
00467                 _lev_ctrl_effect3depth      = 0x29, 
00468                 _lev_ctrl_effect4depth      = 0x2b, 
00469                 _lev_ctrl_effect5depth      = 0x2d, 
00470                 _lev_ctrl_channelaftertouch = 0x2f, 
00471                 _lev_ctrl_velocity          = 0xff  
00472             } _lev_ctrl_t;
00473             typedef std::map<uint32_t, double*> VelocityTableMap;
00474 
00475             static uint              Instances;                  
00476             static VelocityTableMap* pVelocityTables;            
00477             double*                  pVelocityAttenuationTable;  
00478             double*                  pVelocityReleaseTable;      
00479             double*                  pVelocityCutoffTable;       
00480 
00481             leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController);
00482             _lev_ctrl_t     EncodeLeverageController(leverage_ctrl_t DecodedController);
00483             double* GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);
00484             double* CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);
00485     };
00486 
00497     class Sample : public DLS::Sample {
00498         public:
00499             uint32_t       Manufacturer;      
00500             uint32_t       Product;           
00501             uint32_t       SamplePeriod;      
00502             uint32_t       MIDIUnityNote;     
00503             uint32_t       FineTune;          
00504             smpte_format_t SMPTEFormat;       
00505             uint32_t       SMPTEOffset;       
00506             uint32_t       Loops;             
00507             uint32_t       LoopID;            
00508             loop_type_t    LoopType;          
00509             uint32_t       LoopStart;         
00510             uint32_t       LoopEnd;           
00511             uint32_t       LoopSize;          
00512             uint32_t       LoopFraction;      
00513             uint32_t       LoopPlayCount;     
00514             bool           Compressed;        
00515             uint32_t       TruncatedBits;     
00516             bool           Dithered;          
00517 
00518             // own methods
00519             buffer_t      LoadSampleData();
00520             buffer_t      LoadSampleData(unsigned long SampleCount);
00521             buffer_t      LoadSampleDataWithNullSamplesExtension(uint NullSamplesCount);
00522             buffer_t      LoadSampleDataWithNullSamplesExtension(unsigned long SampleCount, uint NullSamplesCount);
00523             buffer_t      GetCache();
00524             // own static methods
00525             static buffer_t CreateDecompressionBuffer(unsigned long MaxReadSize);
00526             static void     DestroyDecompressionBuffer(buffer_t& DecompressionBuffer);
00527             // overridden methods
00528             void          ReleaseSampleData();
00529             void          Resize(int iNewSize);
00530             unsigned long SetPos(unsigned long SampleCount, RIFF::stream_whence_t Whence = RIFF::stream_start);
00531             unsigned long GetPos();
00532             unsigned long Read(void* pBuffer, unsigned long SampleCount, buffer_t* pExternalDecompressionBuffer = NULL);
00533             unsigned long ReadAndLoop(void* pBuffer, unsigned long SampleCount, playback_state_t* pPlaybackState, DimensionRegion* pDimRgn, buffer_t* pExternalDecompressionBuffer = NULL);
00534             unsigned long Write(void* pBuffer, unsigned long SampleCount);
00535             Group*        GetGroup() const;
00536             virtual void  UpdateChunks();
00537         protected:
00538             static unsigned int  Instances;               
00539             static buffer_t      InternalDecompressionBuffer; 
00540             Group*               pGroup;                  
00541             unsigned long        FrameOffset;             
00542             unsigned long*       FrameTable;              
00543             unsigned long        SamplePos;               
00544             unsigned long        SamplesInLastFrame;      
00545             unsigned long        WorstCaseFrameSize;      
00546             unsigned long        SamplesPerFrame;         
00547             buffer_t             RAMCache;                
00548             unsigned long        FileNo;                  
00549             RIFF::Chunk*         pCk3gix;
00550             RIFF::Chunk*         pCkSmpl;
00551 
00552             Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0);
00553            ~Sample();
00554 
00555             // Guess size (in bytes) of a compressed sample
00556             inline unsigned long GuessSize(unsigned long samples) {
00557                 // 16 bit: assume all frames are compressed - 1 byte
00558                 // per sample and 5 bytes header per 2048 samples
00559 
00560                 // 24 bit: assume next best compression rate - 1.5
00561                 // bytes per sample and 13 bytes header per 256
00562                 // samples
00563                 const unsigned long size =
00564                     BitDepth == 24 ? samples + (samples >> 1) + (samples >> 8) * 13
00565                                    : samples + (samples >> 10) * 5;
00566                 // Double for stereo and add one worst case sample
00567                 // frame
00568                 return (Channels == 2 ? size << 1 : size) + WorstCaseFrameSize;
00569             }
00570 
00571             // Worst case amount of sample points that can be read with the
00572             // given decompression buffer.
00573             inline unsigned long WorstCaseMaxSamples(buffer_t* pDecompressionBuffer) {
00574                 return (unsigned long) ((float)pDecompressionBuffer->Size / (float)WorstCaseFrameSize * (float)SamplesPerFrame);
00575             }
00576         private:
00577             void ScanCompressedSample();
00578             friend class File;
00579             friend class Region;
00580             friend class Group; // allow to modify protected member pGroup
00581     };
00582 
00583     // TODO: <3dnl> list not used yet - not important though (just contains optional descriptions for the dimensions)
00585     class Region : public DLS::Region {
00586         public:
00587             unsigned int            Dimensions;               
00588             dimension_def_t         pDimensionDefinitions[8]; 
00589             uint32_t                DimensionRegions;         
00590             DimensionRegion*        pDimensionRegions[256];   
00591             unsigned int            Layers;                   
00592 
00593             DimensionRegion* GetDimensionRegionByValue(const uint DimValues[8]);
00594             DimensionRegion* GetDimensionRegionByBit(const uint8_t DimBits[8]);
00595             Sample*          GetSample();
00596             void             AddDimension(dimension_def_t* pDimDef);
00597             void             DeleteDimension(dimension_def_t* pDimDef);
00598             virtual void     UpdateChunks();
00599         protected:
00600             Region(Instrument* pInstrument, RIFF::List* rgnList);
00601             void LoadDimensionRegions(RIFF::List* rgn);
00602             void UpdateVelocityTable();
00603             Sample* GetSampleFromWavePool(unsigned int WavePoolTableIndex, progress_t* pProgress = NULL);
00604            ~Region();
00605             friend class Instrument;
00606     };
00607 
00609     class Instrument : protected DLS::Instrument {
00610         public:
00611             // derived attributes from DLS::Resource
00612             DLS::Resource::pInfo;
00613             DLS::Resource::pDLSID;
00614             // derived attributes from DLS::Instrument
00615             DLS::Instrument::IsDrum;
00616             DLS::Instrument::MIDIBank;
00617             DLS::Instrument::MIDIBankCoarse;
00618             DLS::Instrument::MIDIBankFine;
00619             DLS::Instrument::MIDIProgram;
00620             DLS::Instrument::Regions;
00621             // own attributes
00622             int32_t   Attenuation;       
00623             uint16_t  EffectSend;
00624             int16_t   FineTune;          
00625             uint16_t  PitchbendRange;    
00626             bool      PianoReleaseMode;
00627             range_t   DimensionKeyRange; 
00628 
00629 
00630             // derived methods from DLS::Resource
00631             DLS::Resource::GetParent;
00632             // overridden methods
00633             Region*   GetFirstRegion();
00634             Region*   GetNextRegion();
00635             Region*   AddRegion();
00636             void      DeleteRegion(Region* pRegion);
00637             virtual void UpdateChunks();
00638             // own methods
00639             Region*   GetRegion(unsigned int Key);
00640         protected:
00641             Region*   RegionKeyTable[128]; 
00642 
00643             Instrument(File* pFile, RIFF::List* insList, progress_t* pProgress = NULL);
00644            ~Instrument();
00645             void UpdateRegionKeyTable();
00646             friend class File;
00647     };
00648 
00664     class Group {
00665         public:
00666             String Name; 
00667 
00668             Sample* GetFirstSample();
00669             Sample* GetNextSample();
00670             void AddSample(Sample* pSample);
00671         protected:
00672             Group(File* file, RIFF::Chunk* ck3gnm);
00673             virtual ~Group();
00674             virtual void UpdateChunks();
00675             void MoveAll();
00676             friend class File;
00677         private:
00678             File*        pFile;
00679             RIFF::Chunk* pNameChunk;
00680     };
00681 
00683     class File : protected DLS::File {
00684         public:
00685             // derived attributes from DLS::Resource
00686             DLS::Resource::pInfo;
00687             DLS::Resource::pDLSID;
00688             // derived attributes from DLS::File
00689             DLS::File::pVersion;
00690             DLS::File::Instruments;
00691 
00692             // derived methods from DLS::Resource
00693             DLS::Resource::GetParent;
00694             // derived methods from DLS::File
00695             DLS::File::Save;
00696             // overridden  methods
00697             File();
00698             File(RIFF::File* pRIFF);
00699             Sample*     GetFirstSample(progress_t* pProgress = NULL); 
00700             Sample*     GetNextSample();      
00701             Sample*     AddSample();
00702             void        DeleteSample(Sample* pSample);
00703             Instrument* GetFirstInstrument(); 
00704             Instrument* GetNextInstrument();  
00705             Instrument* GetInstrument(uint index, progress_t* pProgress = NULL);
00706             Instrument* AddInstrument();
00707             void        DeleteInstrument(Instrument* pInstrument);
00708             Group*      GetFirstGroup(); 
00709             Group*      GetNextGroup();  
00710             Group*      GetGroup(uint index);
00711             Group*      AddGroup();
00712             void        DeleteGroup(Group* pGroup);
00713             virtual    ~File();
00714         protected:
00715             // overridden protected methods from DLS::File
00716             virtual void LoadSamples();
00717             virtual void LoadInstruments();
00718             virtual void LoadGroups();
00719             // own protected methods
00720             virtual void LoadSamples(progress_t* pProgress);
00721             virtual void LoadInstruments(progress_t* pProgress);
00722             friend class Region;
00723             friend class Sample;
00724             friend class Group; // so Group can access protected member pRIFF
00725         private:
00726             std::list<Group*>*          pGroups;
00727             std::list<Group*>::iterator GroupsIterator;
00728     };
00729 
00731     class Exception : public DLS::Exception {
00732         public:
00733             Exception(String Message);
00734             void PrintMessage();
00735     };
00736 
00737     String libraryName();
00738     String libraryVersion();
00739 
00740 } // namespace gig
00741 
00742 #endif // __GIG_H__

Generated on Wed Dec 6 19:25:57 2006 for libgig by  doxygen 1.5.1