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