summaryrefslogtreecommitdiff
path: root/src/dgxmlparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dgxmlparser.cc')
-rw-r--r--src/dgxmlparser.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/dgxmlparser.cc b/src/dgxmlparser.cc
index 0d3cdcd..180d4cd 100644
--- a/src/dgxmlparser.cc
+++ b/src/dgxmlparser.cc
@@ -351,16 +351,20 @@ bool parseInstrumentFile(const std::string& filename, InstrumentDOM& dom, LogFun
dom.samples.emplace_back();
res &= attrcpy(dom.samples.back().name, sample, "name", logger, filename);
- // Power only part of >= v2.0 instruments.
- if(dom.version == "1.0")
+ // Settings which are only part of >= v2.0 instruments.
+ dom.samples.back().power = 0.0;
+ dom.samples.back().normalized = false; // optional - defaults to false
+ dom.samples.back().openness = 0.0; // optional - defaults to 0.0
+ if(dom.version != "1.0")
{
- dom.samples.back().power = 0.0;
- }
- else
- {
- res &= attrcpy(dom.samples.back().power, sample, "power", logger, filename);
- dom.samples.back().normalized = false;
- res &= attrcpy(dom.samples.back().normalized, sample, "normalized", logger, filename, true);
+ res &= attrcpy(dom.samples.back().power, sample, "power",
+ logger, filename);
+ res &= attrcpy(dom.samples.back().normalized, sample, "normalized",
+ logger, filename, true);
+ res &= attrcpy(dom.samples.back().openness, sample, "openness",
+ logger, filename, true);
+ dom.samples.back().openness =
+ std::min(1.0, std::max(dom.samples.back().openness, 0.0));
}
for(pugi::xml_node audiofile: sample.children("audiofile"))