From 1c25d3a69ac27dc1f93bca3a71996e757b452c4b Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 3 Sep 2017 14:08:41 +0200 Subject: Add bleed controls for the drumkit with priority over those set in the instrument files. --- src/instrumentparser.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/instrumentparser.cc') diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc index 1f3948e..f49a6af 100644 --- a/src/instrumentparser.cc +++ b/src/instrumentparser.cc @@ -94,14 +94,13 @@ void InstrumentParser::startTag(const std::string& name, const attr_t& attr) return; } - bool main = false; + InstrumentChannel* channel = addOrGetChannel(attr.at("name")); + channel->main = main_state_t::is_not_main; if(attr.find("main") != attr.end()) { - main = attr.at("main") == "true"; + channel->main = (attr.at("main") == "true") ? + main_state_t::is_main : main_state_t::is_not_main; } - - InstrumentChannel* channel = addOrGetChannel(attr.at("name")); - channel->main = main; } if(name == "samples") @@ -169,7 +168,7 @@ void InstrumentParser::startTag(const std::string& name, const attr_t& attr) auto audio_file = std::make_unique(path + "/" + attr.at("file"), filechannel, - instrument_channel->main); + instrument_channel); sample->addAudioFile(instrument_channel, audio_file.get()); @@ -263,8 +262,7 @@ InstrumentChannel* InstrumentParser::addOrGetChannel(const std::string& name) instrument.instrument_channels.emplace_back(name); InstrumentChannel& channel = instrument.instrument_channels.back(); - channel.main = true; // Ad-hoc added channels are all main by default for - // backwards compatibility. + channel.main = main_state_t::unset; return &channel; } -- cgit v1.2.3