/[svn]/libgig/trunk/src/korg2gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/korg2gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2560 by schoenebeck, Wed May 14 20:07:10 2014 UTC revision 2561 by schoenebeck, Mon May 19 12:39:19 2014 UTC
# Line 63  static void printUsage() { Line 63  static void printUsage() {
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  }  }
# Line 446  static gig::Sample* findOrCreateGigSampl Line 450  static gig::Sample* findOrCreateGigSampl
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");
# Line 466  static void loadKorgFile(const string& f Line 476  static void loadKorgFile(const string& f
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()))
# Line 739  int main(int argc, char *argv[]) { Line 757  int main(int argc, char *argv[]) {
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) {

Legend:
Removed from v.2560  
changed lines
  Added in v.2561

  ViewVC Help
Powered by ViewVC