From 75de9c0ac782fa6fecb92f3a22f311b517856abb Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 12 Mar 2017 09:09:07 +0100 Subject: Add reload_counter to Settings and use it in DrumKitLoader to reload a drumkit whenever it changes (ie. increments). --- src/drumkitloader.cc | 3 ++- src/settings.h | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index 1d66597..103b60c 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -201,7 +201,8 @@ void DrumKitLoader::thread_main() } bool newKit = false; - if(getter.drumkit_file.hasChanged()) + if(getter.drumkit_file.hasChanged() || + getter.reload_counter.hasChanged()) { loadkit(getter.drumkit_file.getValue()); newKit = true; diff --git a/src/settings.h b/src/settings.h index cb707ef..8a646a1 100644 --- a/src/settings.h +++ b/src/settings.h @@ -50,12 +50,13 @@ struct Settings Atomic drumkit_load_status{LoadStatus::Idle}; //! The maximum amount of memory in bytes that the AudioCache - //! is allowed to use for preloading - //! The default std::numeric_limits::max() means "unlimited" - //Atomic cache_upper_limit{std::numeric_limits::max()}; - Atomic disk_cache_upper_limit{1024*1024*1024}; + //! is allowed to use for preloading. Default is 1GB. + Atomic disk_cache_upper_limit{1024 * 1024 * 1024}; Atomic disk_cache_enable{true}; + //! Increment this in order to invoke a reload of the current drumkit. + Atomic reload_counter{0}; + Atomic midimap_file{""}; Atomic midimap_load_status{LoadStatus::Idle}; @@ -83,6 +84,7 @@ struct SettingsGetter SettingRef disk_cache_upper_limit; SettingRef disk_cache_enable; + SettingRef reload_counter; SettingRef midimap_file; SettingRef midimap_load_status; @@ -107,6 +109,7 @@ struct SettingsGetter , drumkit_load_status(settings.drumkit_load_status) , disk_cache_upper_limit(settings.disk_cache_upper_limit) , disk_cache_enable(settings.disk_cache_enable) + , reload_counter(settings.reload_counter) , midimap_file(settings.midimap_file) , midimap_load_status(settings.midimap_load_status) , enable_velocity_modifier{settings.enable_velocity_modifier} @@ -132,6 +135,7 @@ public: Notifier disk_cache_upper_limit; Notifier disk_cache_enable; + Notifier reload_counter; Notifier midimap_file; Notifier midimap_load_status; @@ -160,6 +164,7 @@ public: EVAL(disk_cache_upper_limit); EVAL(disk_cache_enable); + EVAL(reload_counter); EVAL(midimap_file); EVAL(midimap_load_status); -- cgit v1.2.3