--- libgig/trunk/src/tools/korg2gig.cpp 2014/05/21 20:33:45 2571 +++ libgig/trunk/src/tools/korg2gig.cpp 2017/05/11 11:34:19 3175 @@ -1,6 +1,6 @@ /*************************************************************************** * * - * Copyright (C) 2014 Christian Schoenebeck * + * Copyright (C) 2014-2017 Christian Schoenebeck * * * * * * This program is part of libgig. * @@ -34,8 +34,8 @@ # include #endif -#include "Korg.h" -#include "gig.h" +#include "../Korg.h" +#include "../gig.h" using namespace std; @@ -68,6 +68,7 @@ } static bool endsWith(const string& haystack, const string& needle) { + if (haystack.size() < needle.size()) return false; return haystack.substr(haystack.size() - needle.size(), needle.size()) == needle; } @@ -214,7 +215,7 @@ stripWhiteSpace(w); stripLeftOrRightMarkerAtEnd(w); string result = parseNumberRangeAtEnd(w, from, to); - if (result == w) return s; // parse error occured, return original input s + if (result == w) return s; // parse error occurred, return original input s stripWhiteSpace(result); return result; } @@ -310,7 +311,7 @@ set velocityRanges; for (int i = 0; i < group.size(); ++i) { Korg::KMPInstrument* instr = group[i]; - int iLowerKey = 0; + uint16_t iLowerKey = 0; for (int k = 0; k < instr->GetRegionCount(); ++k) { Korg::KMPRegion* rgn = instr->GetRegion(k); DLS::range_t keyRange2 = { iLowerKey, rgn->TopKey }; @@ -319,7 +320,7 @@ int from, to; string baseName = parseNumberRange(instr->Name(), from, to); if (baseName != instr->Name()) { // number range like "003-120" found in instrument name ... - DLS::range_t velRange = { from, to }; + DLS::range_t velRange = { uint16_t(from), uint16_t(to) }; velocityRanges.insert(velRange); } } @@ -508,7 +509,7 @@ exit(EXIT_FAILURE); } catch (...) { cerr << "Failed opening input file '" << filename << "':" << endl; - cerr << "Unknown exception occured while trying to access input file." << endl; + cerr << "Unknown exception occurred while trying to access input file." << endl; exit(EXIT_FAILURE); } } @@ -623,7 +624,7 @@ Korg::KMPInstrument* kmpInstr = *itInstr; cout << " |---> KMP multi sample '" << kmpInstr->Name() << "'" << endl; - int iLowKey = 0; + uint16_t iLowKey = 0; for (int k = 0; k < kmpInstr->GetRegionCount(); ++k) { Korg::KMPRegion* kmpRegion = kmpInstr->GetRegion(k); DLS::range_t keyRange = { iLowKey, kmpRegion->TopKey }; @@ -755,6 +756,8 @@ dimRgn->DimensionUpperLimits[iVelocityDimensionIndex] = velRange.high; // gig v3 and above } + dimRgn->FineTune = kmpRegion->Tune; + // assign the respective gig sample to this dimension region gig::Sample* gigSample = findOrCreateGigSampleForKSFRegion(kmpRegion); dimRgn->pSample = gigSample; // might be NULL (if Korg sample had zero size, or if the original instrument's internal samples were used)