Skip to content

Commit

Permalink
Rewrite applyConfiguration check
Browse files Browse the repository at this point in the history
  • Loading branch information
Schroedingers-Cat committed Jun 17, 2024
1 parent fe1d73c commit cccc104
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions include/clap/helpers/plugin.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -826,20 +826,24 @@ namespace clap { namespace helpers {
auto methodName = "clap_plugin_configurable_audio_ports.apply_configuration";
self.ensureMainThread(methodName);
self.ensureIsInactive(methodName);
if (l >= CheckingLevel::Minimal &&
!self.configurableAudioPortsCanApplyConfiguration(requests, request_count)) {
self.hostMisbehaving(
"Host requested a configuration that the plugin did not accept. Check with "
"clap_plugin_configurable_audio_ports.can_apply_configuration before applying a "
"configuration!");
}

return self.configurableAudioPortsApplyConfiguration(requests, request_count);
}

bool canApplyConfiguration;
if (l >= CheckingLevel::Minimal) {
canApplyConfiguration =
self.configurableAudioPortsCanApplyConfiguration(requests, request_count);
}

bool applyConfigurationSuccess =
self.configurableAudioPortsApplyConfiguration(requests, request_count);

if (l >= CheckingLevel::Minimal && canApplyConfiguration != applyConfigurationSuccess) {
self._host.pluginMisbehaving(
"Plugin's functions clap_plugin_configurable_audio_ports.can_apply_configuration and "
"clap_plugin_configurable_audio_ports.apply_configuration returned different values "
"for the same configuration.");
}

return applyConfigurationSuccess;
}

//--------------------//
Expand Down

0 comments on commit cccc104

Please sign in to comment.