From 6adb14a7027c8d54827093c83fc80694d71fb6a7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 20 Jun 2018 19:21:48 +0200 Subject: 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. --- test/domloadertest.cc | 10 ++++++---- test/drumkit_creator.cc | 15 +++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/domloadertest.cc b/test/domloadertest.cc index 69b9821..55d49a7 100644 --- a/test/domloadertest.cc +++ b/test/domloadertest.cc @@ -34,6 +34,7 @@ #include #include "scopedfile.h" +#include "path.h" class DOMLoaderTest : public DGUnit @@ -99,13 +100,13 @@ public: " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -119,14 +120,15 @@ public: DrumkitDOM drumkitdom; std::vector instrumentdoms; DGUNIT_ASSERT(parseDrumkitFile(scoped_file.filename(), drumkitdom)); + auto basepath = getPath(scoped_file.filename()); for(const auto& ref: drumkitdom.instruments) { instrumentdoms.emplace_back(); - DGUNIT_ASSERT(parseInstrumentFile(ref.file, instrumentdoms.back())); + DGUNIT_ASSERT(parseInstrumentFile(basepath + "/" + ref.file, instrumentdoms.back())); } DOMLoader domloader(settings, random); - DGUNIT_ASSERT(domloader.loadDom(drumkitdom, instrumentdoms, drumkit)); + DGUNIT_ASSERT(domloader.loadDom(basepath, drumkitdom, instrumentdoms, drumkit)); // // Drumkit: 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 = "\n" - "\n"; + "\n" + " \n"; // FIXME sampleref - std::string postfix = "\n" - "\n" - "\n" - "\n" - "\n" - "\n"; + std::string postfix = " \n\n"; std::string samples; + float power = 1.0f; for (const auto& sample: data.sample_data) { - samples += "\n"; + samples += "\n"; + power += 0.1f; for (std::size_t i = 0; i < sample.audiofiles.size(); ++i) { -- cgit v1.2.3