Unify handling for *::{get,set}State

Since these functions are exactly the same, and for whatever reason they
didn't just add them to the `IPluginBase` both `IComponent` and
`IEditController`. inherit from
This commit is contained in:
Robbert van der Helm
2020-12-17 17:52:51 +01:00
parent d8694b062b
commit fe2de8de8d
9 changed files with 136 additions and 108 deletions
@@ -171,22 +171,23 @@ tresult PLUGIN_API Vst3PluginProxyImpl::setActive(TBool state) {
}
tresult PLUGIN_API Vst3PluginProxyImpl::setState(Steinberg::IBStream* state) {
return bridge.send_message(YaComponent::SetState{
// Since both interfaces contain this function, this is used for both
// `IComponent::setState()` as well as `IEditController::setState()`
return bridge.send_message(Vst3PluginProxy::SetState{
.instance_id = arguments.instance_id, .state = state});
}
tresult PLUGIN_API Vst3PluginProxyImpl::getState(Steinberg::IBStream* state) {
// Since both interfaces contain this function, this is used for both
// `IComponent::getState()` as well as `IEditController::getState()`
const GetStateResponse response = bridge.send_message(
YaComponent::GetState{.instance_id = arguments.instance_id});
Vst3PluginProxy::GetState{.instance_id = arguments.instance_id});
assert(response.updated_state.write_back(state) == Steinberg::kResultOk);
return response.result;
}
// FIXME: Fix `{set,get}State()` for `IEditController` as mentioned in the
// header
tresult PLUGIN_API
Vst3PluginProxyImpl::setComponentState(Steinberg::IBStream* state) {
// TODO: Implement
+3 -6
View File
@@ -81,12 +81,9 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
// From `IEditController`
tresult PLUGIN_API setComponentState(Steinberg::IBStream* state) override;
// FIXME: These are duplicate, we need to change the implementation to call
// this on either `object_instances[instance_id].component` or
// `object_instances[instance_id].edit_controller` depending on which
// one exists.
// tresult PLUGIN_API setState(Steinberg::IBStream* state) override;
// tresult PLUGIN_API getState(Steinberg::IBStream* state) override;
// `IEditController` also contains `getState()` and `setState()` functions.
// These are identical to those defiend in `IComponent` and they're thus
// handled in in the same function.
int32 PLUGIN_API getParameterCount() override;
tresult PLUGIN_API
getParameterInfo(int32 paramIndex,