mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Rename the Event struct to Vst2Event
This commit is contained in:
@@ -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<EventResult>(socket);
|
||||
}
|
||||
|
||||
@@ -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,7 +185,7 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
|
||||
value_payload);
|
||||
}
|
||||
|
||||
const Event event{.opcode = opcode,
|
||||
const Vst2Event event{.opcode = opcode,
|
||||
.index = index,
|
||||
.value = value,
|
||||
.option = option,
|
||||
@@ -223,10 +223,10 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
|
||||
* 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<Thread> {
|
||||
* @relates Vst2EventHandler::send_event
|
||||
* @relates passthrough_event
|
||||
*/
|
||||
template <invocable_returning<EventResult, Event&, bool> F>
|
||||
template <invocable_returning<EventResult, Vst2Event&, bool> F>
|
||||
void receive_events(std::optional<std::pair<Vst2Logger&, bool>> logging,
|
||||
F&& callback) {
|
||||
// Reading, processing, and writing back event data from the sockets
|
||||
@@ -245,7 +245,7 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
|
||||
const auto process_event =
|
||||
[&](boost::asio::local::stream_protocol::socket& socket,
|
||||
bool on_main_thread) {
|
||||
auto event = read_object<Event>(socket);
|
||||
auto event = read_object<Vst2Event>(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<intptr_t, AEffect*, int, int, intptr_t, void*, float> 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -76,7 +76,7 @@ Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback)
|
||||
|
||||
sockets.vst_host_callback.receive_events(
|
||||
std::pair<Vst2Logger&, bool>(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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user