summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-10-14 17:50:01 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-02-18 11:43:41 +0100
commit6a90e6c24f05c57cdbe19e5cc44c77c9e5810148 (patch)
treed90fab1ab3bc5aa421ca671990590f9ded391709
parent0dc69ba161bb0c8fce2eb0ab3c5eb897f7aa92a7 (diff)
Added plugin store/restore of latency filter settings, added the missing settings to the lv2 unittest and added the missing SettingsGetter and SettingsNotifier parts.
-rw-r--r--plugin/drumgizmo_plugin.cc35
-rw-r--r--src/settings.h23
-rw-r--r--test/lv2.cc102
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()) + "</value>\n"
" <value name=\"master_bleed\">" +
float2str(settings.master_bleed.load()) + "</value>\n"
+ " <value name=\"enable_latency_modifier\">" +
+ bool2str(settings.enable_latency_modifier.load()) + "</value>\n"
+ " <value name=\"latency_max\">" +
+ int2str(settings.latency_max.load()) + "</value>\n"
+ " <value name=\"latency_laid_back\">" +
+ int2str(settings.latency_laid_back.load()) + "</value>\n"
+ " <value name=\"latency_stddev\">" +
+ float2str(settings.latency_stddev.load()) + "</value>\n"
+ " <value name=\"latency_regain\">" +
+ float2str(settings.latency_regain.load()) + "</value>\n"
"</config>";
}
@@ -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<bool> enable_bleed_control;
SettingRef<float> master_bleed;
+ SettingRef<bool> enable_latency_modifier;
+ SettingRef<std::size_t> latency_max;
+ SettingRef<int> latency_laid_back;
+ SettingRef<float> latency_stddev;
+ SettingRef<float> 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<bool> enable_bleed_control;
Notifier<float> master_bleed;
+ Notifier<bool> enable_latency_modifier;
+ Notifier<std::size_t> latency_max;
+ Notifier<int> latency_laid_back;
+ Notifier<float> latency_stddev;
+ Notifier<float> 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:
" <value name=\"enable_velocity_randomiser\">%s</value>\n"
" <value name=\"velocity_randomiser_weight\">%f</value>\n"
" <value name=\"enable_resampling\">%s</value>\n"
+ " <value name=\"enable_resampling\">%s</value>\n"
+ " <value name=\"disk_cache_upper_limit\">%d</value>\n"
+ " <value name=\"disk_cache_chunk_size\">%d</value>\n"
+ " <value name=\"disk_cache_enable\">%s</value>\n"
+ " <value name=\"enable_bleed_control\">%s</value>\n"
+ " <value name=\"master_bleed\">%f</value>\n"
+ " <value name=\"enable_latency_modifier\">%s</value>\n"
+ " <value name=\"latency_max\">%d</value>\n"
+ " <value name=\"latency_laid_back\">%d</value>\n"
+ " <value name=\"latency_stddev\">%f</value>\n"
+ " <value name=\"latency_regain\">%f</value>\n"
"</config>";
// 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:
" <value name=\"enable_velocity_randomiser\">%s</value>\n"
" <value name=\"velocity_randomiser_weight\">%f</value>\n"
" <value name=\"enable_resampling\">%s</value>\n"
+ " <value name=\"enable_resampling\">%s</value>\n"
+ " <value name=\"disk_cache_upper_limit\">%d</value>\n"
+ " <value name=\"disk_cache_chunk_size\">%d</value>\n"
+ " <value name=\"disk_cache_enable\">%s</value>\n"
+ " <value name=\"enable_bleed_control\">%s</value>\n"
+ " <value name=\"master_bleed\">%f</value>\n"
+ " <value name=\"enable_latency_modifier\">%s</value>\n"
+ " <value name=\"latency_max\">%d</value>\n"
+ " <value name=\"latency_laid_back\">%d</value>\n"
+ " <value name=\"latency_stddev\">%f</value>\n"
+ " <value name=\"latency_regain\">%f</value>\n"
"</config>";
// 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:
" <value name=\"enable_velocity_randomiser\">%s</value>\n"
" <value name=\"velocity_randomiser_weight\">%f</value>\n"
" <value name=\"enable_resampling\">%s</value>\n"
+ " <value name=\"enable_resampling\">%s</value>\n"
+ " <value name=\"disk_cache_upper_limit\">%d</value>\n"
+ " <value name=\"disk_cache_chunk_size\">%d</value>\n"
+ " <value name=\"disk_cache_enable\">%s</value>\n"
+ " <value name=\"enable_bleed_control\">%s</value>\n"
+ " <value name=\"master_bleed\">%f</value>\n"
+ " <value name=\"enable_latency_modifier\">%s</value>\n"
+ " <value name=\"latency_max\">%d</value>\n"
+ " <value name=\"latency_laid_back\">%d</value>\n"
+ " <value name=\"latency_stddev\">%f</value>\n"
+ " <value name=\"latency_regain\">%f</value>\n"
"</config>";
// 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);