summaryrefslogtreecommitdiff
path: root/src/settings.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-01-27 22:24:36 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-01-27 22:25:22 +0100
commitf5caf0abae6ee897e71e7c4e905193703eb5bdf7 (patch)
tree2ab10ab6313f3b1c3f7a874f3fc6c133173574cb /src/settings.h
parent9fb79f76e3384a76ca193cd6bae9754eb474689e (diff)
Add settings for disk cache control (enable and cache upper limit)
Diffstat (limited to 'src/settings.h')
-rw-r--r--src/settings.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/settings.h b/src/settings.h
index a1d5bd0..cb707ef 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -28,6 +28,8 @@
#include <atomic>
#include <string>
+#include <limits>
+
#include <cassert>
#include "atomic.h"
@@ -47,6 +49,13 @@ struct Settings
Atomic<std::string> drumkit_file{""};
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};
+ Atomic<bool> disk_cache_enable{true};
+
Atomic<std::string> midimap_file{""};
Atomic<LoadStatus> midimap_load_status{LoadStatus::Idle};
@@ -72,6 +81,9 @@ struct SettingsGetter
SettingRef<std::string> drumkit_file;
SettingRef<LoadStatus> drumkit_load_status;
+ SettingRef<std::size_t> disk_cache_upper_limit;
+ SettingRef<bool> disk_cache_enable;
+
SettingRef<std::string> midimap_file;
SettingRef<LoadStatus> midimap_load_status;
@@ -93,6 +105,8 @@ struct SettingsGetter
SettingsGetter(Settings& settings)
: drumkit_file(settings.drumkit_file)
, drumkit_load_status(settings.drumkit_load_status)
+ , disk_cache_upper_limit(settings.disk_cache_upper_limit)
+ , disk_cache_enable(settings.disk_cache_enable)
, midimap_file(settings.midimap_file)
, midimap_load_status(settings.midimap_load_status)
, enable_velocity_modifier{settings.enable_velocity_modifier}
@@ -116,6 +130,9 @@ public:
Notifier<std::string> drumkit_file;
Notifier<LoadStatus> drumkit_load_status;
+ Notifier<std::size_t> disk_cache_upper_limit;
+ Notifier<bool> disk_cache_enable;
+
Notifier<std::string> midimap_file;
Notifier<LoadStatus> midimap_load_status;
@@ -141,6 +158,9 @@ public:
EVAL(drumkit_file);
EVAL(drumkit_load_status);
+ EVAL(disk_cache_upper_limit);
+ EVAL(disk_cache_enable);
+
EVAL(midimap_file);
EVAL(midimap_load_status);