/[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 1102 by persson, Sun Mar 18 07:13:06 2007 UTC revision 1155 by schoenebeck, Wed Apr 11 18:11:09 2007 UTC
# Line 352  namespace DLS { Line 352  namespace DLS {
352          SaveString(CHUNK_ID_ITCH, lstINFO, Technician, String(""), UseFixedLengthStrings, 128);          SaveString(CHUNK_ID_ITCH, lstINFO, Technician, String(""), UseFixedLengthStrings, 128);
353          SaveString(CHUNK_ID_ISFT, lstINFO, Software, defaultSoftware, UseFixedLengthStrings,          SaveString(CHUNK_ID_ISFT, lstINFO, Software, defaultSoftware, UseFixedLengthStrings,
354                     resourceType == LIST_TYPE_INS ?                     resourceType == LIST_TYPE_INS ?
355                     (Software == "" ? defaultSoftware.length() : Software.length()) : 128);                     (Software == "" ? defaultSoftware.length()+1 : Software.length()+1) : 128);
356          SaveString(CHUNK_ID_IMED, lstINFO, Medium, String(""), UseFixedLengthStrings, 128);          SaveString(CHUNK_ID_IMED, lstINFO, Medium, String(""), UseFixedLengthStrings, 128);
357          SaveString(CHUNK_ID_ISRC, lstINFO, Source, String(""), UseFixedLengthStrings, 128);          SaveString(CHUNK_ID_ISRC, lstINFO, Source, String(""), UseFixedLengthStrings, 128);
358          SaveString(CHUNK_ID_ISRF, lstINFO, SourceForm, String(""), UseFixedLengthStrings, 128);          SaveString(CHUNK_ID_ISRF, lstINFO, SourceForm, String(""), UseFixedLengthStrings, 128);
# Line 481  namespace DLS { Line 481  namespace DLS {
481          }          }
482      }      }
483    
484        /**
485         * Adds a new sample loop with the provided loop definition.
486         *
487         * @param - points to a loop definition that is to be copied
488         */
489        void Sampler::AddSampleLoop(sample_loop_t* pLoopDef) {
490            sample_loop_t* pNewLoops = new sample_loop_t[SampleLoops + 1];
491            // copy old loops array
492            for (int i = 0; i < SampleLoops; i++) {
493                pNewLoops[i] = pSampleLoops[i];
494            }
495            // add the new loop
496            pNewLoops[SampleLoops] = *pLoopDef;
497            // auto correct size field
498            pNewLoops[SampleLoops].Size = sizeof(DLS::sample_loop_t);
499            // free the old array and update the member variables
500            if (SampleLoops) delete[] pSampleLoops;
501            pSampleLoops = pNewLoops;
502            SampleLoops++;
503        }
504    
505        /**
506         * Deletes an existing sample loop.
507         *
508         * @param pLoopDef - pointer to existing loop definition
509         * @throws Exception - if given loop definition does not exist
510         */
511        void Sampler::DeleteSampleLoop(sample_loop_t* pLoopDef) {
512            sample_loop_t* pNewLoops = new sample_loop_t[SampleLoops - 1];
513            // copy old loops array (skipping given loop)
514            for (int i = 0, o = 0; i < SampleLoops; i++) {
515                if (&pSampleLoops[i] == pLoopDef) continue;
516                if (o == SampleLoops - 1)
517                    throw Exception("Could not delete Sample Loop, because it does not exist");
518                pNewLoops[o] = pSampleLoops[i];
519                o++;
520            }
521            // free the old array and update the member variables
522            if (SampleLoops) delete[] pSampleLoops;
523            pSampleLoops = pNewLoops;
524            SampleLoops--;
525        }
526    
527    
528    
529  // *************** Sample ***************  // *************** Sample ***************

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

  ViewVC Help
Powered by ViewVC