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

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

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

revision 800 by schoenebeck, Wed Nov 9 20:04:11 2005 UTC revision 834 by persson, Mon Feb 6 17:58:21 2006 UTC
# Line 212  namespace DLS { Line 212  namespace DLS {
212       * call File::Save() to make changes persistent.       * call File::Save() to make changes persistent.
213       */       */
214      void Articulator::UpdateChunks() {      void Articulator::UpdateChunks() {
215          ArticulationList::iterator iter = pArticulations->begin();          if (pArticulations) {
216          ArticulationList::iterator end  = pArticulations->end();              ArticulationList::iterator iter = pArticulations->begin();
217          for (; iter != end; ++iter) {              ArticulationList::iterator end  = pArticulations->end();
218              (*iter)->UpdateChunks();              for (; iter != end; ++iter) {
219                    (*iter)->UpdateChunks();
220                }
221          }          }
222      }      }
223    
# Line 255  namespace DLS { Line 257  namespace DLS {
257          }          }
258      }      }
259    
260        Info::~Info() {
261        }
262    
263      /** @brief Load given INFO field.      /** @brief Load given INFO field.
264       *       *
265       * Load INFO field from INFO chunk with chunk ID \a ChunkID from INFO       * Load INFO field from INFO chunk with chunk ID \a ChunkID from INFO
# Line 264  namespace DLS { Line 269  namespace DLS {
269          RIFF::Chunk* ck = lstINFO->GetSubChunk(ChunkID);          RIFF::Chunk* ck = lstINFO->GetSubChunk(ChunkID);
270          if (ck) {          if (ck) {
271              // TODO: no check for ZSTR terminated strings yet              // TODO: no check for ZSTR terminated strings yet
272              s = (char*) ck->LoadChunkData();              s.assign((char*) ck->LoadChunkData(), ck->GetSize());
273              ck->ReleaseChunkData();              ck->ReleaseChunkData();
274          }          }
275      }      }
# Line 273  namespace DLS { Line 278  namespace DLS {
278       *       *
279       * Apply given info value to info chunk with ID \a ChunkID, which is a       * Apply given info value to info chunk with ID \a ChunkID, which is a
280       * subchunk of INFO list chunk \a lstINFO. If the given chunk already       * subchunk of INFO list chunk \a lstINFO. If the given chunk already
281       * exists, value \a s will be applied, otherwise if it doesn't exist yet       * exists, value \a s will be applied. Otherwise if it doesn't exist yet
282       * and \a sDefault is not an empty string, such a chunk will be created       * and either \a s or \a sDefault is not an empty string, such a chunk
283       * and \a sDefault will be applied.       * will be created and either \a s or \a sDefault will be applied
284         * (depending on which one is not an empty string, if both are not an
285         * empty string \a s will be preferred).
286       *       *
287       * @param ChunkID  - 32 bit RIFF chunk ID of INFO subchunk       * @param ChunkID  - 32 bit RIFF chunk ID of INFO subchunk
288       * @param lstINFO  - parent (INFO) RIFF list chunk       * @param lstINFO  - parent (INFO) RIFF list chunk
# Line 288  namespace DLS { Line 295  namespace DLS {
295              ck->Resize(s.size() + 1);              ck->Resize(s.size() + 1);
296              char* pData = (char*) ck->LoadChunkData();              char* pData = (char*) ck->LoadChunkData();
297              memcpy(pData, s.c_str(), s.size() + 1);              memcpy(pData, s.c_str(), s.size() + 1);
298          } else if (sDefault != "") { // create chunk and use default value          } else if (s != "" || sDefault != "") { // create chunk
299              ck = lstINFO->AddSubChunk(ChunkID, sDefault.size() + 1);              const String& sToSave = (s != "") ? s : sDefault;
300                ck = lstINFO->AddSubChunk(ChunkID, sToSave.size() + 1);
301              char* pData = (char*) ck->LoadChunkData();              char* pData = (char*) ck->LoadChunkData();
302              memcpy(pData, sDefault.c_str(), sDefault.size() + 1);              memcpy(pData, sToSave.c_str(), sToSave.size() + 1);
303          }          }
304      }      }
305    
# Line 312  namespace DLS { Line 320  namespace DLS {
320          // get current date          // get current date
321          time_t now = time(NULL);          time_t now = time(NULL);
322          tm* pNowBroken = localtime(&now);          tm* pNowBroken = localtime(&now);
323          String defaultCreationDate = ToString(pNowBroken->tm_year) + "-" +          String defaultCreationDate = ToString(1900 + pNowBroken->tm_year) + "-" +
324                                       ToString(pNowBroken->tm_mon)  + "-" +                                       ToString(pNowBroken->tm_mon + 1)  + "-" +
325                                       ToString(pNowBroken->tm_mday);                                       ToString(pNowBroken->tm_mday);
326          String defaultSoftware = libraryName() + " " + libraryVersion();          String defaultSoftware = libraryName() + " " + libraryVersion();
327          String defaultComments = "Created with " + libraryName() + " " + libraryVersion();          String defaultComments = "Created with " + libraryName() + " " + libraryVersion();
# Line 816  namespace DLS { Line 824  namespace DLS {
824          // get sample's wave pool table index          // get sample's wave pool table index
825          int index = -1;          int index = -1;
826          File* pFile = (File*) GetParent()->GetParent();          File* pFile = (File*) GetParent()->GetParent();
827          File::SampleList::iterator iter = pFile->pSamples->begin();          if (pFile->pSamples) {
828          File::SampleList::iterator end  = pFile->pSamples->end();              File::SampleList::iterator iter = pFile->pSamples->begin();
829          for (int i = 0; iter != end; ++iter, i++) {              File::SampleList::iterator end  = pFile->pSamples->end();
830              if (*iter == pSample) {              for (int i = 0; iter != end; ++iter, i++) {
831                  index = i;                  if (*iter == pSample) {
832                  break;                      index = i;
833                        break;
834                    }
835              }              }
836          }          }
837          if (index < 0) throw Exception("Could not save Region, could not find Region's sample");          if (index < 0) throw Exception("Could not save Region, could not find Region's sample");
# Line 888  namespace DLS { Line 898  namespace DLS {
898      }      }
899    
900      void Instrument::LoadRegions() {      void Instrument::LoadRegions() {
901            if (!pRegions) pRegions = new RegionList;
902          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);
903          if (!lrgn) throw DLS::Exception("Mandatory chunks in <ins > chunk not found.");          if (lrgn) {
904          uint32_t regionCkType = (lrgn->GetSubList(LIST_TYPE_RGN2)) ? LIST_TYPE_RGN2 : LIST_TYPE_RGN; // prefer regions level 2              uint32_t regionCkType = (lrgn->GetSubList(LIST_TYPE_RGN2)) ? LIST_TYPE_RGN2 : LIST_TYPE_RGN; // prefer regions level 2
905          RIFF::List* rgn = lrgn->GetFirstSubList();              RIFF::List* rgn = lrgn->GetFirstSubList();
906          while (rgn) {              while (rgn) {
907              if (rgn->GetListType() == regionCkType) {                  if (rgn->GetListType() == regionCkType) {
908                  if (!pRegions) pRegions = new RegionList;                      pRegions->push_back(new Region(this, rgn));
909                  pRegions->push_back(new Region(this, rgn));                  }
910                    rgn = lrgn->GetNextSubList();
911              }              }
             rgn = lrgn->GetNextSubList();  
912          }          }
913      }      }
914    
915      Region* Instrument::AddRegion() {      Region* Instrument::AddRegion() {
916          if (!pRegions) pRegions = new RegionList;          if (!pRegions) LoadRegions();
917          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);
918          if (!lrgn)  lrgn = pCkInstrument->AddSubList(LIST_TYPE_LRGN);          if (!lrgn)  lrgn = pCkInstrument->AddSubList(LIST_TYPE_LRGN);
919          RIFF::List* rgn = lrgn->AddSubList(LIST_TYPE_RGN);          RIFF::List* rgn = lrgn->AddSubList(LIST_TYPE_RGN);
920          Region* pNewRegion = new Region(this, rgn);          Region* pNewRegion = new Region(this, rgn);
921          pRegions->push_back(pNewRegion);          pRegions->push_back(pNewRegion);
922            Regions = pRegions->size();
923          return pNewRegion;          return pNewRegion;
924      }      }
925    
926      void Instrument::DeleteRegion(Region* pRegion) {      void Instrument::DeleteRegion(Region* pRegion) {
927            if (!pRegions) return;
928          RegionList::iterator iter = find(pRegions->begin(), pRegions->end(), pRegion);          RegionList::iterator iter = find(pRegions->begin(), pRegions->end(), pRegion);
929          if (iter == pRegions->end()) return;          if (iter == pRegions->end()) return;
930          pRegions->erase(iter);          pRegions->erase(iter);
931            Regions = pRegions->size();
932          delete pRegion;          delete pRegion;
933      }      }
934    
# Line 933  namespace DLS { Line 947  namespace DLS {
947          if (!insh) insh = pCkInstrument->AddSubChunk(CHUNK_ID_INSH, 12);          if (!insh) insh = pCkInstrument->AddSubChunk(CHUNK_ID_INSH, 12);
948          uint8_t* pData = (uint8_t*) insh->LoadChunkData();          uint8_t* pData = (uint8_t*) insh->LoadChunkData();
949          // update 'insh' chunk          // update 'insh' chunk
950          Regions = pRegions->size();          Regions = (pRegions) ? pRegions->size() : 0;
951          midi_locale_t locale;          midi_locale_t locale;
952          locale.instrument = MIDIProgram;          locale.instrument = MIDIProgram;
953          locale.bank       = MIDI_BANK_ENCODE(MIDIBankCoarse, MIDIBankFine);          locale.bank       = MIDI_BANK_ENCODE(MIDIBankCoarse, MIDIBankFine);
# Line 942  namespace DLS { Line 956  namespace DLS {
956          memccpy(&pData[0], &Regions, 1, 4);          memccpy(&pData[0], &Regions, 1, 4);
957          memccpy(&pData[4], &locale, 2, 4);          memccpy(&pData[4], &locale, 2, 4);
958          // update Region's chunks          // update Region's chunks
959            if (!pRegions) return;
960          RegionList::iterator iter = pRegions->begin();          RegionList::iterator iter = pRegions->begin();
961          RegionList::iterator end  = pRegions->end();          RegionList::iterator end  = pRegions->end();
962          for (; iter != end; ++iter) {          for (; iter != end; ++iter) {
# Line 980  namespace DLS { Line 995  namespace DLS {
995       * to add samples, instruments and finally call Save() to actually write       * to add samples, instruments and finally call Save() to actually write
996       * a DLS file.       * a DLS file.
997       */       */
998      File::File() : pRIFF(new RIFF::File(RIFF_TYPE_DLS)), Resource(NULL, pRIFF) {      File::File() : Resource(NULL, pRIFF = new RIFF::File(RIFF_TYPE_DLS)) {
999          pVersion = new version_t;          pVersion = new version_t;
1000          pVersion->major   = 0;          pVersion->major   = 0;
1001          pVersion->minor   = 0;          pVersion->minor   = 0;
# Line 1073  namespace DLS { Line 1088  namespace DLS {
1088          if (pWavePoolTable) delete[] pWavePoolTable;          if (pWavePoolTable) delete[] pWavePoolTable;
1089          if (pWavePoolTableHi) delete[] pWavePoolTableHi;          if (pWavePoolTableHi) delete[] pWavePoolTableHi;
1090          if (pVersion) delete pVersion;          if (pVersion) delete pVersion;
1091            for (std::list<RIFF::File*>::iterator i = ExtensionFiles.begin() ; i != ExtensionFiles.end() ; i++)
1092                delete *i;
1093      }      }
1094    
1095      Sample* File::GetFirstSample() {      Sample* File::GetFirstSample() {
# Line 1089  namespace DLS { Line 1106  namespace DLS {
1106      }      }
1107    
1108      void File::LoadSamples() {      void File::LoadSamples() {
1109            if (!pSamples) pSamples = new SampleList;
1110          RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL);          RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL);
1111          if (wvpl) {          if (wvpl) {
1112              unsigned long wvplFileOffset = wvpl->GetFilePos();              unsigned long wvplFileOffset = wvpl->GetFilePos();
1113              RIFF::List* wave = wvpl->GetFirstSubList();              RIFF::List* wave = wvpl->GetFirstSubList();
1114              while (wave) {              while (wave) {
1115                  if (wave->GetListType() == LIST_TYPE_WAVE) {                  if (wave->GetListType() == LIST_TYPE_WAVE) {
                     if (!pSamples) pSamples = new SampleList;  
1116                      unsigned long waveFileOffset = wave->GetFilePos();                      unsigned long waveFileOffset = wave->GetFilePos();
1117                      pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset));                      pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset));
1118                  }                  }
# Line 1109  namespace DLS { Line 1126  namespace DLS {
1126                  RIFF::List* wave = dwpl->GetFirstSubList();                  RIFF::List* wave = dwpl->GetFirstSubList();
1127                  while (wave) {                  while (wave) {
1128                      if (wave->GetListType() == LIST_TYPE_WAVE) {                      if (wave->GetListType() == LIST_TYPE_WAVE) {
                         if (!pSamples) pSamples = new SampleList;  
1129                          unsigned long waveFileOffset = wave->GetFilePos();                          unsigned long waveFileOffset = wave->GetFilePos();
1130                          pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset));                          pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset));
1131                      }                      }
# Line 1127  namespace DLS { Line 1143  namespace DLS {
1143       * @returns pointer to new Sample object       * @returns pointer to new Sample object
1144       */       */
1145      Sample* File::AddSample() {      Sample* File::AddSample() {
1146           if (!pSamples) LoadSamples();
1147         __ensureMandatoryChunksExist();         __ensureMandatoryChunksExist();
1148         RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL);         RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL);
1149         // create new Sample object and its respective 'wave' list chunk         // create new Sample object and its respective 'wave' list chunk
        if (!pSamples) pSamples = new SampleList;  
