/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1182 by persson, Sun May 13 05:48:51 2007 UTC revision 1195 by persson, Thu May 17 17:24:26 2007 UTC
# Line 2227  namespace { Line 2227  namespace {
2227              const int _3lnkChunkSize = (pFile->pVersion && pFile->pVersion->major == 3) ? 1092 : 172;              const int _3lnkChunkSize = (pFile->pVersion && pFile->pVersion->major == 3) ? 1092 : 172;
2228              _3lnk = pCkRegion->AddSubChunk(CHUNK_ID_3LNK, _3lnkChunkSize);              _3lnk = pCkRegion->AddSubChunk(CHUNK_ID_3LNK, _3lnkChunkSize);
2229              memset(_3lnk->LoadChunkData(), 0, _3lnkChunkSize);              memset(_3lnk->LoadChunkData(), 0, _3lnkChunkSize);
2230    
2231                // move 3prg to last position
2232                pCkRegion->MoveSubChunk(pCkRegion->GetSubList(LIST_TYPE_3PRG), 0);
2233          }          }
2234    
2235          // update dimension definitions in '3lnk' chunk          // update dimension definitions in '3lnk' chunk
# Line 2393  namespace { Line 2396  namespace {
2396          // create new dimension region(s) for this new dimension          // create new dimension region(s) for this new dimension
2397          for (int i = 1 << iCurrentBits; i < 1 << iNewBits; i++) {          for (int i = 1 << iCurrentBits; i < 1 << iNewBits; i++) {
2398              //TODO: maybe we should copy existing dimension regions if possible instead of simply creating new ones with default values              //TODO: maybe we should copy existing dimension regions if possible instead of simply creating new ones with default values
2399              RIFF::List* pNewDimRgnListChunk = pCkRegion->AddSubList(LIST_TYPE_3EWL);              RIFF::List* _3prg = pCkRegion->GetSubList(LIST_TYPE_3PRG);
2400                RIFF::List* pNewDimRgnListChunk = _3prg->AddSubList(LIST_TYPE_3EWL);
2401              pDimensionRegions[i] = new DimensionRegion(pNewDimRgnListChunk);              pDimensionRegions[i] = new DimensionRegion(pNewDimRgnListChunk);
2402              DimensionRegions++;              DimensionRegions++;
2403          }          }
# Line 2809  namespace { Line 2813  namespace {
2813      void Group::UpdateChunks() {      void Group::UpdateChunks() {
2814          // make sure <3gri> and <3gnl> list chunks exist          // make sure <3gri> and <3gnl> list chunks exist
2815          RIFF::List* _3gri = pFile->pRIFF->GetSubList(LIST_TYPE_3GRI);          RIFF::List* _3gri = pFile->pRIFF->GetSubList(LIST_TYPE_3GRI);
2816          if (!_3gri) _3gri = pFile->pRIFF->AddSubList(LIST_TYPE_3GRI);          if (!_3gri) {
2817                _3gri = pFile->pRIFF->AddSubList(LIST_TYPE_3GRI);
2818                pFile->pRIFF->MoveSubChunk(_3gri, pFile->pRIFF->GetSubChunk(CHUNK_ID_PTBL));
2819            }
2820          RIFF::List* _3gnl = _3gri->GetSubList(LIST_TYPE_3GNL);          RIFF::List* _3gnl = _3gri->GetSubList(LIST_TYPE_3GNL);
2821          if (!_3gnl) _3gnl = _3gri->AddSubList(LIST_TYPE_3GNL);          if (!_3gnl) _3gnl = _3gri->AddSubList(LIST_TYPE_3GNL);
2822          // now store the name of this group as <3gnm> chunk as subchunk of the <3gnl> list chunk          // now store the name of this group as <3gnm> chunk as subchunk of the <3gnl> list chunk
# Line 2912  namespace { Line 2919  namespace {
2919          pGroups = NULL;          pGroups = NULL;
2920          pInfo->FixedStringLengths = FixedStringLengths;          pInfo->FixedStringLengths = FixedStringLengths;
2921          pInfo->ArchivalLocation = String(256, ' ');          pInfo->ArchivalLocation = String(256, ' ');
2922    
2923            // add some mandatory chunks to get the file chunks in right
2924            // order (INFO chunk will be moved to first position later)
2925            pRIFF->AddSubChunk(CHUNK_ID_VERS, 8);
2926            pRIFF->AddSubChunk(CHUNK_ID_COLH, 4);
2927      }      }
2928    
2929      File::File(RIFF::File* pRIFF) : DLS::File(pRIFF) {      File::File(RIFF::File* pRIFF) : DLS::File(pRIFF) {
# Line 2958  namespace { Line 2970  namespace {
2970         // create new Sample object and its respective 'wave' list chunk         // create new Sample object and its respective 'wave' list chunk
2971         RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE);         RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE);
2972         Sample* pSample = new Sample(this, wave, 0 /*arbitrary value, we update offsets when we save*/);         Sample* pSample = new Sample(this, wave, 0 /*arbitrary value, we update offsets when we save*/);
2973    
2974           // add mandatory chunks to get the chunks in right order
2975           wave->AddSubChunk(CHUNK_ID_FMT, 16);
2976           wave->AddSubList(LIST_TYPE_INFO);
2977    
2978         pSamples->push_back(pSample);         pSamples->push_back(pSample);
2979         return pSample;         return pSample;
2980      }      }
# Line 3100  namespace { Line 3117  namespace {
3117         __ensureMandatoryChunksExist();         __ensureMandatoryChunksExist();
3118         RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);         RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);
3119         RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS);         RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS);
3120    
3121           // add mandatory chunks to get the chunks in right order
3122           lstInstr->AddSubList(LIST_TYPE_INFO);
3123    
3124         Instrument* pInstrument = new Instrument(this, lstInstr);         Instrument* pInstrument = new Instrument(this, lstInstr);
3125    
3126           lstInstr->AddSubChunk(CHUNK_ID_INSH, 12);
3127    
3128         // this string is needed for the gig to be loadable in GSt:         // this string is needed for the gig to be loadable in GSt:
3129         pInstrument->pInfo->Software = "Endless Wave";         pInstrument->pInfo->Software = "Endless Wave";
3130    
# Line 3272  namespace { Line 3295  namespace {
3295       * @throws Exception - on errors       * @throws Exception - on errors
3296       */       */
3297      void File::UpdateChunks() {      void File::UpdateChunks() {
3298            RIFF::Chunk* info = pRIFF->GetSubList(LIST_TYPE_INFO);
3299    
3300          // first update base class's chunks          // first update base class's chunks
3301          DLS::File::UpdateChunks();          DLS::File::UpdateChunks();
3302    
3303            if (!info) {
3304                // INFO was added by Resource::UpdateChunks - make sure it
3305                // is placed first in file
3306                info = pRIFF->GetSubList(LIST_TYPE_INFO);
3307                RIFF::Chunk* first = pRIFF->GetFirstSubChunk();
3308                if (first != info) {
3309                    pRIFF->MoveSubChunk(info, first);
3310                }
3311            }
3312    
3313          // update group's chunks          // update group's chunks
3314          if (pGroups) {          if (pGroups) {
3315              std::list<Group*>::iterator iter = pGroups->begin();              std::list<Group*>::iterator iter = pGroups->begin();

Legend:
Removed from v.1182  
changed lines
  Added in v.1195

  ViewVC Help
Powered by ViewVC