mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-18 17:33:56 +02:00
Bundle associated messages with their interfaces
Once we start implementing all of the control messages/callbacks things could quickly get out of hand otherwise.
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
Vst3Logger::Vst3Logger(Logger& generic_logger) : logger(generic_logger) {}
|
Vst3Logger::Vst3Logger(Logger& generic_logger) : logger(generic_logger) {}
|
||||||
|
|
||||||
void Vst3Logger::log_request(bool is_host_vst, const CreateInstaneIComponent&) {
|
void Vst3Logger::log_request(bool is_host_vst, const YaComponent::Create&) {
|
||||||
if (BOOST_UNLIKELY(logger.verbosity >= Logger::Verbosity::most_events)) {
|
if (BOOST_UNLIKELY(logger.verbosity >= Logger::Verbosity::most_events)) {
|
||||||
std::ostringstream message;
|
std::ostringstream message;
|
||||||
// TODO: Log the cid in some readable way, if possible
|
// TODO: Log the cid in some readable way, if possible
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Vst3Logger {
|
|||||||
// flag here indicates whether the request was initiated on the host side
|
// flag here indicates whether the request was initiated on the host side
|
||||||
// (what we'll call a control message).
|
// (what we'll call a control message).
|
||||||
|
|
||||||
void log_request(bool is_host_vst, const CreateInstaneIComponent&);
|
void log_request(bool is_host_vst, const YaComponent::Create&);
|
||||||
void log_request(bool is_host_vst, const WantsConfiguration&);
|
void log_request(bool is_host_vst, const WantsConfiguration&);
|
||||||
void log_request(bool is_host_vst, const WantsPluginFactory&);
|
void log_request(bool is_host_vst, const WantsPluginFactory&);
|
||||||
|
|
||||||
|
|||||||
@@ -38,20 +38,8 @@
|
|||||||
// TODO: If this approach works, maybe we can also refactor the VST2 handling to
|
// TODO: If this approach works, maybe we can also refactor the VST2 handling to
|
||||||
// do this since it's a bit safer and easier to read
|
// do this since it's a bit safer and easier to read
|
||||||
|
|
||||||
/**
|
// All messages for creating objects and calling interfaces on them are defined
|
||||||
* Request the Wine plugin host to instantiate a new IComponent to pass through
|
// as part of the interfaces and implementations in `vst3/`
|
||||||
* a call to `IPluginFactory::createInstance(cid, IComponent::iid, ...)`.
|
|
||||||
*/
|
|
||||||
struct CreateInstaneIComponent {
|
|
||||||
using Response = YaComponent&;
|
|
||||||
|
|
||||||
Steinberg::TUID cid;
|
|
||||||
|
|
||||||
template <typename S>
|
|
||||||
void serialize(S& s) {
|
|
||||||
s.container1b(cid);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker struct to indicate the other side (the plugin) should send a copy of
|
* Marker struct to indicate the other side (the plugin) should send a copy of
|
||||||
@@ -80,8 +68,7 @@ struct WantsPluginFactory {
|
|||||||
* encodes the information we request or the operation we want to perform. A
|
* encodes the information we request or the operation we want to perform. A
|
||||||
* request of type `ControlRequest(T)` should send back a `T::Response`.
|
* request of type `ControlRequest(T)` should send back a `T::Response`.
|
||||||
*/
|
*/
|
||||||
using ControlRequest =
|
using ControlRequest = std::variant<YaComponent::Create, WantsPluginFactory>;
|
||||||
std::variant<CreateInstaneIComponent, WantsPluginFactory>;
|
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s, ControlRequest& payload) {
|
void serialize(S& s, ControlRequest& payload) {
|
||||||
|
|||||||
@@ -35,6 +35,22 @@ using Steinberg::TBool, Steinberg::int32, Steinberg::tresult;
|
|||||||
*/
|
*/
|
||||||
class YaComponent : public Steinberg::Vst::IComponent {
|
class YaComponent : public Steinberg::Vst::IComponent {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Request the Wine plugin host to instantiate a new IComponent to pass
|
||||||
|
* through a call to `IPluginFactory::createInstance(cid, IComponent::iid,
|
||||||
|
* ...)`.
|
||||||
|
*/
|
||||||
|
struct Create {
|
||||||
|
using Response = YaComponent&;
|
||||||
|
|
||||||
|
Steinberg::TUID cid;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.container1b(cid);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
YaComponent();
|
YaComponent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ void Vst3Bridge::run() {
|
|||||||
sockets.host_vst_control.receive_messages(
|
sockets.host_vst_control.receive_messages(
|
||||||
std::nullopt,
|
std::nullopt,
|
||||||
overload{
|
overload{
|
||||||
[&](const CreateInstaneIComponent& args)
|
[&](const YaComponent::Create& args)
|
||||||
-> CreateInstaneIComponent::Response {
|
-> YaComponent::Create::Response {
|
||||||
Steinberg::IPtr<Steinberg::Vst::IComponent> component =
|
Steinberg::IPtr<Steinberg::Vst::IComponent> component =
|
||||||
module->getFactory()
|
module->getFactory()
|
||||||
.createInstance<Steinberg::Vst::IComponent>(args.cid);
|
.createInstance<Steinberg::Vst::IComponent>(args.cid);
|
||||||
|
|||||||
Reference in New Issue
Block a user