/[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 3925 by schoenebeck, Mon Jun 14 12:15:51 2021 UTC revision 3941 by schoenebeck, Fri Jun 18 14:06:20 2021 UTC
# Line 609  namespace { Line 609  namespace {
609          uint16_t iSampleGroup = 0; // 0 refers to default sample group          uint16_t iSampleGroup = 0; // 0 refers to default sample group
610          File* pFile = static_cast<File*>(pParent);          File* pFile = static_cast<File*>(pParent);
611          if (pFile->pGroups) {          if (pFile->pGroups) {
612              std::list<Group*>::iterator iter = pFile->pGroups->begin();              std::vector<Group*>::iterator iter = pFile->pGroups->begin();
613              std::list<Group*>::iterator end  = pFile->pGroups->end();              std::vector<Group*>::iterator end  = pFile->pGroups->end();
614              for (int i = 0; iter != end; i++, iter++) {              for (int i = 0; iter != end; i++, iter++) {
615                  if (*iter == pGroup) {                  if (*iter == pGroup) {
616                      iSampleGroup = i;                      iSampleGroup = i;
# Line 4325  namespace { Line 4325  namespace {
4325              uint64_t soughtoffset =              uint64_t soughtoffset =
4326                  uint64_t(file->pWavePoolTable[WavePoolTableIndex]) |                  uint64_t(file->pWavePoolTable[WavePoolTableIndex]) |
4327                  uint64_t(file->pWavePoolTableHi[WavePoolTableIndex]) << 32;                  uint64_t(file->pWavePoolTableHi[WavePoolTableIndex]) << 32;
4328              Sample* sample = file->GetFirstSample(pProgress);              size_t i = 0;
4329              while (sample) {              for (Sample* sample = file->GetSample(i, pProgress); sample;
4330                             sample = file->GetSample(++i))
4331                {
4332                  if (sample->ullWavePoolOffset == soughtoffset)                  if (sample->ullWavePoolOffset == soughtoffset)
4333                      return static_cast<gig::Sample*>(sample);                      return sample;
                 sample = file->GetNextSample();  
4334              }              }
4335          } else {          } else {
4336              // use extension files and 32 bit wave pool offsets              // use extension files and 32 bit wave pool offsets
4337              file_offset_t soughtoffset = file->pWavePoolTable[WavePoolTableIndex];              file_offset_t soughtoffset = file->pWavePoolTable[WavePoolTableIndex];
4338              file_offset_t soughtfileno = file->pWavePoolTableHi[WavePoolTableIndex];              file_offset_t soughtfileno = file->pWavePoolTableHi[WavePoolTableIndex];
4339              Sample* sample = file->GetFirstSample(pProgress);              size_t i = 0;
4340              while (sample) {              for (Sample* sample = file->GetSample(i, pProgress); sample;
4341                             sample = file->GetSample(++i))
4342                {
4343                  if (sample->ullWavePoolOffset == soughtoffset &&                  if (sample->ullWavePoolOffset == soughtoffset &&
4344                      sample->FileNo == soughtfileno) return static_cast<gig::Sample*>(sample);                      sample->FileNo == soughtfileno) return sample;
                 sample = file->GetNextSample();  
4345              }              }
4346          }          }
4347          return NULL;          return NULL;
# Line 5301  namespace { Line 5303  namespace {
5303      }      }
5304    
5305      /**      /**
5306         * Returns Region at supplied @a pos position within the region list of
5307         * this instrument. If supplied @a pos is out of bounds then @c NULL is
5308         * returned.
5309         *
5310         * @param pos - position of sought Region in region list
5311         * @returns pointer address to requested region or @c NULL if @a pos is
5312         *          out of bounds
5313         */
5314        Region* Instrument::GetRegionAt(size_t pos) {
5315            if (!pRegions) return NULL;
5316            if (pos >= pRegions->size()) return NULL;
5317            return static_cast<gig::Region*>( (*pRegions)[pos] );
5318        }
5319    
5320        /**
5321       * Returns the first Region of the instrument. You have to call this       * Returns the first Region of the instrument. You have to call this
5322       * method once before you use GetNextRegion().       * method once before you use GetNextRegion().
5323       *       *
5324       * @returns  pointer address to first region or NULL if there is none       * @returns  pointer address to first region or NULL if there is none
5325       * @see      GetNextRegion()       * @see      GetNextRegion()
5326         * @deprecated  This method is not reentrant-safe, use GetRegionAt()
5327         *              instead.
5328       */       */
5329      Region* Instrument::GetFirstRegion() {      Region* Instrument::GetFirstRegion() {
5330          if (!pRegions) return NULL;          if (!pRegions) return NULL;
# Line 5320  namespace { Line 5339  namespace {
5339       *       *
5340       * @returns  pointer address to the next region or NULL if end reached       * @returns  pointer address to the next region or NULL if end reached
5341       * @see      GetFirstRegion()       * @see      GetFirstRegion()
5342         * @deprecated  This method is not reentrant-safe, use GetRegionAt()
5343         *              instead.
5344       */       */
5345      Region* Instrument::GetNextRegion() {      Region* Instrument::GetNextRegion() {
5346          if (!pRegions) return NULL;          if (!pRegions) return NULL;
# Line 5373  namespace { Line 5394  namespace {
5394       * @param dst - destination instrument at which this instrument will be       * @param dst - destination instrument at which this instrument will be
5395       *              moved to, or pass NULL for moving to end of list       *              moved to, or pass NULL for moving to end of list
5396       * @throw gig::Exception if this instrument and target instrument are not       * @throw gig::Exception if this instrument and target instrument are not
5397       *                       part of the same file       *                       part of the same file, as well as on unexpected
5398         *                       internal error
5399       */       */
5400      void Instrument::MoveTo(Instrument* dst) {      void Instrument::MoveTo(Instrument* dst) {
5401          if (dst && GetParent() != dst->GetParent())          if (dst && GetParent() != dst->GetParent())
# Line 5390  namespace { Line 5412  namespace {
5412    
5413              File::InstrumentList::iterator itFrom =              File::InstrumentList::iterator itFrom =
5414                  std::find(list.begin(), list.end(), static_cast<DLS::Instrument*>(this));                  std::find(list.begin(), list.end(), static_cast<DLS::Instrument*>(this));
5415                if (itFrom == list.end())
5416                    throw Exception(
5417                        "gig::Instrument::MoveTo(): unexpected missing membership "
5418                        "of this instrument."
5419                    );
5420                list.erase(itFrom);
5421    
5422              File::InstrumentList::iterator itTo =              File::InstrumentList::iterator itTo =
5423                  std::find(list.begin(), list.end(), static_cast<DLS::Instrument*>(dst));                  std::find(list.begin(), list.end(), static_cast<DLS::Instrument*>(dst));
5424    
5425              list.splice(itTo, list, itFrom);              list.insert(itTo, this);
5426          }          }
5427    
5428          // move the instrument's actual list RIFF chunk appropriately          // move the instrument's actual list RIFF chunk appropriately
# Line 5986  namespace { Line 6014  namespace {
6014          pMidiRules[0] = NULL;          pMidiRules[0] = NULL;
6015                    
6016          // delete all old regions          // delete all old regions
6017          while (Regions) DeleteRegion(GetFirstRegion());          while (Regions) DeleteRegion(GetRegionAt(0));
6018          // create new regions and copy them from original          // create new regions and copy them from original
6019          {          {
6020              RegionList::const_iterator it = orig->pRegions->begin();              RegionList::const_iterator it = orig->pRegions->begin();
# Line 6042  namespace { Line 6070  namespace {
6070      Group::Group(File* file, RIFF::Chunk* ck3gnm) {      Group::Group(File* file, RIFF::Chunk* ck3gnm) {
6071          pFile      = file;          pFile      = file;
6072          pNameChunk = ck3gnm;          pNameChunk = ck3gnm;
6073            SamplesIterator = 0;
6074          ::LoadString(pNameChunk, Name);          ::LoadString(pNameChunk, Name);
6075      }      }
6076    
# Line 6100  namespace { Line 6129  namespace {
6129      }      }
6130    
6131      /**      /**
6132         * Returns Sample object at @a index of this sample group.
6133         *
6134         * @param index - position of sample in this sample group's sample list
6135         *                (0..n)
6136         * @returns sample object or NULL if index is out of bounds
6137         */
6138        Sample* Group::GetSample(size_t index) {
6139            if (pFile->pSamples && index >= pFile->pSamples->size()) return NULL;
6140            size_t indexInFile = 0;
6141            size_t indexInGroup = 0;
6142            for (Sample* pSample = pFile->GetSample(indexInFile); pSample;
6143                         pSample = pFile->GetSample(++indexInFile))
6144            {
6145                if (pSample->GetGroup() != this) continue;
6146                if (indexInGroup++ == index) return pSample;
6147            }
6148            return NULL;
6149        }
6150    
6151        /**
6152       * Returns the first Sample of this Group. You have to call this method       * Returns the first Sample of this Group. You have to call this method
6153       * once before you use GetNextSample().       * once before you use GetNextSample().
6154       *       *
# Line 6109  namespace { Line 6158  namespace {
6158       * @returns  pointer address to first Sample or NULL if there is none       * @returns  pointer address to first Sample or NULL if there is none
6159       *           applied to this Group       *           applied to this Group
6160       * @see      GetNextSample()       * @see      GetNextSample()
6161         * @deprecated  This method is not reentrant-safe, use GetSample()
6162         *              instead.
6163       */       */
6164      Sample* Group::GetFirstSample() {      Sample* Group::GetFirstSample() {
6165          // FIXME: lazy und unsafe implementation, should be an autonomous iterator          size_t& i = this->SamplesIterator;
6166          for (Sample* pSample = pFile->GetFirstSample(); pSample; pSample = pFile->GetNextSample()) {          i = 0;
6167              if (pSample->GetGroup() == this) return pSample;          for (Sample* pSample = pFile->GetSample(i); pSample;
6168                         pSample = pFile->GetSample(++i))
6169            {
6170                if (pSample->GetGroup() == this)
6171                    return pSample;
6172          }          }
6173          return NULL;          return NULL;
6174      }      }
# Line 6127  namespace { Line 6182  namespace {
6182       * @returns  pointer address to the next Sample of this Group or NULL if       * @returns  pointer address to the next Sample of this Group or NULL if
6183       *           end reached       *           end reached
6184       * @see      GetFirstSample()       * @see      GetFirstSample()
6185         * @deprecated  This method is not reentrant-safe, use GetSample()
6186         *              instead.
6187       */       */
6188      Sample* Group::GetNextSample() {      Sample* Group::GetNextSample() {
6189          // FIXME: lazy und unsafe implementation, should be an autonomous iterator          size_t& i = this->SamplesIterator;
6190          for (Sample* pSample = pFile->GetNextSample(); pSample; pSample = pFile->GetNextSample()) {          for (Sample* pSample = pFile->GetSample(++i); pSample;
6191              if (pSample->GetGroup() == this) return pSample;                       pSample = pFile->GetSample(++i))
6192            {
6193                if (pSample->GetGroup() == this)
6194                    return pSample;
6195          }          }
6196          return NULL;          return NULL;
6197      }      }
# Line 6151  namespace { Line 6211  namespace {
6211       */       */
6212      void Group::MoveAll() {      void Group::MoveAll() {
6213          // get "that" other group first          // get "that" other group first
6214            size_t i = 0;
6215          Group* pOtherGroup = NULL;          Group* pOtherGroup = NULL;
6216          for (pOtherGroup = pFile->GetFirstGroup(); pOtherGroup; pOtherGroup = pFile->GetNextGroup()) {          for (pOtherGroup = pFile->GetGroup(i); pOtherGroup;
6217                 pOtherGroup = pFile->GetGroup(++i))
6218            {
6219              if (pOtherGroup != this) break;              if (pOtherGroup != this) break;
6220          }          }
6221          if (!pOtherGroup) throw Exception(          if (!pOtherGroup) throw Exception(
# Line 6160  namespace { Line 6223  namespace {
6223              "other Group. This is a bug, report it!"              "other Group. This is a bug, report it!"
6224          );          );
6225          // now move all samples of this group to the other group          // now move all samples of this group to the other group
6226          for (Sample* pSample = GetFirstSample(); pSample; pSample = GetNextSample()) {          Sample* pSample;
6227            while ((pSample = GetSample(0))) {
6228              pOtherGroup->AddSample(pSample);              pOtherGroup->AddSample(pSample);
6229          }          }
6230      }      }
# Line 6232  namespace { Line 6296  namespace {
6296    
6297      File::~File() {      File::~File() {
6298          if (pGroups) {          if (pGroups) {
6299              std::list<Group*>::iterator iter = pGroups->begin();              std::vector<Group*>::iterator iter = pGroups->begin();
6300              std::list<Group*>::iterator end  = pGroups->end();              std::vector<Group*>::iterator end  = pGroups->end();
6301              while (iter != end) {              while (iter != end) {
6302                  delete *iter;                  delete *iter;
6303                  ++iter;                  ++iter;
# Line 6251  namespace { Line 6315  namespace {
6315          }          }
6316      }      }
6317    
6318        /**
6319         * Returns a pointer to the first <i>Sample</i> object of the file,
6320         * <i>NULL</i> otherwise.
6321         *
6322         * @param pProgress - optional: callback function for progress notification
6323         * @deprecated  This method is not reentrant-safe, use GetSample()
6324         *              instead.
6325         */
6326      Sample* File::GetFirstSample(progress_t* pProgress) {      Sample* File::GetFirstSample(progress_t* pProgress) {
6327          if (!pSamples) LoadSamples(pProgress);          if (!pSamples) LoadSamples(pProgress);
6328          if (!pSamples) return NULL;          if (!pSamples) return NULL;
# Line 6258  namespace { Line 6330  namespace {
6330          return static_cast<gig::Sample*>( (SamplesIterator != pSamples->end()) ? *SamplesIterator : NULL );          return static_cast<gig::Sample*>( (SamplesIterator != pSamples->end()) ? *SamplesIterator : NULL );
6331      }      }
6332    
6333        /**
6334         * Returns a pointer to the next <i>Sample</i> object of the file,
6335         * <i>NULL</i> otherwise.
6336         *
6337         * @deprecated  This method is not reentrant-safe, use GetSample()
6338         *              instead.
6339         */
6340      Sample* File::GetNextSample() {      Sample* File::GetNextSample() {
6341          if (!pSamples) return NULL;          if (!pSamples) return NULL;
6342          SamplesIterator++;          SamplesIterator++;
# Line 6267  namespace { Line 6346  namespace {
6346      /**      /**
6347       * Returns Sample object of @a index.       * Returns Sample object of @a index.
6348       *       *
6349         * @param index - position of sample in sample list (0..n)
6350         * @param pProgress - optional: callback function for progress notification
6351       * @returns sample object or NULL if index is out of bounds       * @returns sample object or NULL if index is out of bounds
6352       */       */
6353      Sample* File::GetSample(uint index) {      Sample* File::GetSample(size_t index, progress_t* pProgress) {
6354          if (!pSamples) LoadSamples();          if (!pSamples) LoadSamples(pProgress);
6355          if (!pSamples) return NULL;          if (!pSamples) return NULL;
6356          DLS::File::SampleList::iterator it = pSamples->begin();          if (index >= pSamples->size()) return NULL;
6357          for (int i = 0; i < index; ++i) {          return static_cast<gig::Sample*>( (*pSamples)[index] );
             ++it;  
             if (it == pSamples->end()) return NULL;  
         }  
         if (it == pSamples->end()) return NULL;  
         return static_cast<gig::Sample*>( *it );  
6358      }      }
6359    
6360      /**      /**
# Line 6340  namespace { Line 6416  namespace {
6416          // remove all references to the sample          // remove all references to the sample
6417          for (Instrument* instrument = GetFirstInstrument() ; instrument ;          for (Instrument* instrument = GetFirstInstrument() ; instrument ;
6418               instrument = GetNextInstrument()) {               instrument = GetNextInstrument()) {
6419              for (Region* region = instrument->GetFirstRegion() ; region ;              size_t iRgn = 0;
6420                   region = instrument->GetNextRegion()) {              for (Region* region = instrument->GetRegionAt(iRgn); region;
6421                     region = instrument->GetRegionAt(++iRgn))
6422                {
6423                  if (region->GetSample() == pSample) region->SetSample(NULL);                  if (region->GetSample() == pSample) region->SetSample(NULL);
6424    
6425                  for (int i = 0 ; i < region->DimensionRegions ; i++) {                  for (int i = 0 ; i < region->DimensionRegions ; i++) {
# Line 6513  namespace { Line 6590  namespace {
6590                  __divide_progress(pProgress, &subprogress, 3.0f, 0.0f); // randomly schedule 33% for this subtask                  __divide_progress(pProgress, &subprogress, 3.0f, 0.0f); // randomly schedule 33% for this subtask
6591                  __notify_progress(&subprogress, 0.0f);                  __notify_progress(&subprogress, 0.0f);
6592                  if (GetAutoLoad())                  if (GetAutoLoad())
6593                      GetFirstSample(&subprogress); // now force all samples to be loaded                      GetSample(0, &subprogress); // now force all samples to be loaded
6594                  __notify_progress(&subprogress, 1.0f);                  __notify_progress(&subprogress, 1.0f);
6595    
6596                  // instrument loading subtask                  // instrument loading subtask
# Line 6527  namespace { Line 6604  namespace {
6604              } else {              } else {
6605                  // sample loading subtask                  // sample loading subtask
6606                  if (GetAutoLoad())                  if (GetAutoLoad())
6607                      GetFirstSample(); // now force all samples to be loaded                      GetSample(0); // now force all samples to be loaded
6608    
6609                  // instrument loading subtask                  // instrument loading subtask
6610                  LoadInstruments();                  LoadInstruments();
# Line 6767  namespace { Line 6844  namespace {
6844      }      }
6845    
6846      int File::GetWaveTableIndexOf(gig::Sample* pSample) {      int File::GetWaveTableIndexOf(gig::Sample* pSample) {
6847          if (!pSamples) GetFirstSample(); // make sure sample chunks were scanned          if (!pSamples) GetSample(0); // make sure sample chunks were scanned
6848          File::SampleList::iterator iter = pSamples->begin();          File::SampleList::iterator iter = pSamples->begin();
6849          File::SampleList::iterator end  = pSamples->end();          File::SampleList::iterator end  = pSamples->end();
6850          for (int index = 0; iter != end; ++iter, ++index)          for (int index = 0; iter != end; ++iter, ++index)
# Line 6787  namespace { Line 6864  namespace {
6864          if (!_3crc) return false;          if (!_3crc) return false;
6865          if (_3crc->GetNewSize() <= 0) return false;          if (_3crc->GetNewSize() <= 0) return false;
6866          if (_3crc->GetNewSize() % 8) return false;          if (_3crc->GetNewSize() % 8) return false;
6867          if (!pSamples) GetFirstSample(); // make sure sample chunks were scanned          if (!pSamples) GetSample(0); // make sure sample chunks were scanned
6868          if (_3crc->GetNewSize() != pSamples->size() * 8) return false;          if (_3crc->GetNewSize() != pSamples->size() * 8) return false;
6869    
6870          const file_offset_t n = _3crc->GetNewSize() / 8;          const file_offset_t n = _3crc->GetNewSize() / 8;
# Line 6821  namespace { Line 6898  namespace {
6898       */       */
6899      bool File::RebuildSampleChecksumTable() {      bool File::RebuildSampleChecksumTable() {
6900          // make sure sample chunks were scanned          // make sure sample chunks were scanned
6901          if (!pSamples) GetFirstSample();          if (!pSamples) GetSample(0);
6902    
6903          bool bRequiresSave = false;          bool bRequiresSave = false;
6904    
# Line 6870  namespace { Line 6947  namespace {
6947          return bRequiresSave;          return bRequiresSave;
6948      }      }
6949    
6950        /**
6951         * Returns a pointer to the first <i>Group</i> object of the file,
6952         * <i>NULL</i> otherwise.
6953         *
6954         * @deprecated  This method is not reentrant-safe, use GetGroup() instead.
6955         */
6956      Group* File::GetFirstGroup() {      Group* File::GetFirstGroup() {
6957          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
6958          // there must always be at least one group          // there must always be at least one group
# Line 6877  namespace { Line 6960  namespace {
6960          return *GroupsIterator;          return *GroupsIterator;
6961      }      }
6962    
6963        /**
6964         * Returns a pointer to the next <i>Group</i> object of the file,
6965         * <i>NULL</i> otherwise.
6966         *
6967         * @deprecated  This method is not reentrant-safe, use GetGroup() instead.
6968         */
6969      Group* File::GetNextGroup() {      Group* File::GetNextGroup() {
6970          if (!pGroups) return NULL;          if (!pGroups) return NULL;
6971          ++GroupsIterator;          ++GroupsIterator;
# Line 6889  namespace { Line 6978  namespace {
6978       * @param index - number of the sought group (0..n)       * @param index - number of the sought group (0..n)
6979       * @returns sought group or NULL if there's no such group       * @returns sought group or NULL if there's no such group
6980       */       */
6981      Group* File::GetGroup(uint index) {      Group* File::GetGroup(size_t index) {
6982          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
6983          GroupsIterator = pGroups->begin();          if (index >= pGroups->size()) return NULL;
6984          for (uint i = 0; GroupsIterator != pGroups->end(); i++) {          return (*pGroups)[index];
             if (i == index) return *GroupsIterator;  
             ++GroupsIterator;  
         }  
         return NULL;  
6985      }      }
6986    
6987      /**      /**
# Line 6911  namespace { Line 6996  namespace {
6996       */       */
6997      Group* File::GetGroup(String name) {      Group* File::GetGroup(String name) {
6998          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
6999          GroupsIterator = pGroups->begin();          size_t i = 0;
7000          for (uint i = 0; GroupsIterator != pGroups->end(); ++GroupsIterator, ++i)          for (Group* pGroup = GetGroup(i); pGroup; pGroup = GetGroup(++i))
7001              if ((*GroupsIterator)->Name == name) return *GroupsIterator;              if (pGroup->Name == name) return pGroup;
7002          return NULL;          return NULL;
7003      }      }
7004    
# Line 6937  namespace { Line 7022  namespace {
7022       */       */
7023      void File::DeleteGroup(Group* pGroup) {      void File::DeleteGroup(Group* pGroup) {
7024          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
7025          std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup);          std::vector<Group*>::iterator iter =
7026                find(pGroups->begin(), pGroups->end(), pGroup);
7027          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");
7028          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");
7029          // delete all members of this group          // delete all members of this group
7030          for (Sample* pSample = pGroup->GetFirstSample(); pSample; pSample = pGroup->GetNextSample()) {          Sample* pSample;
7031            while ((pSample = pGroup->GetSample(0))) {
7032              DeleteSample(pSample);              DeleteSample(pSample);
7033          }          }
7034          // now delete this group object          // now delete this group object
# Line 6962  namespace { Line 7049  namespace {
7049       */       */
7050      void File::DeleteGroupOnly(Group* pGroup) {      void File::DeleteGroupOnly(Group* pGroup) {
7051          if (!pGroups) LoadGroups();          if (!pGroups) LoadGroups();
7052          std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup);          std::vector<Group*>::iterator iter =
7053                find(pGroups->begin(), pGroups->end(), pGroup);
7054          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");          if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group");
7055          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");          if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!");
7056          // move all members of this group to another group          // move all members of this group to another group
# Line 6973  namespace { Line 7061  namespace {
7061      }      }
7062    
7063      void File::LoadGroups() {      void File::LoadGroups() {
7064          if (!pGroups) pGroups = new std::list<Group*>;          if (!pGroups) pGroups = new std::vector<Group*>;
7065          // try to read defined groups from file          // try to read defined groups from file
7066          RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI);          RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI);
7067          if (lst3gri) {          if (lst3gri) {
# Line 7172  namespace { Line 7260  namespace {
7260                  }                  }
7261              }              }
7262    
7263              std::list<Group*>::iterator iter = pGroups->begin();              std::vector<Group*>::iterator iter = pGroups->begin();
7264              std::list<Group*>::iterator end  = pGroups->end();              std::vector<Group*>::iterator end  = pGroups->end();
7265              for (; iter != end; ++iter) {              for (; iter != end; ++iter) {
7266                  (*iter)->UpdateChunks(pProgress);                  (*iter)->UpdateChunks(pProgress);
7267              }              }
# Line 7211  namespace { Line 7299  namespace {
7299              uint8_t* pData = (uint8_t*) einf->LoadChunkData();              uint8_t* pData = (uint8_t*) einf->LoadChunkData();
7300    
7301              std::map<gig::Sample*,int> sampleMap;              std::map<gig::Sample*,int> sampleMap;
7302              int sampleIdx = 0;              size_t sampleIdx = 0;
7303              for (Sample* pSample = GetFirstSample(); pSample; pSample = GetNextSample()) {              for (Sample* pSample = GetSample(0); pSample;
7304                  sampleMap[pSample] = sampleIdx++;                           pSample = GetSample(++sampleIdx))
7305                {
7306                    sampleMap[pSample] = sampleIdx;
7307              }              }
7308    
7309              int totnbusedsamples = 0;              int totnbusedsamples = 0;
# Line 7234  namespace { Line 7324  namespace {
7324    
7325                  memset(&pData[(instrumentIdx + 1) * sublen + 48], 0, sublen - 48);                  memset(&pData[(instrumentIdx + 1) * sublen + 48], 0, sublen - 48);
7326    
7327                  for (Region* region = instrument->GetFirstRegion() ; region ;                  size_t iRgn = 0;
7328                       region = instrument->GetNextRegion()) {                  for (Region* region = instrument->GetRegionAt(iRgn); region;
7329                         region = instrument->GetRegionAt(++iRgn))
7330                    {
7331                      for (int i = 0 ; i < region->DimensionRegions ; i++) {                      for (int i = 0 ; i < region->DimensionRegions ; i++) {
7332                          gig::DimensionRegion *d = region->pDimensionRegions[i];                          gig::DimensionRegion *d = region->pDimensionRegions[i];
7333                          if (d->pSample) {                          if (d->pSample) {

Legend:
Removed from v.3925  
changed lines
  Added in v.3941

  ViewVC Help
Powered by ViewVC