mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-13 20:09:59 +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:
@@ -59,6 +59,8 @@ struct WantsConfiguration {
|
||||
*/
|
||||
using ControlRequest = std::variant<Vst3PluginProxy::Construct,
|
||||
Vst3PluginProxy::Destruct,
|
||||
Vst3PluginProxy::SetState,
|
||||
Vst3PluginProxy::GetState,
|
||||
YaAudioProcessor::SetBusArrangements,
|
||||
YaAudioProcessor::GetBusArrangement,
|
||||
YaAudioProcessor::CanProcessSampleSize,
|
||||
@@ -73,8 +75,6 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
|
||||
YaComponent::GetRoutingInfo,
|
||||
YaComponent::ActivateBus,
|
||||
YaComponent::SetActive,
|
||||
YaComponent::SetState,
|
||||
YaComponent::GetState,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
|
||||
@@ -150,6 +150,58 @@ class Vst3PluginProxy : public YaAudioProcessor,
|
||||
|
||||
DECLARE_FUNKNOWN_METHODS
|
||||
|
||||
// We'll define messages for functions that have identical definitions in
|
||||
// multiple interfaces below. When the Wine plugin host process handles
|
||||
// these it should check which of the interfaces is supported on the host.
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `{IComponent,IEditController}::setState(state)` to the Wine plugin host.
|
||||
*/
|
||||
struct SetState {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
VectorStream state;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(state);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The response code and written state for a call to
|
||||
* `{IComponent,IEditController}::getState(state)`.
|
||||
*/
|
||||
struct GetStateResponse {
|
||||
UniversalTResult result;
|
||||
VectorStream updated_state;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(updated_state);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `{IComponent,IEditController}::getState(state)` to the Wine plugin host.
|
||||
*/
|
||||
struct GetState {
|
||||
using Response = GetStateResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
};
|
||||
|
||||
@@ -255,57 +255,12 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
||||
|
||||
virtual tresult PLUGIN_API setActive(TBool state) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IComponent::setState(state)` to the
|
||||
* Wine plugin host.
|
||||
*/
|
||||
struct SetState {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
VectorStream state;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(state);
|
||||
}
|
||||
};
|
||||
|
||||
// `setState()` and `getState()` are defiend in both `IComponent` and
|
||||
// `IEditController`. Since an object can only ever implement one or the
|
||||
// other, the messages for calling either are defined directly on
|
||||
// `Vst3PluginProxy`.
|
||||
virtual tresult PLUGIN_API
|
||||
setState(Steinberg::IBStream* state) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and written state for a call to
|
||||
* `IComponent::getState(state)`.
|
||||
*/
|
||||
struct GetStateResponse {
|
||||
UniversalTResult result;
|
||||
VectorStream updated_state;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(updated_state);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IComponent::getState(state)` to the
|
||||
* Wine plugin host.
|
||||
*/
|
||||
struct GetState {
|
||||
using Response = GetStateResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
getState(Steinberg::IBStream* state) override = 0;
|
||||
|
||||
|
||||
@@ -80,10 +80,16 @@ class YaEditController2 : public Steinberg::Vst::IEditController,
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setComponentState(Steinberg::IBStream* state) override = 0;
|
||||
|
||||
// `setState()` and `getState()` are defiend in both `IComponent` and
|
||||
// `IEditController`. Since an object can only ever implement one or the
|
||||
// other, the messages for calling either are defined directly on
|
||||
// `Vst3PluginProxy`.
|
||||
virtual tresult PLUGIN_API
|
||||
setState(Steinberg::IBStream* state) override = 0;
|
||||
virtual tresult PLUGIN_API
|
||||
getState(Steinberg::IBStream* state) override = 0;
|
||||
|
||||
virtual int32 PLUGIN_API getParameterCount() override = 0;
|
||||
virtual tresult PLUGIN_API
|
||||
getParameterInfo(int32 paramIndex,
|
||||
|
||||
Reference in New Issue
Block a user