/[svn]/gigedit/trunk/src/gigedit/mainwindow.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.cpp

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

revision 3825 by schoenebeck, Tue Sep 1 16:45:06 2020 UTC revision 3826 by schoenebeck, Tue Oct 6 16:45:17 2020 UTC
# Line 5063  void MainWindow::on_action_remove_unused Line 5063  void MainWindow::on_action_remove_unused
5063      if (!file) return;      if (!file) return;
5064    
5065      // collect all samples that are not referenced by any instrument      // collect all samples that are not referenced by any instrument
5066      std::list<gig::Sample*> lsamples;      std::list<gig::Sample*> lsamples = unusedSamples(file);
     for (int iSample = 0; file->GetSample(iSample); ++iSample) {  
         gig::Sample* sample = file->GetSample(iSample);  
         bool isUsed = false;  
         for (gig::Instrument* instrument = file->GetFirstInstrument(); instrument;  
                               instrument = file->GetNextInstrument())  
         {  
             for (gig::Region* rgn = instrument->GetFirstRegion(); rgn;  
                               rgn = instrument->GetNextRegion())  
             {  
                 for (int i = 0; i < 256; ++i) {  
                     if (!rgn->pDimensionRegions[i]) continue;  
                     if (rgn->pDimensionRegions[i]->pSample != sample) continue;  
                     isUsed = true;  
                     goto endOfRefSearch;  
                 }  
             }  
         }  
         endOfRefSearch:  
         if (!isUsed) lsamples.push_back(sample);  
     }  
   
5067      if (lsamples.empty()) return;      if (lsamples.empty()) return;
5068    
5069      // notify everybody that we're going to remove these samples      // notify everybody that we're going to remove these samples

Legend:
Removed from v.3825  
changed lines
  Added in v.3826

  ViewVC Help
Powered by ViewVC