1150         RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE);         RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE);
1151         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*/);
1152         pSamples->push_back(pSample);         pSamples->push_back(pSample);
# Line 1145  namespace DLS { Line 1161  namespace DLS {
1161       * @param pSample - sample to delete       * @param pSample - sample to delete
1162       */       */
1163      void File::DeleteSample(Sample* pSample) {      void File::DeleteSample(Sample* pSample) {
1164            if (!pSamples) return;
1165          SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), pSample);          SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), pSample);
1166          if (iter == pSamples->end()) return;          if (iter == pSamples->end()) return;
1167          pSamples->erase(iter);          pSamples->erase(iter);
# Line 1165  namespace DLS { Line 1182  namespace DLS {
1182      }      }
1183    
1184      void File::LoadInstruments() {      void File::LoadInstruments() {
1185            if (!pInstruments) pInstruments = new InstrumentList;
1186          RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);          RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);
1187          if (lstInstruments) {          if (lstInstruments) {
1188              RIFF::List* lstInstr = lstInstruments->GetFirstSubList();              RIFF::List* lstInstr = lstInstruments->GetFirstSubList();
1189              while (lstInstr) {              while (lstInstr) {
1190                  if (lstInstr->GetListType() == LIST_TYPE_INS) {                  if (lstInstr->GetListType() == LIST_TYPE_INS) {
                     if (!pInstruments) pInstruments = new InstrumentList;  
1191                      pInstruments->push_back(new Instrument(this, lstInstr));                      pInstruments->push_back(new Instrument(this, lstInstr));
1192                  }                  }
1193                  lstInstr = lstInstruments->GetNextSubList();                  lstInstr = lstInstruments->GetNextSubList();
# Line 1186  namespace DLS { Line 1203  namespace DLS {
1203       * @returns pointer to new Instrument object       * @returns pointer to new Instrument object
1204       */       */
1205      Instrument* File::AddInstrument() {      Instrument* File::AddInstrument() {
1206           if (!pInstruments) LoadInstruments();
1207         __ensureMandatoryChunksExist();         __ensureMandatoryChunksExist();
        if (!pInstruments) pInstruments = new InstrumentList;  
1208         RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);         RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);
1209         RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS);         RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS);
1210         Instrument* pInstrument = new Instrument(this, lstInstr);         Instrument* pInstrument = new Instrument(this, lstInstr);
# Line 1195  namespace DLS { Line 1212  namespace DLS {
1212         return pInstrument;         return pInstrument;
1213      }      }
1214    
1215      /** @brief Delete a instrument.      /** @brief Delete an instrument.
1216       *       *
1217       * This will delete the given Instrument object from the DLS file. You       * This will delete the given Instrument object from the DLS file. You
1218       * have to call Save() to make this persistent to the file.       * have to call Save() to make this persistent to the file.
# Line 1203  namespace DLS { Line 1220  namespace DLS {
1220       * @param pInstrument - instrument to delete       * @param pInstrument - instrument to delete
1221       */       */
1222      void File::DeleteInstrument(Instrument* pInstrument) {      void File::DeleteInstrument(Instrument* pInstrument) {
1223            if (!pInstruments) return;
1224          InstrumentList::iterator iter = find(pInstruments->begin(), pInstruments->end(), pInstrument);          InstrumentList::iterator iter = find(pInstruments->begin(), pInstruments->end(), pInstrument);
1225          if (iter == pInstruments->end()) return;          if (iter == pInstruments->end()) return;
1226          pInstruments->erase(iter);          pInstruments->erase(iter);
# Line 1324  namespace DLS { Line 1342  namespace DLS {
1342      /**      /**
1343       * Updates (persistently) the wave pool table with offsets to all       * Updates (persistently) the wave pool table with offsets to all
1344       * currently available samples. <b>Caution:</b> this method assumes the       * currently available samples. <b>Caution:</b> this method assumes the
1345       * 'ptbl' chunk to be already of the correct size, so usually this       * 'ptbl' chunk to be already of the correct size and the file to be
1346       * method is only called after a Save() call.       * writable, so usually this method is only called after a Save() call.
1347       *       *
1348       * @throws Exception - if 'ptbl' chunk is too small (should only occur       * @throws Exception - if 'ptbl' chunk is too small (should only occur
1349       *                     if there's a bug)       *                     if there's a bug)
# Line 1335  namespace DLS { Line 1353  namespace DLS {
1353          RIFF::Chunk* ptbl = pRIFF->GetSubChunk(CHUNK_ID_PTBL);          RIFF::Chunk* ptbl = pRIFF->GetSubChunk(CHUNK_ID_PTBL);
1354          const int iOffsetSize = (b64BitWavePoolOffsets) ? 8 : 4;          const int iOffsetSize = (b64BitWavePoolOffsets) ? 8 : 4;
1355          // check if 'ptbl' chunk is large enough          // check if 'ptbl' chunk is large enough
1356          WavePoolCount = pSamples->size();          WavePoolCount = (pSamples) ? pSamples->size() : 0;
1357          const unsigned long ulRequiredSize = WavePoolHeaderSize + iOffsetSize * WavePoolCount;          const unsigned long ulRequiredSize = WavePoolHeaderSize + iOffsetSize * WavePoolCount;
1358          if (ptbl->GetSize() < ulRequiredSize) throw Exception("Fatal error, 'ptbl' chunk too small");          if (ptbl->GetSize() < ulRequiredSize) throw Exception("Fatal error, 'ptbl' chunk too small");
1359          uint8_t* pData = (uint8_t*) ptbl->LoadChunkData();          // save the 'ptbl' chunk's current read/write position
1360            unsigned long ulOriginalPos = ptbl->GetPos();
1361          // update headers          // update headers
1362          memccpy(&pData[0], &WavePoolHeaderSize, 1, 4);          ptbl->SetPos(0);
1363          memccpy(&pData[4], &WavePoolCount, 1, 4);          ptbl->WriteUint32(&WavePoolHeaderSize);
1364            ptbl->WriteUint32(&WavePoolCount);
1365          // update offsets          // update offsets
1366            ptbl->SetPos(WavePoolHeaderSize);
1367          if (b64BitWavePoolOffsets) {          if (b64BitWavePoolOffsets) {
1368              for (int i = 0 ; i < WavePoolCount ; i++) {              for (int i = 0 ; i < WavePoolCount ; i++) {
1369                  memccpy(&pData[WavePoolHeaderSize + i*iOffsetSize], &pWavePoolTableHi[i], 1, 4);                  ptbl->WriteUint32(&pWavePoolTableHi[i]);
1370                  memccpy(&pData[WavePoolHeaderSize + i*iOffsetSize], &pWavePoolTable[i],   1, 4);                  ptbl->WriteUint32(&pWavePoolTable[i]);
1371              }              }
1372          } else { // conventional 32 bit offsets          } else { // conventional 32 bit offsets
1373              for (int i = 0 ; i < WavePoolCount ; i++)              for (int i = 0 ; i < WavePoolCount ; i++)
1374                  memccpy(&pData[WavePoolHeaderSize + i*iOffsetSize], &pWavePoolTable[i], 1, 4);                  ptbl->WriteUint32(&pWavePoolTable[i]);
1375          }          }
1376            // restore 'ptbl' chunk's original read/write position
1377            ptbl->SetPos(ulOriginalPos);
1378      }      }
1379    
1380      /**      /**
# Line 1360  namespace DLS { Line 1383  namespace DLS {
1383       * exists already.       * exists already.
1384       */       */
1385      void File::__UpdateWavePoolTable() {      void File::__UpdateWavePoolTable() {
1386          WavePoolCount = pSamples->size();          WavePoolCount = (pSamples) ? pSamples->size() : 0;
1387          // resize wave pool table arrays          // resize wave pool table arrays
1388          if (pWavePoolTable)   delete[] pWavePoolTable;          if (pWavePoolTable)   delete[] pWavePoolTable;
1389          if (pWavePoolTableHi) delete[] pWavePoolTableHi;          if (pWavePoolTableHi) delete[] pWavePoolTableHi;
1390          pWavePoolTable   = new uint32_t[WavePoolCount];          pWavePoolTable   = new uint32_t[WavePoolCount];
1391          pWavePoolTableHi = new uint32_t[WavePoolCount];          pWavePoolTableHi = new uint32_t[WavePoolCount];
1392            if (!pSamples) return;
1393          // update offsets int wave pool table          // update offsets int wave pool table
1394          RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL);          RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL);
1395          uint64_t wvplFileOffset = wvpl->GetFilePos();          uint64_t wvplFileOffset = wvpl->GetFilePos();
# Line 1373  namespace DLS { Line 1397  namespace DLS {
1397              SampleList::iterator iter = pSamples->begin();              SampleList::iterator iter = pSamples->begin();
1398              SampleList::iterator end  = pSamples->end();              SampleList::iterator end  = pSamples->end();
1399              for (int i = 0 ; iter != end ; ++iter, i++) {              for (int i = 0 ; iter != end ; ++iter, i++) {
1400                  uint64_t _64BitOffset = wvplFileOffset - (*iter)->pWaveList->GetFilePos() - LIST_HEADER_SIZE;                  uint64_t _64BitOffset = (*iter)->pWaveList->GetFilePos() - wvplFileOffset - LIST_HEADER_SIZE;
1401                  (*iter)->ulWavePoolOffset = _64BitOffset;                  (*iter)->ulWavePoolOffset = _64BitOffset;
1402                  pWavePoolTableHi[i] = (uint32_t) (_64BitOffset >> 32);                  pWavePoolTableHi[i] = (uint32_t) (_64BitOffset >> 32);
1403                  pWavePoolTable[i]   = (uint32_t) _64BitOffset;                  pWavePoolTable[i]   = (uint32_t) _64BitOffset;
# Line 1382  namespace DLS { Line 1406  namespace DLS {
1406              SampleList::iterator iter = pSamples->begin();              SampleList::iterator iter = pSamples->begin();
1407              SampleList::iterator end  = pSamples->end();              SampleList::iterator end  = pSamples->end();
1408              for (int i = 0 ; iter != end ; ++iter, i++) {              for (int i = 0 ; iter != end ; ++iter, i++) {
1409                  uint64_t _64BitOffset = wvplFileOffset - (*iter)->pWaveList->GetFilePos() - LIST_HEADER_SIZE;                  uint64_t _64BitOffset = (*iter)->pWaveList->GetFilePos() - wvplFileOffset - LIST_HEADER_SIZE;
1410                  (*iter)->ulWavePoolOffset = _64BitOffset;                  (*iter)->ulWavePoolOffset = _64BitOffset;
1411                  pWavePoolTable[i] = (uint32_t) _64BitOffset;                  pWavePoolTable[i] = (uint32_t) _64BitOffset;
1412              }              }

Legend:
Removed from v.800  
changed lines
  Added in v.834

  ViewVC Help
Powered by ViewVC