/[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 3925 by schoenebeck, Mon Jun 14 10:33:29 2021 UTC revision 3926 by schoenebeck, Tue Jun 15 10:16:40 2021 UTC
# Line 1358  namespace DLS { Line 1358  namespace DLS {
1358          pRegions = NULL;          pRegions = NULL;
1359      }      }
1360    
1361        /**
1362         * Returns Region at supplied @a pos position within the region list of
1363         * this instrument. If supplied @a pos is out of bounds then @c NULL is
1364         * returned.
1365         *
1366         * @param pos - position of sought Region in region list
1367         * @returns pointer address to requested region or @c NULL if @a pos is
1368         *          out of bounds
1369         */
1370        Region* Instrument::GetRegionAt(size_t pos) {
1371            if (!pRegions) LoadRegions();
1372            if (!pRegions) return NULL;
1373            if (pos >= pRegions->size()) return NULL;
1374            return (*pRegions)[pos];
1375        }
1376    
1377        /**
1378         * Returns the first Region of the instrument. You have to call this
1379         * method once before you use GetNextRegion().
1380         *
1381         * @returns  pointer address to first region or NULL if there is none
1382         * @see      GetNextRegion()
1383         * @deprecated  This method is not reentrant-safe, use GetRegionAt()
1384         *              instead.
1385         */
1386      Region* Instrument::GetFirstRegion() {      Region* Instrument::GetFirstRegion() {
1387          if (!pRegions) LoadRegions();          if (!pRegions) LoadRegions();
1388          if (!pRegions) return NULL;          if (!pRegions) return NULL;
# Line 1365  namespace DLS { Line 1390  namespace DLS {
1390          return (RegionsIterator != pRegions->end()) ? *RegionsIterator : NULL;          return (RegionsIterator != pRegions->end()) ? *RegionsIterator : NULL;
1391      }      }
1392    
1393        /**
1394         * Returns the next Region of the instrument. You have to call
1395         * GetFirstRegion() once before you can use this method. By calling this
1396         * method multiple times it iterates through the available Regions.
1397         *
1398         * @returns  pointer address to the next region or NULL if end reached
1399         * @see      GetFirstRegion()
1400         * @deprecated  This method is not reentrant-safe, use GetRegionAt()
1401         *              instead.
1402         */
1403      Region* Instrument::GetNextRegion() {      Region* Instrument::GetNextRegion() {
1404          if (!pRegions) return NULL;          if (!pRegions) return NULL;
1405          RegionsIterator++;          RegionsIterator++;
# Line 1401  namespace DLS { Line 1436  namespace DLS {
1436      void Instrument::MoveRegion(Region* pSrc, Region* pDst) {      void Instrument::MoveRegion(Region* pSrc, Region* pDst) {
1437          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);          RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN);
1438          lrgn->MoveSubChunk(pSrc->pCkRegion, (RIFF::Chunk*) (pDst ? pDst->pCkRegion : 0));          lrgn->MoveSubChunk(pSrc->pCkRegion, (RIFF::Chunk*) (pDst ? pDst->pCkRegion : 0));
1439            for (size_t i = 0; i < pRegions->size(); ++i) {
1440          pRegions->remove(pSrc);              if ((*pRegions)[i] == pSrc) {
1441          RegionList::iterator iter = find(pRegions->begin(), pRegions->end(), pDst);                  pRegions->erase(pRegions->begin() + i);
1442          pRegions->insert(iter, pSrc);                  RegionList::iterator iter = find(pRegions->begin(), pRegions->end(), pDst);
1443                    pRegions->insert(iter, pSrc);
1444                }
1445            }
1446      }      }
1447    
1448      void Instrument::DeleteRegion(Region* pRegion) {      void Instrument::DeleteRegion(Region* pRegion) {

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

  ViewVC Help
Powered by ViewVC