Host: rework how we update params
@@ -708,6 +708,11 @@ void PluginHost::clapParamsAdjustBegin(const clap_host *host, clap_id param_id)
checkForMainThread();
auto h = fromHost(host);
+
+ if (h->isPluginActive())
+ throw std::logic_error("Plugin called clap_host_params.begin_adjust() but the plugin is "
+ "active, it should transmit the event via output param event");
+
auto &param = h->checkValidParamId("clap_host_params.touch_begin()", "param_id", param_id);
if (param.isBeingAdjusted()) {
@@ -725,6 +730,12 @@ void PluginHost::clapParamsAdjustEnd(const clap_host *host, clap_id param_id) {
checkForMainThread();
auto h = fromHost(host);
+
+ if (h->isPluginActive())
+ throw std::logic_error(
+ "Plugin called clap_host_params.end_adjust() but the plugin is active, it should "
+ "transmit the event via output param event");
+
auto &param = h->checkValidParamId("clap_host_params.touch_begin()", "param_id", param_id);
if (!param.isBeingAdjusted()) {
@@ -742,6 +753,12 @@ void PluginHost::clapParamsAdjust(const clap_host *host, clap_id param_id, clap_
checkForMainThread();
auto h = fromHost(host);
+
+ if (h->isPluginActive())
+ throw std::logic_error(
+ "Plugin called clap_host_params.adjust() but the plugin is active, it should transmit "
+ "the event via output param event");
+
auto &param = h->checkValidParamId("clap_host_params.touch_begin()", "param_id", param_id);
if (!param.isBeingAdjusted()) {
@@ -758,9 +775,7 @@ void PluginHost::clapParamsAdjust(const clap_host *host, clap_id param_id, clap_
return;
param.setValue(value);
- h->appToEngineQueue_.set(param_id, value);
h->pluginParams_->set_value(h->plugin_, param.info().id, value, value);
- h->appToEngineQueue_.producerDone();
}
void PluginHost::setParamValueByHost(PluginParam &param, clap_param_value value) {
@@ -768,13 +783,10 @@ void PluginHost::setParamValueByHost(PluginParam &param, clap_param_value value)
param.setValue(value);
- if (isPluginActive())
- {
+ if (isPluginActive()) {
appToEngineQueue_.set(param.info().id, value);
appToEngineQueue_.producerDone();
- }
- else
- {
+ } else {
pluginParams_->set_value(plugin_, param.info().id, value, value);
}
}
