diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-06-10 18:20:55 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-08-12 11:11:42 +0200 |
commit | b360c7cf59cc87f79972fcdd82164834f97833b0 (patch) | |
tree | b1aaf60c111ab07c98566053ed27c345a04f99e0 /src/drumkitloader.cc | |
parent | fd696ac4f08dbd269aca0772e7e311775d84bb0c (diff) |
Add new DOMLoader class and unit-test.
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r-- | src/drumkitloader.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index 02b2c13..0cef31b 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -35,6 +35,7 @@ #include "DGDOM.h" #include "dgxmlparser.h" #include "path.h" +#include "domloader.h" #define REFSFILE "refs.conf" @@ -134,12 +135,17 @@ bool DrumKitLoader::loadkit(const std::string& file) std::string path = getPath(edited_filename); bool parseerror = parseDrumkitFile(edited_filename, drumkitdom); - for(InstrumentRefDOM ref: drumkitdom.instruments) { + for(const auto& ref : drumkitdom.instruments) + { instrumentdoms.emplace_back(); - parseerror |= parseInstrumentFile(path + "/" + ref.file, instrumentdoms.back()); + parseerror &= parseInstrumentFile(path + "/" + ref.file, instrumentdoms.back()); } - if(parseerror) { + DOMLoader domloader(settings, rand); + parseerror &= domloader.loadDom(drumkitdom, instrumentdoms, kit); + + if(parseerror) + { ERR(drumgizmo, "Drumkit parser failed: %s\n", file.c_str()); settings.drumkit_load_status.store(LoadStatus::Error); @@ -150,18 +156,6 @@ bool DrumKitLoader::loadkit(const std::string& file) return false; } - //TODO: create - - kit._name = drumkitdom.name; - kit._description = drumkitdom.description; - kit._samplerate = drumkitdom.samplerate; - - for(auto& channel: drumkitdom.channels) { - kit.channels.emplace_back(); - kit.channels.back().name = channel.name; - kit.channels.back().num = kit.channels.size() -1; - } - // Check if there is enough free RAM to load the drumkit. //if(!memchecker.enoughFreeMemory(kit)) //{ |