mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Implement IComponent::terminate()
This commit is contained in:
@@ -38,6 +38,13 @@ void Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::Terminate& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IComponent* #" << request.instance_id << ">::terminate()";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst, const WantsConfiguration&) {
|
||||
log_request_base(is_host_vst, [](auto& message) {
|
||||
message << "Requesting <Configuration>";
|
||||
|
||||
@@ -49,6 +49,7 @@ class Vst3Logger {
|
||||
|
||||
void log_request(bool is_host_vst, const YaComponent::Create&);
|
||||
void log_request(bool is_host_vst, const YaComponent::Destroy&);
|
||||
void log_request(bool is_host_vst, const YaComponent::Terminate&);
|
||||
void log_request(bool is_host_vst, const WantsConfiguration&);
|
||||
void log_request(bool is_host_vst, const WantsPluginFactory&);
|
||||
|
||||
|
||||
@@ -68,8 +68,10 @@ struct WantsPluginFactory {
|
||||
* encodes the information we request or the operation we want to perform. A
|
||||
* request of type `ControlRequest(T)` should send back a `T::Response`.
|
||||
*/
|
||||
using ControlRequest =
|
||||
std::variant<YaComponent::Create, YaComponent::Destroy, WantsPluginFactory>;
|
||||
using ControlRequest = std::variant<YaComponent::Create,
|
||||
YaComponent::Destroy,
|
||||
YaComponent::Terminate,
|
||||
WantsPluginFactory>;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, ControlRequest& payload) {
|
||||
|
||||
@@ -79,7 +79,7 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
||||
|
||||
/**
|
||||
* Message to request the Wine plugin host to instantiate a new IComponent
|
||||
* to pass through a call to `IPluginFactory::createInstance(cid,
|
||||
* to pass through a call to `IComponent::createInstance(cid,
|
||||
* IComponent::iid,
|
||||
* ...)`.
|
||||
*/
|
||||
@@ -126,6 +126,22 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
||||
|
||||
// From `IPluginBase`
|
||||
virtual tresult PLUGIN_API initialize(FUnknown* context) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IComponent::terminate()` to the Wine
|
||||
* plugin host.
|
||||
*/
|
||||
struct Terminate {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API terminate() override = 0;
|
||||
|
||||
// From `IComponent`
|
||||
|
||||
@@ -40,8 +40,10 @@ tresult PLUGIN_API YaComponentPluginImpl::initialize(FUnknown* context) {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaComponentPluginImpl::terminate() {
|
||||
// TODO: Implement
|
||||
return Steinberg::kNotImplemented;
|
||||
return bridge
|
||||
.send_message(
|
||||
YaComponent::Terminate{.instance_id = arguments.instance_id})
|
||||
.native();
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
|
||||
@@ -78,6 +78,10 @@ void Vst3Bridge::run() {
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](const YaComponent::Terminate& request)
|
||||
-> YaComponent::Terminate::Response {
|
||||
return component_instances[request.instance_id]->terminate();
|
||||
},
|
||||
[&](const WantsPluginFactory&) -> WantsPluginFactory::Response {
|
||||
return *plugin_factory;
|
||||
}});
|
||||
|
||||
Reference in New Issue
Block a user