/[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 308 by schoenebeck, Sun Nov 21 18:02:21 2004 UTC revision 365 by persson, Thu Feb 10 19:16:31 2005 UTC
# Line 219  namespace gig { Line 219  namespace gig {
219          dimension_velocity          = 0x82, ///< Key Velocity (this is the only dimension where the ranges can exactly be defined).          dimension_velocity          = 0x82, ///< Key Velocity (this is the only dimension where the ranges can exactly be defined).
220          dimension_channelaftertouch = 0x83, ///< Channel Key Pressure          dimension_channelaftertouch = 0x83, ///< Channel Key Pressure
221          dimension_releasetrigger    = 0x84, ///< Special dimension for triggering samples on releasing a key.          dimension_releasetrigger    = 0x84, ///< Special dimension for triggering samples on releasing a key.
222          dimension_keyboard          = 0x85, ///< Key Position          dimension_keyboard          = 0x85, ///< Dimension for keyswitching
223          dimension_modwheel          = 0x01, ///< Modulation Wheel (MIDI Controller 1)          dimension_modwheel          = 0x01, ///< Modulation Wheel (MIDI Controller 1)
224          dimension_breath            = 0x02, ///< Breath Controller (Coarse, MIDI Controller 2)          dimension_breath            = 0x02, ///< Breath Controller (Coarse, MIDI Controller 2)
225          dimension_foot              = 0x04, ///< Foot Pedal (Coarse, MIDI Controller 4)          dimension_foot              = 0x04, ///< Foot Pedal (Coarse, MIDI Controller 4)
# Line 274  namespace gig { Line 274  namespace gig {
274          vcf_type_bandreject   = 0x03          vcf_type_bandreject   = 0x03
275      } vcf_type_t;      } vcf_type_t;
276    
277      /** Defines the envelope of a crossfade. */      /**
278         * Defines the envelope of a crossfade.
279         *
280         * Note: The default value for crossfade points is 0,0,0,0. Layers with
281         * such a default value should be treated as if they would not have a
282         * crossfade.
283         */
284      struct crossfade_t {      struct crossfade_t {
285          #if WORDS_BIGENDIAN          #if WORDS_BIGENDIAN
         uint8_t in_start;   ///< Start position of fade in.  
         uint8_t in_end;     ///< End position of fade in.  
         uint8_t out_start;  ///< Start position of fade out.  
         uint8_t out_end;    ///< End postition of fade out.  
         #else // little endian  
286          uint8_t out_end;    ///< End postition of fade out.          uint8_t out_end;    ///< End postition of fade out.
287          uint8_t out_start;  ///< Start position of fade out.          uint8_t out_start;  ///< Start position of fade out.
288          uint8_t in_end;     ///< End position of fade in.          uint8_t in_end;     ///< End position of fade in.
289          uint8_t in_start;   ///< Start position of fade in.          uint8_t in_start;   ///< Start position of fade in.
290            #else // little endian
291            uint8_t in_start;   ///< Start position of fade in.
292            uint8_t in_end;     ///< End position of fade in.
293            uint8_t out_start;  ///< Start position of fade out.
294            uint8_t out_end;    ///< End postition of fade out.
295          #endif // WORDS_BIGENDIAN          #endif // WORDS_BIGENDIAN
296      };      };
297    
# Line 300  namespace gig { Line 306  namespace gig {
306      class File;      class File;
307      class Instrument;      class Instrument;
308      class Sample;      class Sample;
309        class Region;
310    
311      /** Encapsulates articulation information of a dimension region.      /** Encapsulates articulation information of a dimension region.
312       *       *
# Line 485  namespace gig { Line 492  namespace gig {
492          protected:          protected:
493              static unsigned int  Instances;               ///< Number of instances of class Sample.              static unsigned int  Instances;               ///< Number of instances of class Sample.
494              static unsigned long DecompressionBufferSize; ///< Current size of the decompression buffer.              static unsigned long DecompressionBufferSize; ///< Current size of the decompression buffer.
495              static void*         pDecompressionBuffer;    ///< Small buffer used for decompression only.              static unsigned char* pDecompressionBuffer;   ///< Small buffer used for decompression only.
496              unsigned long        FrameOffset;             ///< Current offset (sample points) in current sample frame (for decompression only).              unsigned long        FrameOffset;             ///< Current offset (sample points) in current sample frame (for decompression only).
497              unsigned long*       FrameTable;              ///< For positioning within compressed samples only: stores the offset values for each frame.              unsigned long*       FrameTable;              ///< For positioning within compressed samples only: stores the offset values for each frame.
498              unsigned long        SamplePos;               ///< For compressed samples only: stores the current position (in sample points).              unsigned long        SamplePos;               ///< For compressed samples only: stores the current position (in sample points).
499                unsigned long        SamplesInLastFrame;      ///< For compressed samples only: length of the last sample frame.
500                unsigned long        WorstCaseFrameSize;      ///< For compressed samples only: size (in bytes) of the largest possible sample frame.
501                unsigned long        SamplesPerFrame;         ///< For compressed samples only: number of samples in a full sample frame.
502              buffer_t             RAMCache;                ///< Buffers samples (already uncompressed) in RAM.              buffer_t             RAMCache;                ///< Buffers samples (already uncompressed) in RAM.
503    
504              Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset);              Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset);
# Line 553  namespace gig { Line 563  namespace gig {
563                  return (A > B) ? B : A;                  return (A > B) ? B : A;
564              }              }
565              inline long Abs(long val) { return (val > 0) ? val : -val; }              inline long Abs(long val) { return (val > 0) ? val : -val; }
566    
567                // Guess size (in bytes) of a compressed sample
568                inline unsigned long GuessSize(unsigned long samples) {
569                    // 16 bit: assume all frames are compressed - 1 byte
570                    // per sample and 5 bytes header per 2048 samples
571    
572                    // 24 bit: assume next best compression rate - 1.5
573                    // bytes per sample and 13 bytes header per 256
574                    // samples
575                    const unsigned long size =
576                        BitDepth == 24 ? samples + (samples >> 1) + (samples >> 8) * 13
577                                       : samples + (samples >> 10) * 5;
578                    // Double for stereo and add one worst case sample
579                    // frame
580                    return (Channels == 2 ? size << 1 : size) + WorstCaseFrameSize;
581                }
582          private:          private:
583              void ScanCompressedSample();              void ScanCompressedSample();
584              friend class File;              friend class File;
# Line 564  namespace gig { Line 590  namespace gig {
590      class Region : public DLS::Region {      class Region : public DLS::Region {
591          public:          public:
592              unsigned int            Dimensions;               ///< Number of defined dimensions.              unsigned int            Dimensions;               ///< Number of defined dimensions.
593              dimension_def_t         pDimensionDefinitions[5]; ///< Defines the five possible dimensions (the dimension's controller and number of bits/splits).              dimension_def_t         pDimensionDefinitions[8]; ///< Defines the five (gig2) or eight (gig3) possible dimensions (the dimension's controller and number of bits/splits).
594              uint32_t                DimensionRegions;         ///< Total number of DimensionRegions this Region contains.              uint32_t                DimensionRegions;         ///< Total number of DimensionRegions this Region contains.
595              DimensionRegion*        pDimensionRegions[32];    ///< Pointer array to the 32 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).              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).
596              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.              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.
597    
598              DimensionRegion* GetDimensionRegionByValue(uint Dim4Val, uint Dim3Val, uint Dim2Val, uint Dim1Val, uint Dim0Val);              DimensionRegion* GetDimensionRegionByValue(const uint DimValues[8]);
599              DimensionRegion* GetDimensionRegionByBit(uint8_t Dim4Bit, uint8_t Dim3Bit, uint8_t Dim2Bit, uint8_t Dim1Bit, uint8_t Dim0Bit);              DimensionRegion* GetDimensionRegionByBit(const uint8_t DimBits[8]);
600              Sample*          GetSample();              Sample*          GetSample();
601          protected:          protected:
602              uint8_t VelocityTable[128]; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number.              uint8_t VelocityTable[128]; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number.
# Line 641  namespace gig { Line 667  namespace gig {
667              Instrument* GetFirstInstrument(); ///< Returns a pointer to the first <i>Instrument</i> object of the file, <i>NULL</i> otherwise.              Instrument* GetFirstInstrument(); ///< Returns a pointer to the first <i>Instrument</i> object of the file, <i>NULL</i> otherwise.
668              Instrument* GetNextInstrument();  ///< Returns a pointer to the next <i>Instrument</i> object of the file, <i>NULL</i> otherwise.              Instrument* GetNextInstrument();  ///< Returns a pointer to the next <i>Instrument</i> object of the file, <i>NULL</i> otherwise.
669              Instrument* GetInstrument(uint index);              Instrument* GetInstrument(uint index);
670             ~File() {};             ~File();
671          protected:          protected:
672              typedef std::list<Sample*>     SampleList;              typedef std::list<Sample*>     SampleList;
673              typedef std::list<Instrument*> InstrumentList;              typedef std::list<Instrument*> InstrumentList;

Legend:
Removed from v.308  
changed lines
  Added in v.365

  ViewVC Help
Powered by ViewVC