mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Implement the rest of the GUI events
The GUI is still not updating though.
This commit is contained in:
@@ -217,6 +217,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
return &events.as_c_events();
|
||||
},
|
||||
[&](WantsChunkBuffer&) -> void* { return string_buffer.data(); },
|
||||
[&](const WantsVstRect&) -> void* { return string_buffer.data(); },
|
||||
[&](const WantsVstTimeInfo&) -> void* { return nullptr; },
|
||||
[&](WantsString&) -> void* { return string_buffer.data(); }},
|
||||
event.payload);
|
||||
@@ -264,6 +265,11 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
return std::string(*static_cast<char**>(data),
|
||||
return_value);
|
||||
},
|
||||
[&](WantsVstRect&) -> EventResposnePayload {
|
||||
// The plugin has written a pointer to a VstRect struct
|
||||
// into the data poitner
|
||||
return **static_cast<VstRect**>(data);
|
||||
},
|
||||
[&](WantsVstTimeInfo&) -> EventResposnePayload {
|
||||
// Not sure why the VST API has twenty different ways of
|
||||
// returning structs, but in this case the value returned
|
||||
|
||||
@@ -175,6 +175,7 @@ void Logger::log_event(bool is_dispatch,
|
||||
[&](const WantsChunkBuffer&) {
|
||||
message << "<writable_buffer>";
|
||||
},
|
||||
[&](const WantsVstRect&) { message << "<writable_buffer>"; },
|
||||
[&](const WantsVstTimeInfo&) { message << "<nullptr>"; },
|
||||
[&](const WantsString&) { message << "<writable_string>"; }},
|
||||
payload);
|
||||
@@ -210,6 +211,11 @@ void Logger::log_event_response(bool is_dispatch,
|
||||
}
|
||||
},
|
||||
[&](const AEffect&) { message << ", <AEffect_object>"; },
|
||||
[&](const VstRect& rect) {
|
||||
message << ", {l: " << rect.left << ", t: " << rect.top
|
||||
<< ", r: " << rect.right
|
||||
<< ", b: " << rect.bottom << "}";
|
||||
},
|
||||
[&](const VstTimeInfo&) { message << ", <time_info>"; }},
|
||||
payload);
|
||||
|
||||
|
||||
@@ -83,6 +83,14 @@ void serialize(S& s, AEffect& plugin) {
|
||||
s.value4b(plugin.version);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, VstRect& rect) {
|
||||
s.value2b(rect.top);
|
||||
s.value2b(rect.left);
|
||||
s.value2b(rect.right);
|
||||
s.value2b(rect.bottom);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, VstTimeInfo& time_info) {
|
||||
s.value8b(time_info.samplePos);
|
||||
@@ -152,9 +160,15 @@ class alignas(16) DynamicVstEvents {
|
||||
*/
|
||||
struct WantsChunkBuffer {};
|
||||
|
||||
/**
|
||||
* Marker struct to indicate that the event handler will write a pointer to a
|
||||
* `VstRect` struct into the void pointer.
|
||||
*/
|
||||
struct WantsVstRect {};
|
||||
|
||||
/**
|
||||
* Marker struct to indicate that the event handler will return a pointer to a
|
||||
* `VstTiemInfo` struct that should be returned transfered.
|
||||
* `VstTimeInfo` struct that should be returned transfered.
|
||||
*/
|
||||
struct WantsVstTimeInfo {};
|
||||
|
||||
@@ -198,6 +212,7 @@ using EventPayload = std::variant<std::nullptr_t,
|
||||
AEffect,
|
||||
DynamicVstEvents,
|
||||
WantsChunkBuffer,
|
||||
WantsVstRect,
|
||||
WantsVstTimeInfo,
|
||||
WantsString>;
|
||||
|
||||
@@ -218,8 +233,8 @@ void serialize(S& s, EventPayload& payload) {
|
||||
events.events, max_midi_events,
|
||||
[](S& s, VstEvent& event) { s.container1b(event.dump); });
|
||||
},
|
||||
[](S&, WantsChunkBuffer&) {}, [](S&, WantsVstTimeInfo&) {},
|
||||
[](S&, WantsString&) {}});
|
||||
[](S&, WantsChunkBuffer&) {}, [](S&, WantsVstRect&) {},
|
||||
[](S&, WantsVstTimeInfo&) {}, [](S&, WantsString&) {}});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,7 +290,7 @@ struct Event {
|
||||
* - An X11 window pointer for the editor window.
|
||||
*/
|
||||
using EventResposnePayload =
|
||||
std::variant<std::monostate, std::string, AEffect, VstTimeInfo>;
|
||||
std::variant<std::monostate, std::string, AEffect, VstRect, VstTimeInfo>;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, EventResposnePayload& payload) {
|
||||
@@ -289,6 +304,7 @@ void serialize(S& s, EventResposnePayload& payload) {
|
||||
s.text1b(string, binary_buffer_size);
|
||||
},
|
||||
[](S& s, AEffect& effect) { s.object(effect); },
|
||||
[](S& s, VstRect& rect) { s.object(rect); },
|
||||
[](S& s, VstTimeInfo& time_info) { s.object(time_info); }});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user