mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-10 14:22:16 +02:00
Rename the monolitic class to Vst3PluginProxy
Now it's starting to look promising.
This commit is contained in:
@@ -1,95 +1 @@
|
||||
// yabridge: a Wine VST bridge
|
||||
// Copyright (C) 2020 Robbert van der Helm
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pluginterfaces/vst/ivsthostapplication.h>
|
||||
|
||||
#include "../vst3.h"
|
||||
|
||||
class YaPluginMonolithImpl : public YaPluginMonolith {
|
||||
public:
|
||||
YaPluginMonolithImpl(Vst3PluginBridge& bridge,
|
||||
YaPluginMonolith::ConstructArgs&& args);
|
||||
|
||||
/**
|
||||
* When the reference count reaches zero and this destructor is called,
|
||||
* we'll send a request to the Wine plugin host to destroy the corresponding
|
||||
* object.
|
||||
*/
|
||||
~YaPluginMonolithImpl();
|
||||
|
||||
/**
|
||||
* We'll override the query interface to log queries for interfaces we do
|
||||
* not (yet) support.
|
||||
*/
|
||||
tresult PLUGIN_API queryInterface(const Steinberg::TUID _iid,
|
||||
void** obj) override;
|
||||
|
||||
// From `IAudioProcessor`
|
||||
tresult PLUGIN_API
|
||||
setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs,
|
||||
int32 numIns,
|
||||
Steinberg::Vst::SpeakerArrangement* outputs,
|
||||
int32 numOuts) override;
|
||||
tresult PLUGIN_API
|
||||
getBusArrangement(Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::SpeakerArrangement& arr) override;
|
||||
tresult PLUGIN_API canProcessSampleSize(int32 symbolicSampleSize) override;
|
||||
uint32 PLUGIN_API getLatencySamples() override;
|
||||
tresult PLUGIN_API
|
||||
setupProcessing(Steinberg::Vst::ProcessSetup& setup) override;
|
||||
tresult PLUGIN_API setProcessing(TBool state) override;
|
||||
tresult PLUGIN_API process(Steinberg::Vst::ProcessData& data) override;
|
||||
uint32 PLUGIN_API getTailSamples() override;
|
||||
|
||||
// From `IComponent`
|
||||
tresult PLUGIN_API setIoMode(Steinberg::Vst::IoMode mode) override;
|
||||
int32 PLUGIN_API getBusCount(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir) override;
|
||||
tresult PLUGIN_API
|
||||
getBusInfo(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::BusInfo& bus /*out*/) override;
|
||||
tresult PLUGIN_API
|
||||
getRoutingInfo(Steinberg::Vst::RoutingInfo& inInfo,
|
||||
Steinberg::Vst::RoutingInfo& outInfo /*out*/) override;
|
||||
tresult PLUGIN_API activateBus(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
TBool state) override;
|
||||
tresult PLUGIN_API setActive(TBool state) override;
|
||||
tresult PLUGIN_API setState(Steinberg::IBStream* state) override;
|
||||
tresult PLUGIN_API getState(Steinberg::IBStream* state) override;
|
||||
|
||||
// From `IPluginBase`
|
||||
tresult PLUGIN_API initialize(FUnknown* context) override;
|
||||
tresult PLUGIN_API terminate() override;
|
||||
|
||||
private:
|
||||
Vst3PluginBridge& bridge;
|
||||
|
||||
/**
|
||||
* An `IHostApplication` instance if we get one through
|
||||
* `IPluginBase::initialize()`. This should be the same for all plugin
|
||||
* instances so we should not have to store it here separately, but for the
|
||||
* sake of correctness we will.
|
||||
*/
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication>
|
||||
host_application_context;
|
||||
};
|
||||
YaPluginProxyImplYaPluginProxyImplYaPluginProxyImpl
|
||||
|
||||
@@ -18,17 +18,16 @@
|
||||
|
||||
#include <pluginterfaces/vst/ivstcomponent.h>
|
||||
|
||||
#include "component.h"
|
||||
#include "plugin-proxy.h"
|
||||
|
||||
YaPluginFactoryPluginImpl::YaPluginFactoryPluginImpl(
|
||||
Vst3PluginBridge& bridge,
|
||||
YaPluginFactory::ConstructArgs&& args)
|
||||
YaPluginFactoryImpl::YaPluginFactoryImpl(Vst3PluginBridge& bridge,
|
||||
YaPluginFactory::ConstructArgs&& args)
|
||||
: YaPluginFactory(std::move(args)), bridge(bridge) {}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
|
||||
Steinberg::FIDString _iid,
|
||||
void** obj) {
|
||||
YaPluginFactoryImpl::createInstance(Steinberg::FIDString cid,
|
||||
Steinberg::FIDString _iid,
|
||||
void** obj) {
|
||||
// TODO: Do the same thing for other types
|
||||
|
||||
// These arw pointers are scary. The idea here is that we return a newly
|
||||
@@ -38,13 +37,13 @@ YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
|
||||
ArrayUID cid_array;
|
||||
std::copy(cid, cid + sizeof(Steinberg::TUID), cid_array.begin());
|
||||
if (Steinberg::FIDStringsEqual(_iid, Steinberg::Vst::IComponent::iid)) {
|
||||
std::variant<YaPluginMonolith::ConstructArgs, UniversalTResult> result =
|
||||
bridge.send_message(YaPluginMonolith::Construct{.cid = cid_array});
|
||||
std::variant<Vst3PluginProxy::ConstructArgs, UniversalTResult> result =
|
||||
bridge.send_message(Vst3PluginProxy::Construct{.cid = cid_array});
|
||||
return std::visit(
|
||||
overload{
|
||||
[&](YaPluginMonolith::ConstructArgs&& args) -> tresult {
|
||||
[&](Vst3PluginProxy::ConstructArgs&& args) -> tresult {
|
||||
*obj = static_cast<Steinberg::Vst::IComponent*>(
|
||||
new YaPluginMonolithImpl(bridge, std::move(args)));
|
||||
new Vst3PluginProxyImpl(bridge, std::move(args)));
|
||||
return Steinberg::kResultOk;
|
||||
},
|
||||
[&](const UniversalTResult& code) -> tresult { return code; }},
|
||||
@@ -69,7 +68,7 @@ YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactoryPluginImpl::setHostContext(Steinberg::FUnknown* context) {
|
||||
YaPluginFactoryImpl::setHostContext(Steinberg::FUnknown* context) {
|
||||
// This `context` will likely be an `IHostApplication`. If it is, we will
|
||||
// store it for future calls, create a proxy object on the Wine side, and
|
||||
// then pass it to the Windows VST3 plugin's plugin factory using the same
|
||||
|
||||
@@ -18,11 +18,10 @@
|
||||
|
||||
#include "../vst3.h"
|
||||
|
||||
// TODO Rename to YaPluginFactoryImpl
|
||||
class YaPluginFactoryPluginImpl : public YaPluginFactory {
|
||||
class YaPluginFactoryImpl : public YaPluginFactory {
|
||||
public:
|
||||
YaPluginFactoryPluginImpl(Vst3PluginBridge& bridge,
|
||||
YaPluginFactory::ConstructArgs&& args);
|
||||
YaPluginFactoryImpl(Vst3PluginBridge& bridge,
|
||||
YaPluginFactory::ConstructArgs&& args);
|
||||
|
||||
tresult PLUGIN_API createInstance(Steinberg::FIDString cid,
|
||||
Steinberg::FIDString _iid,
|
||||
|
||||
+33
-35
@@ -14,25 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "component.h"
|
||||
#include "plugin-proxy.h"
|
||||
|
||||
YaPluginMonolithImpl::YaPluginMonolithImpl(
|
||||
Vst3PluginBridge& bridge,
|
||||
YaPluginMonolith::ConstructArgs&& args)
|
||||
: YaPluginMonolith(std::move(args)), bridge(bridge) {
|
||||
Vst3PluginProxyImpl::Vst3PluginProxyImpl(Vst3PluginBridge& bridge,
|
||||
Vst3PluginProxy::ConstructArgs&& args)
|
||||
: Vst3PluginProxy(std::move(args)), bridge(bridge) {
|
||||
bridge.register_component(arguments.instance_id, *this);
|
||||
}
|
||||
|
||||
YaPluginMonolithImpl::~YaPluginMonolithImpl() {
|
||||
Vst3PluginProxyImpl::~Vst3PluginProxyImpl() {
|
||||
bridge.send_message(
|
||||
YaPluginMonolith::Destruct{.instance_id = arguments.instance_id});
|
||||
Vst3PluginProxy::Destruct{.instance_id = arguments.instance_id});
|
||||
bridge.unregister_component(arguments.instance_id);
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::queryInterface(const Steinberg::TUID _iid, void** obj) {
|
||||
Vst3PluginProxyImpl::queryInterface(const Steinberg::TUID _iid, void** obj) {
|
||||
// TODO: Successful queries should also be logged
|
||||
const tresult result = YaPluginMonolith::queryInterface(_iid, obj);
|
||||
const tresult result = Vst3PluginProxy::queryInterface(_iid, obj);
|
||||
if (result != Steinberg::kResultOk) {
|
||||
bridge.logger.log_unknown_interface("In IComponent::queryInterface()",
|
||||
Steinberg::FUID::fromTUID(_iid));
|
||||
@@ -41,7 +40,7 @@ YaPluginMonolithImpl::queryInterface(const Steinberg::TUID _iid, void** obj) {
|
||||
return result;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::setBusArrangements(
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::setBusArrangements(
|
||||
Steinberg::Vst::SpeakerArrangement* inputs,
|
||||
int32 numIns,
|
||||
Steinberg::Vst::SpeakerArrangement* outputs,
|
||||
@@ -58,7 +57,7 @@ tresult PLUGIN_API YaPluginMonolithImpl::setBusArrangements(
|
||||
});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::getBusArrangement(
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::getBusArrangement(
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::SpeakerArrangement& arr) {
|
||||
@@ -75,30 +74,30 @@ tresult PLUGIN_API YaPluginMonolithImpl::getBusArrangement(
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::canProcessSampleSize(int32 symbolicSampleSize) {
|
||||
Vst3PluginProxyImpl::canProcessSampleSize(int32 symbolicSampleSize) {
|
||||
return bridge.send_message(YaAudioProcessor::CanProcessSampleSize{
|
||||
.instance_id = arguments.instance_id,
|
||||
.symbolic_sample_size = symbolicSampleSize});
|
||||
}
|
||||
|
||||
uint32 PLUGIN_API YaPluginMonolithImpl::getLatencySamples() {
|
||||
uint32 PLUGIN_API Vst3PluginProxyImpl::getLatencySamples() {
|
||||
return bridge.send_message(YaAudioProcessor::GetLatencySamples{
|
||||
.instance_id = arguments.instance_id});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::setupProcessing(Steinberg::Vst::ProcessSetup& setup) {
|
||||
Vst3PluginProxyImpl::setupProcessing(Steinberg::Vst::ProcessSetup& setup) {
|
||||
return bridge.send_message(YaAudioProcessor::SetupProcessing{
|
||||
.instance_id = arguments.instance_id, .setup = setup});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::setProcessing(TBool state) {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::setProcessing(TBool state) {
|
||||
return bridge.send_message(YaAudioProcessor::SetProcessing{
|
||||
.instance_id = arguments.instance_id, .state = state});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::process(Steinberg::Vst::ProcessData& data) {
|
||||
Vst3PluginProxyImpl::process(Steinberg::Vst::ProcessData& data) {
|
||||
ProcessResponse response = bridge.send_message(YaAudioProcessor::Process{
|
||||
.instance_id = arguments.instance_id, .data = data});
|
||||
|
||||
@@ -107,29 +106,28 @@ YaPluginMonolithImpl::process(Steinberg::Vst::ProcessData& data) {
|
||||
return response.result;
|
||||
}
|
||||
|
||||
uint32 PLUGIN_API YaPluginMonolithImpl::getTailSamples() {
|
||||
uint32 PLUGIN_API Vst3PluginProxyImpl::getTailSamples() {
|
||||
return bridge.send_message(
|
||||
YaAudioProcessor::GetTailSamples{.instance_id = arguments.instance_id});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::setIoMode(Steinberg::Vst::IoMode mode) {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::setIoMode(Steinberg::Vst::IoMode mode) {
|
||||
return bridge.send_message(YaComponent::SetIoMode{
|
||||
.instance_id = arguments.instance_id, .mode = mode});
|
||||
}
|
||||
|
||||
int32 PLUGIN_API
|
||||
YaPluginMonolithImpl::getBusCount(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir) {
|
||||
Vst3PluginProxyImpl::getBusCount(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir) {
|
||||
return bridge.send_message(YaComponent::GetBusCount{
|
||||
.instance_id = arguments.instance_id, .type = type, .dir = dir});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::getBusInfo(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::BusInfo& bus /*out*/) {
|
||||
Vst3PluginProxyImpl::getBusInfo(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::BusInfo& bus /*out*/) {
|
||||
const GetBusInfoResponse response = bridge.send_message(
|
||||
YaComponent::GetBusInfo{.instance_id = arguments.instance_id,
|
||||
.type = type,
|
||||
@@ -141,7 +139,7 @@ YaPluginMonolithImpl::getBusInfo(Steinberg::Vst::MediaType type,
|
||||
return response.result;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::getRoutingInfo(
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::getRoutingInfo(
|
||||
Steinberg::Vst::RoutingInfo& inInfo,
|
||||
Steinberg::Vst::RoutingInfo& outInfo /*out*/) {
|
||||
const GetRoutingInfoResponse response = bridge.send_message(
|
||||
@@ -155,10 +153,10 @@ tresult PLUGIN_API YaPluginMonolithImpl::getRoutingInfo(
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginMonolithImpl::activateBus(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
TBool state) {
|
||||
Vst3PluginProxyImpl::activateBus(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
TBool state) {
|
||||
return bridge.send_message(
|
||||
YaComponent::ActivateBus{.instance_id = arguments.instance_id,
|
||||
.type = type,
|
||||
@@ -167,17 +165,17 @@ YaPluginMonolithImpl::activateBus(Steinberg::Vst::MediaType type,
|
||||
.state = state});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::setActive(TBool state) {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::setActive(TBool state) {
|
||||
return bridge.send_message(YaComponent::SetActive{
|
||||
.instance_id = arguments.instance_id, .state = state});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::setState(Steinberg::IBStream* state) {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::setState(Steinberg::IBStream* state) {
|
||||
return bridge.send_message(YaComponent::SetState{
|
||||
.instance_id = arguments.instance_id, .state = state});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::getState(Steinberg::IBStream* state) {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::getState(Steinberg::IBStream* state) {
|
||||
const GetStateResponse response = bridge.send_message(
|
||||
YaComponent::GetState{.instance_id = arguments.instance_id});
|
||||
|
||||
@@ -186,7 +184,7 @@ tresult PLUGIN_API YaPluginMonolithImpl::getState(Steinberg::IBStream* state) {
|
||||
return response.result;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::initialize(FUnknown* context) {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::initialize(FUnknown* context) {
|
||||
// This `context` will likely be an `IHostApplication`. If it is, we will
|
||||
// store it here, and we'll proxy through all calls to it made from the Wine
|
||||
// side. Otherwise we'll still call `IPluginBase::initialize()` but with a
|
||||
@@ -210,7 +208,7 @@ tresult PLUGIN_API YaPluginMonolithImpl::initialize(FUnknown* context) {
|
||||
std::move(host_application_context_args)});
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginMonolithImpl::terminate() {
|
||||
tresult PLUGIN_API Vst3PluginProxyImpl::terminate() {
|
||||
return bridge.send_message(
|
||||
YaPluginBase::Terminate{.instance_id = arguments.instance_id});
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// yabridge: a Wine VST bridge
|
||||
// Copyright (C) 2020 Robbert van der Helm
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pluginterfaces/vst/ivsthostapplication.h>
|
||||
|
||||
#include "../vst3.h"
|
||||
|
||||
class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
public:
|
||||
Vst3PluginProxyImpl(Vst3PluginBridge& bridge,
|
||||
Vst3PluginProxy::ConstructArgs&& args);
|
||||
|
||||
/**
|
||||
* When the reference count reaches zero and this destructor is called,
|
||||
* we'll send a request to the Wine plugin host to destroy the corresponding
|
||||
* object.
|
||||
*/
|
||||
~Vst3PluginProxyImpl();
|
||||
|
||||
/**
|
||||
* We'll override the query interface to log queries for interfaces we do
|
||||
* not (yet) support.
|
||||
*/
|
||||
tresult PLUGIN_API queryInterface(const Steinberg::TUID _iid,
|
||||
void** obj) override;
|
||||
|
||||
// From `IAudioProcessor`
|
||||
tresult PLUGIN_API
|
||||
setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs,
|
||||
int32 numIns,
|
||||
Steinberg::Vst::SpeakerArrangement* outputs,
|
||||
int32 numOuts) override;
|
||||
tresult PLUGIN_API
|
||||
getBusArrangement(Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::SpeakerArrangement& arr) override;
|
||||
tresult PLUGIN_API canProcessSampleSize(int32 symbolicSampleSize) override;
|
||||
uint32 PLUGIN_API getLatencySamples() override;
|
||||
tresult PLUGIN_API
|
||||
setupProcessing(Steinberg::Vst::ProcessSetup& setup) override;
|
||||
tresult PLUGIN_API setProcessing(TBool state) override;
|
||||
tresult PLUGIN_API process(Steinberg::Vst::ProcessData& data) override;
|
||||
uint32 PLUGIN_API getTailSamples() override;
|
||||
|
||||
// From `IComponent`
|
||||
tresult PLUGIN_API setIoMode(Steinberg::Vst::IoMode mode) override;
|
||||
int32 PLUGIN_API getBusCount(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir) override;
|
||||
tresult PLUGIN_API
|
||||
getBusInfo(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::BusInfo& bus /*out*/) override;
|
||||
tresult PLUGIN_API
|
||||
getRoutingInfo(Steinberg::Vst::RoutingInfo& inInfo,
|
||||
Steinberg::Vst::RoutingInfo& outInfo /*out*/) override;
|
||||
tresult PLUGIN_API activateBus(Steinberg::Vst::MediaType type,
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
TBool state) override;
|
||||
tresult PLUGIN_API setActive(TBool state) override;
|
||||
tresult PLUGIN_API setState(Steinberg::IBStream* state) override;
|
||||
tresult PLUGIN_API getState(Steinberg::IBStream* state) override;
|
||||
|
||||
// From `IPluginBase`
|
||||
tresult PLUGIN_API initialize(FUnknown* context) override;
|
||||
tresult PLUGIN_API terminate() override;
|
||||
|
||||
private:
|
||||
Vst3PluginBridge& bridge;
|
||||
|
||||
/**
|
||||
* An `IHostApplication` instance if we get one through
|
||||
* `IPluginBase::initialize()`. This should be the same for all plugin
|
||||
* instances so we should not have to store it here separately, but for the
|
||||
* sake of correctness we will.
|
||||
*/
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication>
|
||||
host_application_context;
|
||||
};
|
||||
@@ -108,17 +108,17 @@ Steinberg::IPluginFactory* Vst3PluginBridge::get_plugin_factory() {
|
||||
YaPluginFactory::Construct{},
|
||||
std::pair<Vst3Logger&, bool>(logger, true));
|
||||
plugin_factory =
|
||||
new YaPluginFactoryPluginImpl(*this, std::move(factory_args));
|
||||
new YaPluginFactoryImpl(*this, std::move(factory_args));
|
||||
}
|
||||
|
||||
return plugin_factory;
|
||||
}
|
||||
|
||||
void Vst3PluginBridge::register_component(size_t instance_id,
|
||||
YaPluginMonolithImpl& component) {
|
||||
Vst3PluginProxyImpl& component) {
|
||||
std::lock_guard lock(component_instances_mutex);
|
||||
component_instances.emplace(instance_id,
|
||||
std::ref<YaPluginMonolithImpl>(component));
|
||||
std::ref<Vst3PluginProxyImpl>(component));
|
||||
}
|
||||
|
||||
void Vst3PluginBridge::unregister_component(size_t instance_id) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "common.h"
|
||||
|
||||
// Forward declaration
|
||||
class YaPluginMonolithImpl;
|
||||
class Vst3PluginProxyImpl;
|
||||
|
||||
/**
|
||||
* This handles the communication between the native host and a VST3 plugin
|
||||
@@ -86,8 +86,7 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
*
|
||||
* TODO: REname to `register_instance` or `register_object`
|
||||
*/
|
||||
void register_component(size_t instance_id,
|
||||
YaPluginMonolithImpl& component);
|
||||
void register_component(size_t instance_id, Vst3PluginProxyImpl& component);
|
||||
|
||||
/**
|
||||
* Remove a previously registered `YaComponentPluginImpl` from the list of
|
||||
@@ -151,7 +150,7 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
* `register_component()` in the constractor, and an instance is then
|
||||
* removed through a call to `unregister_component()` in the destructor.
|
||||
*/
|
||||
std::map<size_t, std::reference_wrapper<YaPluginMonolithImpl>>
|
||||
std::map<size_t, std::reference_wrapper<Vst3PluginProxyImpl>>
|
||||
component_instances;
|
||||
std::mutex component_instances_mutex;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user