/[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 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    
     /** @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();
# Line 778  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 793  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.1358  
changed lines
  Added in v.1524

  ViewVC Help
Powered by ViewVC