/[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 3723 by schoenebeck, Wed Jan 22 15:48:32 2020 UTC revision 3922 by schoenebeck, Mon Jun 14 10:33:29 2021 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2020 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2021 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
# Line 209  namespace DLS { Line 209  namespace DLS {
209          if (lart) {          if (lart) {
210              uint32_t artCkType = (lart->GetListType() == LIST_TYPE_LAR2) ? CHUNK_ID_ART2              uint32_t artCkType = (lart->GetListType() == LIST_TYPE_LAR2) ? CHUNK_ID_ART2
211                                                                           : CHUNK_ID_ARTL;                                                                           : CHUNK_ID_ARTL;
212              RIFF::Chunk* art = lart->GetFirstSubChunk();              size_t i = 0;
213              while (art) {              for (RIFF::Chunk* art = lart->GetSubChunkAt(i); art;
214                     art = lart->GetSubChunkAt(++i))
215                {
216                  if (art->GetChunkID() == artCkType) {                  if (art->GetChunkID() == artCkType) {
217                      if (!pArticulations) pArticulations = new ArticulationList;                      if (!pArticulations) pArticulations = new ArticulationList;
218                      pArticulations->push_back(new Articulation(art));                      pArticulations->push_back(new Articulation(art));
219                  }                  }
                 art = lart->GetNextSubChunk();  
220              }              }
221          }          }
222      }      }
# Line 1375  namespace DLS { Line 1376  namespace DLS {
1376          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);
1377          if (lrgn) {          if (lrgn) {
1378              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
1379              RIFF::List* rgn = lrgn->GetFirstSubList();              size_t i = 0;
1380              while (rgn) {              for (RIFF::List* rgn = lrgn->GetSubListAt(i); rgn;
1381                     rgn = lrgn->GetSubListAt(++i))
1382                {
1383                  if (rgn->GetListType() == regionCkType) {                  if (rgn->GetListType() == regionCkType) {
1384                      pRegions->push_back(new Region(this, rgn));                      pRegions->push_back(new Region(this, rgn));
1385                  }                  }
                 rgn = lrgn->GetNextSubList();  
1386              }              }
1387          }          }
1388      }      }
# Line 1679  namespace DLS { Line 1681  namespace DLS {
1681          if (wvpl) {          if (wvpl) {
1682              file_offset_t wvplFileOffset = wvpl->GetFilePos() -              file_offset_t wvplFileOffset = wvpl->GetFilePos() -
1683                                             wvpl->GetPos(); // should be zero, but just to be sure                                             wvpl->GetPos(); // should be zero, but just to be sure
1684              RIFF::List* wave = wvpl->GetFirstSubList();              size_t i = 0;
1685              while (wave) {              for (RIFF::List* wave = wvpl->GetSubListAt(i); wave;
1686                     wave = wvpl->GetSubListAt(++i))
1687                {
1688                  if (wave->GetListType() == LIST_TYPE_WAVE) {                  if (wave->GetListType() == LIST_TYPE_WAVE) {
1689                      file_offset_t waveFileOffset = wave->GetFilePos() -                      file_offset_t waveFileOffset = wave->GetFilePos() -
1690                                                     wave->GetPos(); // should be zero, but just to be sure                                                     wave->GetPos(); // should be zero, but just to be sure
1691                      pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset));                      pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset));
1692                  }                  }
                 wave = wvpl->GetNextSubList();  
1693              }              }
1694          }          }
1695          else { // Seen a dwpl list chunk instead of a wvpl list chunk in some file (officially not DLS compliant)          else { // Seen a dwpl list chunk instead of a wvpl list chunk in some file (officially not DLS compliant)
# Line 1694  namespace DLS { Line 1697  namespace DLS {
1697              if (dwpl) {              if (dwpl) {
1698                  file_offset_t dwplFileOffset = dwpl->GetFilePos() -                  file_offset_t dwplFileOffset = dwpl->GetFilePos() -
1699                                                 dwpl->GetPos(); // should be zero, but just to be sure                                                 dwpl->GetPos(); // should be zero, but just to be sure
1700                  RIFF::List* wave = dwpl->GetFirstSubList();                  size_t i = 0;
1701                  while (wave) {                  for (RIFF::List* wave = dwpl->GetSubListAt(i); wave;
1702                         wave = dwpl->GetSubListAt(++i))
1703                    {
1704                      if (wave->GetListType() == LIST_TYPE_WAVE) {                      if (wave->GetListType() == LIST_TYPE_WAVE) {
1705                          file_offset_t waveFileOffset = wave->GetFilePos() -                          file_offset_t waveFileOffset = wave->GetFilePos() -
1706                                                         wave->GetPos(); // should be zero, but just to be sure                                                         wave->GetPos(); // should be zero, but just to be sure
1707                          pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset));                          pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset));
1708                      }                      }
                     wave = dwpl->GetNextSubList();  
1709                  }                  }
1710              }              }
1711          }          }
# Line 1758  namespace DLS { Line 1762  namespace DLS {
1762          if (!pInstruments) pInstruments = new InstrumentList;          if (!pInstruments) pInstruments = new InstrumentList;
1763          RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);          RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS);
1764          if (lstInstruments) {          if (lstInstruments) {
1765              RIFF::List* lstInstr = lstInstruments->GetFirstSubList();              size_t i = 0;
1766              while (lstInstr) {              for (RIFF::List* lstInstr = lstInstruments->GetSubListAt(i);
1767                     lstInstr; lstInstr = lstInstruments->GetSubListAt(++i))
1768                {
1769                  if (lstInstr->GetListType() == LIST_TYPE_INS) {                  if (lstInstr->GetListType() == LIST_TYPE_INS) {
1770                      pInstruments->push_back(new Instrument(this, lstInstr));                      pInstruments->push_back(new Instrument(this, lstInstr));
1771                  }                  }
                 lstInstr = lstInstruments->GetNextSubList();  
1772              }              }
1773          }          }
1774      }      }

Legend:
Removed from v.3723  
changed lines
  Added in v.3922

  ViewVC Help
Powered by ViewVC