summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-03-12 09:09:07 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-03-12 09:09:07 +0100
commit75de9c0ac782fa6fecb92f3a22f311b517856abb (patch)
treed54b8e9165eaec49f0104caa3dc9eb936a708526 /src
parentfaf80b071b54f2f736df2390171f7b3b939d03c2 (diff)
Add reload_counter to Settings and use it in DrumKitLoader to reload a drumkit whenever it changes (ie. increments).
Diffstat (limited to 'src')
-rw-r--r--src/drumkitloader.cc3
-rw-r--r--src/settings.h13
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<LoadStatus> 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<std::size_t>::max() means "unlimited"
- //Atomic<std::size_t> cache_upper_limit{std::numeric_limits<std::size_t>::max()};
- Atomic<std::size_t> disk_cache_upper_limit{1024*1024*1024};
+ //! is allowed to use for preloading. Default is 1GB.
+ Atomic<std::size_t> disk_cache_upper_limit{1024 * 1024 * 1024};
Atomic<bool> disk_cache_enable{true};
+ //! Increment this in order to invoke a reload of the current drumkit.
+ Atomic<std::size_t> reload_counter{0};
+
Atomic<std::string> midimap_file{""};
Atomic<LoadStatus> midimap_load_status{LoadStatus::Idle};
@@ -83,6 +84,7 @@ struct SettingsGetter
SettingRef<std::size_t> disk_cache_upper_limit;
SettingRef<bool> disk_cache_enable;
+ SettingRef<std::size_t> reload_counter;
SettingRef<std::string> midimap_file;
SettingRef<LoadStatus> 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<std::size_t> disk_cache_upper_limit;
Notifier<bool> disk_cache_enable;
+ Notifier<std::size_t> reload_counter;
Notifier<std::string> midimap_file;
Notifier<LoadStatus> 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);