From b1c9d751125f72768487e3b9825d19ef5a7f441a Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 20 May 2021 15:50:09 +0200 Subject: [PATCH] Rename the Event struct to Vst2Event --- src/common/communication/vst2.cpp | 2 +- src/common/communication/vst2.h | 28 ++++++++++++++-------------- src/common/serialization/vst2.h | 2 +- src/plugin/bridges/vst2.cpp | 2 +- src/wine-host/bridges/vst2.cpp | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/common/communication/vst2.cpp b/src/common/communication/vst2.cpp index 2f7fc2a3..c8eac1e9 100644 --- a/src/common/communication/vst2.cpp +++ b/src/common/communication/vst2.cpp @@ -73,7 +73,7 @@ intptr_t DefaultDataConverter::return_value(const int /*opcode*/, EventResult DefaultDataConverter::send_event( boost::asio::local::stream_protocol::socket& socket, - const Event& event) const { + const Vst2Event& event) const { write_object(socket, event); return read_object(socket); } diff --git a/src/common/communication/vst2.h b/src/common/communication/vst2.h index 51bf3efe..4f699118 100644 --- a/src/common/communication/vst2.h +++ b/src/common/communication/vst2.h @@ -85,7 +85,7 @@ class DefaultDataConverter { */ virtual EventResult send_event( boost::asio::local::stream_protocol::socket& socket, - const Event& event) const; + const Vst2Event& event) const; }; /** @@ -185,12 +185,12 @@ class Vst2EventHandler : public AdHocSocketHandler { value_payload); } - const Event event{.opcode = opcode, - .index = index, - .value = value, - .option = option, - .payload = payload, - .value_payload = value_payload}; + const Vst2Event event{.opcode = opcode, + .index = index, + .value = value, + .option = option, + .payload = payload, + .value_payload = value_payload}; // A socket only handles a single request at a time as to prevent // messages from arriving out of order. `AdHocSocketHandler::send()` @@ -223,10 +223,10 @@ class Vst2EventHandler : public AdHocSocketHandler { * then start a blocking loop that handles events from the primary `socket`. * * The specified function will be used to create an `EventResult` from an - * `Event`. This is almost always uses `passthrough_event()`, which converts - * a `EventPayload` into the format used by VST2, calls either `dispatch()` - * or `audioMaster()` depending on the context, and then serializes the - * result back into an `EventResultPayload`. + * `Vst2Event`. This is almost always uses `passthrough_event()`, which + * converts a `EventPayload` into the format used by VST2, calls either + * `dispatch()` or `audioMaster()` depending on the context, and then + * serializes the result back into an `EventResultPayload`. * * @param logging A pair containing a logger instance and whether or not * this is for sending `dispatch()` events or host callbacks. Optional @@ -237,7 +237,7 @@ class Vst2EventHandler : public AdHocSocketHandler { * @relates Vst2EventHandler::send_event * @relates passthrough_event */ - template F> + template F> void receive_events(std::optional> logging, F&& callback) { // Reading, processing, and writing back event data from the sockets @@ -245,7 +245,7 @@ class Vst2EventHandler : public AdHocSocketHandler { const auto process_event = [&](boost::asio::local::stream_protocol::socket& socket, bool on_main_thread) { - auto event = read_object(socket); + auto event = read_object(socket); if (logging) { auto [logger, is_dispatch] = *logging; logger.log_event(is_dispatch, event.opcode, event.index, @@ -406,7 +406,7 @@ class Vst2Sockets : public Sockets { */ template < invocable_returning F> -EventResult passthrough_event(AEffect* plugin, F&& callback, Event& event) { +EventResult passthrough_event(AEffect* plugin, F&& callback, Vst2Event& event) { // This buffer is used to write strings and small objects to. We'll // initialize the beginning with null values to both prevent it from being // read as some arbitrary C-style string, and to make sure that diff --git a/src/common/serialization/vst2.h b/src/common/serialization/vst2.h index 4b8d02c3..702e4d1e 100644 --- a/src/common/serialization/vst2.h +++ b/src/common/serialization/vst2.h @@ -388,7 +388,7 @@ void serialize(S& s, EventPayload& payload) { * the VST host process running under Wine. The fields here mirror those * arguments sent to the `AEffect::dispatch` function. */ -struct Event { +struct Vst2Event { int opcode; int index; native_intptr_t value; diff --git a/src/plugin/bridges/vst2.cpp b/src/plugin/bridges/vst2.cpp index dc604ff5..e4b4d03a 100644 --- a/src/plugin/bridges/vst2.cpp +++ b/src/plugin/bridges/vst2.cpp @@ -76,7 +76,7 @@ Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback) sockets.vst_host_callback.receive_events( std::pair(logger, false), - [&](Event& event, bool /*on_main_thread*/) { + [&](Vst2Event& event, bool /*on_main_thread*/) { switch (event.opcode) { // MIDI events sent from the plugin back to the host are // a special case here. They have to sent during the diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index f6a704ae..029eb813 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -353,7 +353,7 @@ bool Vst2Bridge::inhibits_event_loop() noexcept { void Vst2Bridge::run() { sockets.host_vst_dispatch.receive_events( - std::nullopt, [&](Event& event, bool /*on_main_thread*/) { + std::nullopt, [&](Vst2Event& event, bool /*on_main_thread*/) { if (event.opcode == effProcessEvents) { // For 99% of the plugins we can just call // `effProcessReplacing()` and be done with it, but a select few @@ -629,7 +629,7 @@ class HostCallbackDataConverter : public DefaultDataConverter { } EventResult send_event(boost::asio::local::stream_protocol::socket& socket, - const Event& event) const override { + const Vst2Event& event) const override { if (mutually_recursive_callbacks.contains(event.opcode)) { return mutual_recursion.fork([&]() { return DefaultDataConverter::send_event(socket, event);