/[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 1358 by schoenebeck, Sun Sep 30 18:13:33 2007 UTC revision 1381 by schoenebeck, Thu Oct 4 18:57:10 2007 UTC
# Line 323  namespace gig { Line 323  namespace gig {
323          progress_t();          progress_t();
324      };      };
325    
     /** @brief CRC-32 checksum implementation  
      *  
      * This class is used to calculate checksums of the sample data in  
      * a gig file. The checksums are stored in the 3crc chunk of the  
      * gig file and automatically updated when a sample is written  
      * with Sample::Write().  
      */  
     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 607  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;                     ///< CRC-32 checksum of the raw sample data              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();

Legend:
Removed from v.1358  
changed lines
  Added in v.1381

  ViewVC Help
Powered by ViewVC