diff options
-rw-r--r-- | src/drumkitparser.cc | 8 | ||||
-rw-r--r-- | src/drumkitparser.h | 2 | ||||
-rw-r--r-- | src/instrumentparser.cc | 8 | ||||
-rw-r--r-- | src/instrumentparser.h | 6 | ||||
-rw-r--r-- | src/settings.h | 5 |
5 files changed, 25 insertions, 4 deletions
diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc index 2a49e47..d86957e 100644 --- a/src/drumkitparser.cc +++ b/src/drumkitparser.cc @@ -45,6 +45,8 @@ DrumKitParser::DrumKitParser(Settings& settings, DrumKit& k, Random& rand) int DrumKitParser::parseFile(const std::string& filename) { + settings.has_bleed_control.store(false); + auto edited_filename(filename); if(refs.load()) @@ -182,6 +184,10 @@ void DrumKitParser::startTag(const std::string& name, const attr_t& attr) { cattr.main_state = (attr.at("main") == "true") ? main_state_t::is_main : main_state_t::is_not_main; + if(cattr.main_state == main_state_t::is_main) + { + settings.has_bleed_control.store(true); + } } channelmap[attr.at("in")] = cattr; @@ -198,7 +204,7 @@ void DrumKitParser::endTag(const std::string& name) auto ptr = std::make_unique<Instrument>(settings, rand); ptr->setGroup(instr_group); - InstrumentParser parser(*ptr); + InstrumentParser parser(*ptr, settings); parser.parseFile(path + "/" + instr_file); // Transfer ownership to the DrumKit object. diff --git a/src/drumkitparser.h b/src/drumkitparser.h index e4645c3..c77b1ff 100644 --- a/src/drumkitparser.h +++ b/src/drumkitparser.h @@ -36,7 +36,7 @@ class DrumKitParser : public SAXParser { public: - DrumKitParser(Settings& setting, DrumKit& kit, Random& rand); + DrumKitParser(Settings& settings, DrumKit& kit, Random& rand); virtual ~DrumKitParser() = default; virtual int parseFile(const std::string& filename) override; diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc index f49a6af..9a5e36d 100644 --- a/src/instrumentparser.cc +++ b/src/instrumentparser.cc @@ -31,13 +31,15 @@ #include <hugin.hpp> +#include "settings.h" #include "cpp11fix.h" #include "path.h" #include "nolocale.h" -InstrumentParser::InstrumentParser(Instrument& instrument) +InstrumentParser::InstrumentParser(Instrument& instrument, Settings& settings) : instrument(instrument) + , settings(settings) { } @@ -100,6 +102,10 @@ void InstrumentParser::startTag(const std::string& name, const attr_t& attr) { channel->main = (attr.at("main") == "true") ? main_state_t::is_main : main_state_t::is_not_main; + if(channel->main == main_state_t::is_main) + { + settings.has_bleed_control.store(true); + } } } diff --git a/src/instrumentparser.h b/src/instrumentparser.h index e87489f..f88f2ae 100644 --- a/src/instrumentparser.h +++ b/src/instrumentparser.h @@ -32,11 +32,13 @@ #include <memory> #include <vector> +class Settings; + class InstrumentParser : public SAXParser { public: - InstrumentParser(Instrument &instrument); + InstrumentParser(Instrument &instrument, Settings& settings); virtual ~InstrumentParser() = default; virtual int parseFile(const std::string& filename) override; @@ -57,4 +59,6 @@ private: level_t lower{0}; level_t upper{0}; + + Settings& settings; }; diff --git a/src/settings.h b/src/settings.h index 2f3569f..c88dc95 100644 --- a/src/settings.h +++ b/src/settings.h @@ -90,6 +90,7 @@ struct Settings Atomic<bool> enable_bleed_control{false}; Atomic<float> master_bleed{1.0f}; + Atomic<bool> has_bleed_control{false}; Atomic<bool> enable_latency_modifier{true}; @@ -154,6 +155,7 @@ struct SettingsGetter SettingRef<bool> enable_bleed_control; SettingRef<float> master_bleed; + SettingRef<bool> has_bleed_control; SettingRef<bool> enable_latency_modifier; SettingRef<std::size_t> latency_max; @@ -190,6 +192,7 @@ struct SettingsGetter , current_file{settings.current_file} , enable_bleed_control{settings.enable_bleed_control} , master_bleed{settings.master_bleed} + , has_bleed_control{settings.has_bleed_control} , enable_latency_modifier{settings.enable_latency_modifier} , latency_max{settings.latency_max} , latency_laid_back{settings.latency_laid_back} @@ -239,6 +242,7 @@ public: Notifier<bool> enable_bleed_control; Notifier<float> master_bleed; + Notifier<bool> has_bleed_control; Notifier<bool> enable_latency_modifier; Notifier<std::size_t> latency_max; @@ -286,6 +290,7 @@ public: EVAL(enable_bleed_control); EVAL(master_bleed); + EVAL(has_bleed_control); EVAL(enable_latency_modifier); EVAL(latency_max); |