/[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 3927 by schoenebeck, Tue Jun 15 11:00:50 2021 UTC revision 3928 by schoenebeck, Tue Jun 15 11:38:38 2021 UTC
# Line 6270  namespace { Line 6270  namespace {
6270          }          }
6271      }      }
6272    
6273        /**
6274         * Returns a pointer to the first <i>Sample</i> object of the file,
6275         * <i>NULL</i> otherwise.
6276         *
6277         * @param pProgress - optional: callback function for progress notification
6278         * @deprecated  This method is not reentrant-safe, use GetSample()
6279         *              instead.
6280         */
6281      Sample* File::GetFirstSample(progress_t* pProgress) {      Sample* File::GetFirstSample(progress_t* pProgress) {
6282          if (!pSamples) LoadSamples(pProgress);          if (!pSamples) LoadSamples(pProgress);
6283          if (!pSamples) return NULL;          if (!pSamples) return NULL;
# Line 6277  namespace { Line 6285  namespace {
6285          return static_cast<gig::Sample*>( (SamplesIterator != pSamples->end()) ? *SamplesIterator : NULL );          return static_cast<gig::Sample*>( (SamplesIterator != pSamples->end()) ? *SamplesIterator : NULL );
6286      }      }
6287    
6288        /**
6289         * Returns a pointer to the next <i>Sample</i> object of the file,
6290         * <i>NULL</i> otherwise.
6291         *
6292         * @deprecated  This method is not reentrant-safe, use GetSample()
6293         *              instead.
6294         */
6295      Sample* File::GetNextSample() {      Sample* File::GetNextSample() {
6296          if (!pSamples) return NULL;          if (!pSamples) return NULL;
6297          SamplesIterator++;          SamplesIterator++;
# Line 6286  namespace { Line 6301  namespace {
6301      /**      /**
6302       * Returns Sample object of @a index.       * Returns Sample object of @a index.
6303       *       *
6304         * @param index - position of sample in sample list (0..n)
6305         * @param pProgress - optional: callback function for progress notification
6306       * @returns sample object or NULL if index is out of bounds       * @returns sample object or NULL if index is out of bounds
6307       */       */
6308      Sample* File::GetSample(uint index) {      Sample* File::GetSample(size_t index, progress_t* pProgress) {
6309          if (!pSamples) LoadSamples();          if (!pSamples) LoadSamples(pProgress);
6310          if (!pSamples) return NULL;          if (!pSamples) return NULL;
6311          DLS::File::SampleList::iterator it = pSamples->begin();          if (index >= pSamples->size()) return NULL;
6312          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 );  
6313      }      }
6314    
6315      /**      /**

Legend:
Removed from v.3927  
changed lines
  Added in v.3928

  ViewVC Help
Powered by ViewVC