/[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 350 by schoenebeck, Tue Jan 25 21:54:24 2005 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 279  namespace gig { Line 279  namespace gig {
279       *       *
280       * Note: The default value for crossfade points is 0,0,0,0. Layers with       * 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       * such a default value should be treated as if they would not have a
282       * crossfade, that is the crossfade volume factor should <b>always</b>       * crossfade.
      * be 1.0f for such layers.  
283       */       */
284      struct crossfade_t {      struct crossfade_t {
285          #if WORDS_BIGENDIAN          #if WORDS_BIGENDIAN
# Line 493  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 561  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;

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

  ViewVC Help
Powered by ViewVC