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); |
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 *************** |