diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/domloadertest.cc | 10 | ||||
-rw-r--r-- | test/drumkit_creator.cc | 15 |
2 files changed, 13 insertions, 12 deletions
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 <random.h> #include "scopedfile.h" +#include "path.h" class DOMLoaderTest : public DGUnit @@ -99,13 +100,13 @@ public: " <channel name=\"SnareBottom\"/>\n" \ " </channels>\n" \ " <instruments>\n" \ - " <instrument name=\"Snare1\" file=\"") + scoped_instrument_file1.filename() + std::string("\">\n" \ + " <instrument name=\"Snare1\" file=\"") + getFile(scoped_instrument_file1.filename()) + std::string("\">\n" \ " <channelmap in=\"AmbLeft\" out=\"AmbLeft\" main=\"true\"/>\n" \ " <channelmap in=\"AmbRight\" out=\"AmbRight\" main=\"true\"/>\n" \ " <channelmap in=\"SnareTop\" out=\"SnareTop\"/>\n" \ " <channelmap in=\"SnareBottom\" out=\"SnareBottom\"/>\n" \ " </instrument>\n" \ - " <instrument name=\"Snare2\" file=\"") + scoped_instrument_file2.filename() + std::string("\">\n" \ + " <instrument name=\"Snare2\" file=\"") + getFile(scoped_instrument_file2.filename()) + std::string("\">\n" \ " <channelmap in=\"AmbLeft2\" out=\"AmbLeft\" main=\"true\"/>\n" \ " <channelmap in=\"AmbRight2\" out=\"AmbRight\" main=\"true\"/>\n" \ " <channelmap in=\"SnareTop2\" out=\"SnareTop\"/>\n" \ @@ -119,14 +120,15 @@ public: DrumkitDOM drumkitdom; std::vector<InstrumentDOM> 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 = "<?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) { |