summaryrefslogtreecommitdiff
path: root/src/domloader.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2019-01-27 17:02:40 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2019-01-27 17:02:40 +0100
commit2aae9799e1d96d827ad156aeafa549deabd51e5d (patch)
tree707fb2798cd3b9304fc4af690b557efc9d98a1a8 /src/domloader.cc
parent053b723adf3948d18f025efed9450d837359edd9 (diff)
Re-instate instrument v1.0 support.
Diffstat (limited to 'src/domloader.cc')
-rw-r--r--src/domloader.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/domloader.cc b/src/domloader.cc
index 663ef75..8a133fa 100644
--- a/src/domloader.cc
+++ b/src/domloader.cc
@@ -165,6 +165,35 @@ bool DOMLoader::loadDom(const std::string& basepath,
}
}
+ if(instrument->version == VersionStr(1,0,0))
+ {
+ // Version 1.0 use velocity groups
+ for(auto& velocity : instrumentdom.velocities)
+ {
+ for(const auto& sampleref : velocity.samplerefs)
+ {
+ bool found_sample{false};
+ for(const auto& sample : instrument->samplelist)
+ {
+ // TODO: What should be done with the probability??
+ if(sample->name == sampleref.name)
+ {
+ instrument->addSample(velocity.lower, velocity.upper, sample);
+ found_sample = true;
+ break;
+ }
+ }
+ if(!found_sample)
+ {
+ ERR(kitparser,
+ "Missing sample '%s' from sampleref in instrument '%s'\n",
+ sampleref.name.data(), instrument->getName().data());
+ return false;
+ }
+ }
+ }
+ }
+
instrument->finalise();
// Transfer ownership to the DrumKit object.