From 6a90e6c24f05c57cdbe19e5cc44c77c9e5810148 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 14 Oct 2017 17:50:01 +0200 Subject: Added plugin store/restore of latency filter settings, added the missing settings to the lv2 unittest and added the missing SettingsGetter and SettingsNotifier parts. --- plugin/drumgizmo_plugin.cc | 35 ++++++++++++++++ src/settings.h | 23 ++++++++++ test/lv2.cc | 102 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 157 insertions(+), 3 deletions(-) diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index c8d8392..90db744 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -571,6 +571,16 @@ std::string DrumGizmoPlugin::ConfigStringIO::get() bool2str(settings.enable_bleed_control.load()) + "\n" " " + float2str(settings.master_bleed.load()) + "\n" + " " + + bool2str(settings.enable_latency_modifier.load()) + "\n" + " " + + int2str(settings.latency_max.load()) + "\n" + " " + + int2str(settings.latency_laid_back.load()) + "\n" + " " + + float2str(settings.latency_stddev.load()) + "\n" + " " + + float2str(settings.latency_regain.load()) + "\n" ""; } @@ -645,6 +655,31 @@ bool DrumGizmoPlugin::ConfigStringIO::set(std::string config_string) settings.master_bleed.store(str2float(p.value("master_bleed"))); } + if(p.value("enable_latency_modifier") != "") + { + settings.enable_latency_modifier.store(p.value("enable_latency_modifier") == "true"); + } + + if(p.value("latency_max") != "") + { + settings.latency_max.store(str2int(p.value("latency_max"))); + } + + if(p.value("latency_laid_back") != "") + { + settings.latency_laid_back.store(str2int(p.value("latency_laid_back"))); + } + + if(p.value("latency_stddev") != "") + { + settings.latency_stddev.store(str2float(p.value("latency_stddev"))); + } + + if(p.value("latency_regain") != "") + { + settings.latency_regain.store(str2float(p.value("latency_regain"))); + } + std::string newkit = p.value("drumkitfile"); if(newkit != "") { diff --git a/src/settings.h b/src/settings.h index cdce066..b2fe3bb 100644 --- a/src/settings.h +++ b/src/settings.h @@ -155,6 +155,12 @@ struct SettingsGetter SettingRef enable_bleed_control; SettingRef master_bleed; + SettingRef enable_latency_modifier; + SettingRef latency_max; + SettingRef latency_laid_back; + SettingRef latency_stddev; + SettingRef latency_regain; + SettingsGetter(Settings& settings) : drumkit_file(settings.drumkit_file) , drumkit_load_status(settings.drumkit_load_status) @@ -184,6 +190,11 @@ struct SettingsGetter , current_file{settings.current_file} , enable_bleed_control{settings.enable_bleed_control} , master_bleed{settings.master_bleed} + , enable_latency_modifier{settings.enable_latency_modifier} + , latency_max{settings.latency_max} + , latency_laid_back{settings.latency_laid_back} + , latency_stddev{settings.latency_stddev} + , latency_regain{settings.latency_regain} { } }; @@ -229,6 +240,12 @@ public: Notifier enable_bleed_control; Notifier master_bleed; + Notifier enable_latency_modifier; + Notifier latency_max; + Notifier latency_laid_back; + Notifier latency_stddev; + Notifier latency_regain; + void evaluate() { #define EVAL(x) if(settings.x.hasChanged()) { x(settings.x.getValue()); } @@ -269,6 +286,12 @@ public: EVAL(enable_bleed_control); EVAL(master_bleed); + + EVAL(enable_latency_modifier); + EVAL(latency_max); + EVAL(latency_laid_back); + EVAL(latency_stddev); + EVAL(latency_regain); } SettingsNotifier(Settings& settings) diff --git a/test/lv2.cc b/test/lv2.cc index 4fd197e..a386b7d 100644 --- a/test/lv2.cc +++ b/test/lv2.cc @@ -110,6 +110,17 @@ public: " %s\n" " %f\n" " %s\n" + " %s\n" + " %d\n" + " %d\n" + " %s\n" + " %s\n" + " %f\n" + " %s\n" + " %d\n" + " %d\n" + " %f\n" + " %f\n" ""; // Create drumkit @@ -122,6 +133,16 @@ public: bool enable_velocity_randomiser = false; float velocity_randomiser_weight = 0.1; bool enable_resampling = false; + int disk_cache_upper_limit = 1024 * 1024; + int disk_cache_chunk_size = 1024 * 1024 * 1024; + bool disk_cache_enable = true; + bool enable_bleed_control = false; + float master_bleed = 1.0f; + bool enable_latency_modifier = false; + int latency_max = 0u; + int latency_laid_back = 0u; + float latency_stddev = 100.0f; + float latency_regain = 0.9f; char config[sizeof(config_fmt) * 2]; sprintf(config, config_fmt, @@ -132,7 +153,18 @@ public: velocity_modifier_weight, enable_velocity_randomiser?"true":"false", velocity_randomiser_weight, - enable_resampling?"true":"false"); + enable_resampling?"true":"false", + enable_resampling?"true":"false", + disk_cache_upper_limit, + disk_cache_chunk_size, + disk_cache_enable?"true":"false", + enable_bleed_control?"true":"false", + master_bleed, + enable_latency_modifier?"true":"false", + latency_max, + latency_laid_back, + latency_stddev, + latency_regain); res = h.loadConfig(config, strlen(config)); CPPUNIT_ASSERT_EQUAL(0, res); @@ -177,6 +209,17 @@ public: " %s\n" " %f\n" " %s\n" + " %s\n" + " %d\n" + " %d\n" + " %s\n" + " %s\n" + " %f\n" + " %s\n" + " %d\n" + " %d\n" + " %f\n" + " %f\n" ""; // Create drumkit @@ -189,6 +232,16 @@ public: bool enable_velocity_randomiser = false; float velocity_randomiser_weight = 0.1; bool enable_resampling = false; + int disk_cache_upper_limit = 1024 * 1024; + int disk_cache_chunk_size = 1024 * 1024 * 1024; + bool disk_cache_enable = true; + bool enable_bleed_control = false; + float master_bleed = 1.0f; + bool enable_latency_modifier = false; + int latency_max = 0u; + int latency_laid_back = 0u; + float latency_stddev = 100.0f; + float latency_regain = 0.9f; char config[sizeof(config_fmt) * 2]; sprintf(config, config_fmt, @@ -199,7 +252,18 @@ public: velocity_modifier_weight, enable_velocity_randomiser?"true":"false", velocity_randomiser_weight, - enable_resampling?"true":"false"); + enable_resampling?"true":"false", + enable_resampling?"true":"false", + disk_cache_upper_limit, + disk_cache_chunk_size, + disk_cache_enable?"true":"false", + enable_bleed_control?"true":"false", + master_bleed, + enable_latency_modifier?"true":"false", + latency_max, + latency_laid_back, + latency_stddev, + latency_regain); res = h.loadConfig(config, strlen(config)); CPPUNIT_ASSERT_EQUAL(0, res); @@ -256,6 +320,17 @@ public: " %s\n" " %f\n" " %s\n" + " %s\n" + " %d\n" + " %d\n" + " %s\n" + " %s\n" + " %f\n" + " %s\n" + " %d\n" + " %d\n" + " %f\n" + " %f\n" ""; // Create drumkit @@ -268,6 +343,16 @@ public: bool enable_velocity_randomiser = false; float velocity_randomiser_weight = 0.1; bool enable_resampling = false; + int disk_cache_upper_limit = 1024 * 1024; + int disk_cache_chunk_size = 1024 * 1024 * 1024; + bool disk_cache_enable = true; + bool enable_bleed_control = false; + float master_bleed = 1.0f; + bool enable_latency_modifier = false; + int latency_max = 0u; + int latency_laid_back = 0u; + float latency_stddev = 100.0f; + float latency_regain = 0.9f; char config[sizeof(config_fmt) * 2]; sprintf(config, config_fmt, @@ -278,7 +363,18 @@ public: velocity_modifier_weight, enable_velocity_randomiser?"true":"false", velocity_randomiser_weight, - enable_resampling?"true":"false"); + enable_resampling?"true":"false", + enable_resampling?"true":"false", + disk_cache_upper_limit, + disk_cache_chunk_size, + disk_cache_enable?"true":"false", + enable_bleed_control?"true":"false", + master_bleed, + enable_latency_modifier?"true":"false", + latency_max, + latency_laid_back, + latency_stddev, + latency_regain); res = h.loadConfig(config, strlen(config)); CPPUNIT_ASSERT_EQUAL(0, res); -- cgit v1.2.3