63 |
cout << endl; |
cout << endl; |
64 |
} |
} |
65 |
|
|
66 |
|
static bool beginsWith(const string& haystack, const string& needle) { |
67 |
|
return haystack.substr(0, needle.size()) == needle; |
68 |
|
} |
69 |
|
|
70 |
static bool endsWith(const string& haystack, const string& needle) { |
static bool endsWith(const string& haystack, const string& needle) { |
71 |
return haystack.substr(haystack.size() - needle.size(), needle.size()) == needle; |
return haystack.substr(haystack.size() - needle.size(), needle.size()) == needle; |
72 |
} |
} |
450 |
gigSampleGroup->Name = baseName; |
gigSampleGroup->Name = baseName; |
451 |
} |
} |
452 |
|
|
453 |
|
if (kmpRegion->SampleFileName == "SKIPPEDSAMPL" || |
454 |
|
(beginsWith(kmpRegion->SampleFileName, "INTERNAL") && !endsWith(kmpRegion->SampleFileName, ".KSF"))) |
455 |
|
{ |
456 |
|
return NULL; |
457 |
|
} |
458 |
|
|
459 |
Korg::KSFSample* ksfSample = findKSFSampleWithFileName(kmpRegion->FullSampleFileName()); |
Korg::KSFSample* ksfSample = findKSFSampleWithFileName(kmpRegion->FullSampleFileName()); |
460 |
if (!ksfSample) |
if (!ksfSample) |
461 |
throw Korg::Exception("Internal error: Could not resolve KSFSample object"); |
throw Korg::Exception("Internal error: Could not resolve KSFSample object"); |
476 |
|
|
477 |
for (int i = 0; i < instr->GetRegionCount(); ++i) { |
for (int i = 0; i < instr->GetRegionCount(); ++i) { |
478 |
Korg::KMPRegion* rgn = instr->GetRegion(i); |
Korg::KMPRegion* rgn = instr->GetRegion(i); |
479 |
|
if (rgn->SampleFileName == "SKIPPEDSAMPL") { |
480 |
|
cout << "WARNING: 'SKIPPEDSAMPL' as sample reference found!\n"; |
481 |
|
continue; |
482 |
|
} else if (beginsWith(rgn->SampleFileName, "INTERNAL") && |
483 |
|
!endsWith(rgn->SampleFileName, ".KSF")) { |
484 |
|
cout << "WARNING: One of the KORG instrument's internal samples was referenced as sample!\n"; |
485 |
|
continue; |
486 |
|
} |
487 |
// check if the sample referenced by this region was already |
// check if the sample referenced by this region was already |
488 |
// loaded, if not then load it ... |
// loaded, if not then load it ... |
489 |
if (!findKSFSampleWithFileName(rgn->FullSampleFileName())) |
if (!findKSFSampleWithFileName(rgn->FullSampleFileName())) |
757 |
|
|
758 |
// assign the respective gig sample to this dimension region |
// assign the respective gig sample to this dimension region |
759 |
gig::Sample* gigSample = findOrCreateGigSampleForKSFRegion(kmpRegion); |
gig::Sample* gigSample = findOrCreateGigSampleForKSFRegion(kmpRegion); |
760 |
dimRgn->pSample = gigSample; // might be NULL (if Korg sample had zero size) |
dimRgn->pSample = gigSample; // might be NULL (if Korg sample had zero size, or if the original instrument's internal samples were used) |
761 |
if (gigSample) { |
if (gigSample) { |
762 |
dimRgn->UnityNote = gigSample->MIDIUnityNote; |
dimRgn->UnityNote = gigSample->MIDIUnityNote; |
763 |
if (gigSample->Loops) { |
if (gigSample->Loops) { |