summaryrefslogtreecommitdiff
path: root/test/drumkit_creator.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-06-20 19:21:48 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-08-12 11:11:45 +0200
commit6adb14a7027c8d54827093c83fc80694d71fb6a7 (patch)
treecc02ac1bdb548b0b317999d727a12fa5a9973594 /test/drumkit_creator.cc
parent1560674582102cd83197dccc79cb029fc843a48e (diff)
Fix missing finalization of instruments on load. Fix relative instrument filenames according to the drumkit file. Make drumkit creator create version 2.0 drumkits. Reduce missing refs file to a warning.
Diffstat (limited to 'test/drumkit_creator.cc')
-rw-r--r--test/drumkit_creator.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/drumkit_creator.cc b/test/drumkit_creator.cc
index 7a0291c..d92f876 100644
--- a/test/drumkit_creator.cc
+++ b/test/drumkit_creator.cc
@@ -44,6 +44,7 @@
DrumkitCreator::~DrumkitCreator()
{
+ return;
for (const auto& file: created_files)
{
auto error = unlink(file.c_str());
@@ -304,18 +305,16 @@ void DrumkitCreator::createInstrument(const InstrumentData& data, std::size_t nu
const std::string& dir)
{
std::string prefix = "<?xml version='1.0' encoding='UTF-8'?>\n"
- "<instrument name=\"" + data.name + "\" version=\"2.0\">\n";
+ "<instrument name=\"" + data.name + "\" version=\"2.0\">\n"
+ " <samples>\n";
// FIXME sampleref
- std::string postfix = "<velocities>\n"
- "<velocity lower=\"0\" upper=\"1\">\n"
- "<sampleref probability=\"1\" name=\"stroke1\"/>\n"
- "</velocity>\n"
- "</velocities>\n"
- "</instrument>\n";
+ std::string postfix = " </samples>\n</instrument>\n";
std::string samples;
+ float power = 1.0f;
for (const auto& sample: data.sample_data) {
- samples += "<sample name=\"" + sample.name + "\">\n";
+ samples += "<sample name=\"" + sample.name + "\" power=\"" + std::to_string(power) + "\">\n";
+ power += 0.1f;
for (std::size_t i = 0; i < sample.audiofiles.size(); ++i)
{