mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 05:33:07 +02:00
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:
@@ -106,6 +106,36 @@ void Vst3Bridge::run() {
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](Vst3PluginProxy::SetState& request)
|
||||
-> Vst3PluginProxy::SetState::Response {
|
||||
// This same function is defined in both `IComponent` and
|
||||
// `IEditController`, so the host is calling one or the other
|
||||
if (object_instances[request.instance_id].component) {
|
||||
return object_instances[request.instance_id]
|
||||
.component->setState(&request.state);
|
||||
} else {
|
||||
return object_instances[request.instance_id]
|
||||
.edit_controller->setState(&request.state);
|
||||
}
|
||||
},
|
||||
[&](Vst3PluginProxy::GetState& request)
|
||||
-> Vst3PluginProxy::GetState::Response {
|
||||
VectorStream stream;
|
||||
tresult result;
|
||||
|
||||
// This same function is defined in both `IComponent` and
|
||||
// `IEditController`, so the host is calling one or the other
|
||||
if (object_instances[request.instance_id].component) {
|
||||
result = object_instances[request.instance_id]
|
||||
.component->getState(&stream);
|
||||
} else {
|
||||
result = object_instances[request.instance_id]
|
||||
.edit_controller->getState(&stream);
|
||||
}
|
||||
|
||||
return Vst3PluginProxy::GetStateResponse{
|
||||
.result = result, .updated_state = std::move(stream)};
|
||||
},
|
||||
[&](YaAudioProcessor::SetBusArrangements& request)
|
||||
-> YaAudioProcessor::SetBusArrangements::Response {
|
||||
return object_instances[request.instance_id]
|
||||
@@ -201,21 +231,6 @@ void Vst3Bridge::run() {
|
||||
return object_instances[request.instance_id]
|
||||
.component->setActive(request.state);
|
||||
},
|
||||
[&](YaComponent::SetState& request)
|
||||
-> YaComponent::SetState::Response {
|
||||
return object_instances[request.instance_id]
|
||||
.component->setState(&request.state);
|
||||
},
|
||||
[&](YaComponent::GetState& request)
|
||||
-> YaComponent::GetState::Response {
|
||||
VectorStream stream;
|
||||
const tresult result =
|
||||
object_instances[request.instance_id].component->getState(
|
||||
&stream);
|
||||
|
||||
return YaComponent::GetStateResponse{
|
||||
.result = result, .updated_state = std::move(stream)};
|
||||
},
|
||||
[&](YaPluginBase::Initialize& request)
|
||||
-> YaPluginBase::Initialize::Response {
|
||||
// If we got passed a host context, we'll create a proxy object
|
||||
|
||||
Reference in New Issue
Block a user