From bd0e48a876f25751ae7e0d025178b19d773ca00e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 17 Jun 2018 15:26:07 +0200 Subject: Finished DOMLoader and fixed the broken unit-tests. --- src/dgxmlparser.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/dgxmlparser.cc') diff --git a/src/dgxmlparser.cc b/src/dgxmlparser.cc index cc76b3e..3fdedc2 100644 --- a/src/dgxmlparser.cc +++ b/src/dgxmlparser.cc @@ -114,9 +114,11 @@ bool parseDrumkitFile(const std::string& filename, DrumkitDOM& dom) //TODO: handle xml version pugi::xml_node drumkit = doc.child("drumkit"); - res &= attrcpy(dom.description, drumkit, "description"); res &= attrcpy(dom.name, drumkit, "name"); - res &= attrcpy(dom.samplerate, drumkit, "samplerate"); + res &= attrcpy(dom.version, drumkit, "version"); + res &= attrcpy(dom.description, drumkit, "description"); + dom.samplerate = 44100.0; + res &= attrcpy(dom.samplerate, drumkit, "samplerate", true); pugi::xml_node channels = doc.child("drumkit").child("channels"); for(pugi::xml_node channel: channels.children("channel")) @@ -158,6 +160,8 @@ bool parseInstrumentFile(const std::string& filename, InstrumentDOM& dom) pugi::xml_node instrument = doc.child("instrument"); res &= attrcpy(dom.name, instrument, "name"); + res &= attrcpy(dom.version, instrument, "version"); + res &= attrcpy(dom.description, instrument, "description", true); pugi::xml_node channels = instrument.child("channels"); for(pugi::xml_node channel : channels.children("channel")) @@ -168,7 +172,7 @@ bool parseInstrumentFile(const std::string& filename, InstrumentDOM& dom) res &= attrcpy(dom.instrument_channels.back().main, channel, "main", true); } - pugi::xml_node samples = doc.child("instrument").child("samples"); + pugi::xml_node samples = instrument.child("samples"); for(pugi::xml_node sample: samples.children("sample")) { dom.samples.emplace_back(); -- cgit v1.2.3