/[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 1081 by schoenebeck, Thu Mar 8 00:17:03 2007 UTC revision 1102 by persson, Sun Mar 18 07:13:06 2007 UTC
# Line 2152  namespace { Line 2152  namespace {
2152                  if (file->pWavePoolTable) pDimensionRegions[i]->pSample = GetSampleFromWavePool(wavepoolindex);                  if (file->pWavePoolTable) pDimensionRegions[i]->pSample = GetSampleFromWavePool(wavepoolindex);
2153              }              }
2154              GetSample(); // load global region sample reference              GetSample(); // load global region sample reference
2155            } else {
2156                DimensionRegions = 0;
2157          }          }
2158    
2159          // make sure there is at least one dimension region          // make sure there is at least one dimension region
# Line 2740  namespace { Line 2742  namespace {
2742      }      }
2743    
2744      Group::~Group() {      Group::~Group() {
2745            // remove the chunk associated with this group (if any)
2746            if (pNameChunk) pNameChunk->GetParent()->DeleteSubChunk(pNameChunk);
2747      }      }
2748    
2749      /** @brief Update chunks with current group settings.      /** @brief Update chunks with current group settings.
2750       *       *
2751       * Apply current Group field values to the respective. You have to call       * Apply current Group field values to the respective chunks. You have
2752       * File::Save() to make changes persistent.       * to call File::Save() to make changes persistent.
2753         *
2754         * Usually there is absolutely no need to call this method explicitly.
2755         * It will be called automatically when File::Save() was called.
2756       */       */
2757      void Group::UpdateChunks() {      void Group::UpdateChunks() {
2758          // make sure <3gri> and <3gnl> list chunks exist          // make sure <3gri> and <3gnl> list chunks exist
# Line 2893  namespace { Line 2900  namespace {
2900          if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples");          if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples");
2901          SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample);          SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample);
2902          if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample");          if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample");
2903            if (SamplesIterator != pSamples->end() && *SamplesIterator == pSample) ++SamplesIterator; // avoid iterator invalidation
2904          pSamples->erase(iter);          pSamples->erase(iter);
2905          delete pSample;          delete pSample;
2906      }      }
# Line 3175  namespace { Line 3183  namespace {
3183          }          }
3184      }      }
3185    
3186        /**
3187         * Apply all the gig file's current instruments, samples, groups and settings
3188         * to the respective RIFF chunks. You have to call Save() to make changes
3189         * persistent.
3190         *
3191         * Usually there is absolutely no need to call this method explicitly.
3192         * It will be called automatically when File::Save() was called.
3193         *
3194         * @throws Exception - on errors
3195         */
3196        void File::UpdateChunks() {
3197            // first update base class's chunks
3198            DLS::File::UpdateChunks();
3199    
3200            // update group's chunks
3201            if (pGroups) {
3202                std::list<Group*>::iterator iter = pGroups->begin();
3203                std::list<Group*>::iterator end  = pGroups->end();
3204                for (; iter != end; ++iter) {
3205                    (*iter)->UpdateChunks();
3206                }
3207            }
3208        }
3209    
3210    
3211    
3212  // *************** Exception ***************  // *************** Exception ***************

Legend:
Removed from v.1081  
changed lines
  Added in v.1102

  ViewVC Help
Powered by ViewVC