mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-15 07:53:55 +02:00
Rename EventResponsePayload to be clearer
This commit is contained in:
+11
-13
@@ -282,8 +282,8 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
|||||||
// Only write back data when needed, this depends on the event payload
|
// Only write back data when needed, this depends on the event payload
|
||||||
// type
|
// type
|
||||||
auto write_payload_fn = overload{
|
auto write_payload_fn = overload{
|
||||||
[&](auto) -> EventResposnePayload { return nullptr; },
|
[&](auto) -> EventResultPayload { return nullptr; },
|
||||||
[&](const AEffect& updated_plugin) -> EventResposnePayload {
|
[&](const AEffect& updated_plugin) -> EventResultPayload {
|
||||||
// This is a bit of a special case! Instead of writing some
|
// This is a bit of a special case! Instead of writing some
|
||||||
// return value, we will update values on the native VST
|
// return value, we will update values on the native VST
|
||||||
// plugin's `AEffect` object. This is triggered by the
|
// plugin's `AEffect` object. This is triggered by the
|
||||||
@@ -308,7 +308,7 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
},
|
},
|
||||||
[&](WantsChunkBuffer&) -> EventResposnePayload {
|
[&](WantsChunkBuffer&) -> EventResultPayload {
|
||||||
// In this case the plugin will have written its data stored in
|
// In this case the plugin will have written its data stored in
|
||||||
// an array to which a pointer is stored in `data`, with the
|
// an array to which a pointer is stored in `data`, with the
|
||||||
// return value from the event determines how much data the
|
// return value from the event determines how much data the
|
||||||
@@ -317,21 +317,19 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
|||||||
return std::vector<uint8_t>(chunk_data,
|
return std::vector<uint8_t>(chunk_data,
|
||||||
chunk_data + return_value);
|
chunk_data + return_value);
|
||||||
},
|
},
|
||||||
[&](VstIOProperties& props) -> EventResposnePayload {
|
[&](VstIOProperties& props) -> EventResultPayload { return props; },
|
||||||
return props;
|
[&](VstMidiKeyName& key_name) -> EventResultPayload {
|
||||||
},
|
|
||||||
[&](VstMidiKeyName& key_name) -> EventResposnePayload {
|
|
||||||
return key_name;
|
return key_name;
|
||||||
},
|
},
|
||||||
[&](VstParameterProperties& props) -> EventResposnePayload {
|
[&](VstParameterProperties& props) -> EventResultPayload {
|
||||||
return props;
|
return props;
|
||||||
},
|
},
|
||||||
[&](WantsVstRect&) -> EventResposnePayload {
|
[&](WantsVstRect&) -> EventResultPayload {
|
||||||
// The plugin has written a pointer to a VstRect struct into the
|
// The plugin has written a pointer to a VstRect struct into the
|
||||||
// data poitner
|
// data poitner
|
||||||
return **static_cast<VstRect**>(data);
|
return **static_cast<VstRect**>(data);
|
||||||
},
|
},
|
||||||
[&](WantsVstTimeInfo&) -> EventResposnePayload {
|
[&](WantsVstTimeInfo&) -> EventResultPayload {
|
||||||
// Not sure why the VST API has twenty different ways of
|
// Not sure why the VST API has twenty different ways of
|
||||||
// returning structs, but in this case the value returned from
|
// returning structs, but in this case the value returned from
|
||||||
// the callback function is actually a pointer to a
|
// the callback function is actually a pointer to a
|
||||||
@@ -345,7 +343,7 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
|||||||
return *time_info;
|
return *time_info;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[&](WantsString&) -> EventResposnePayload {
|
[&](WantsString&) -> EventResultPayload {
|
||||||
return std::string(static_cast<char*>(data));
|
return std::string(static_cast<char*>(data));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -355,9 +353,9 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
|||||||
// `effGetSpeakerArrangement` expects the plugin to write its own data
|
// `effGetSpeakerArrangement` expects the plugin to write its own data
|
||||||
// to this value. Hence why we need to encode the response here
|
// to this value. Hence why we need to encode the response here
|
||||||
// separately.
|
// separately.
|
||||||
const EventResposnePayload response_data =
|
const EventResultPayload response_data =
|
||||||
std::visit(write_payload_fn, event.payload);
|
std::visit(write_payload_fn, event.payload);
|
||||||
std::optional<EventResposnePayload> value_response_data = std::nullopt;
|
std::optional<EventResultPayload> value_response_data = std::nullopt;
|
||||||
if (event.value_payload.has_value()) {
|
if (event.value_payload.has_value()) {
|
||||||
value_response_data =
|
value_response_data =
|
||||||
std::visit(write_payload_fn, event.value_payload.value());
|
std::visit(write_payload_fn, event.value_payload.value());
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void Logger::log_event(bool is_dispatch,
|
|||||||
void Logger::log_event_response(bool is_dispatch,
|
void Logger::log_event_response(bool is_dispatch,
|
||||||
int opcode,
|
int opcode,
|
||||||
intptr_t return_value,
|
intptr_t return_value,
|
||||||
const EventResposnePayload& payload) {
|
const EventResultPayload& payload) {
|
||||||
if (BOOST_UNLIKELY(verbosity >= Verbosity::most_events)) {
|
if (BOOST_UNLIKELY(verbosity >= Verbosity::most_events)) {
|
||||||
if (should_filter_event(is_dispatch, opcode)) {
|
if (should_filter_event(is_dispatch, opcode)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class Logger {
|
|||||||
void log_event_response(bool is_dispatch,
|
void log_event_response(bool is_dispatch,
|
||||||
int opcode,
|
int opcode,
|
||||||
intptr_t return_value,
|
intptr_t return_value,
|
||||||
const EventResposnePayload& payload);
|
const EventResultPayload& payload);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|||||||
+13
-14
@@ -422,19 +422,19 @@ struct Event {
|
|||||||
* `audioMasterIOChanged`.
|
* `audioMasterIOChanged`.
|
||||||
* - An X11 window pointer for the editor window.
|
* - An X11 window pointer for the editor window.
|
||||||
*/
|
*/
|
||||||
using EventResposnePayload = std::variant<std::nullptr_t,
|
using EventResultPayload = std::variant<std::nullptr_t,
|
||||||
std::string,
|
std::string,
|
||||||
std::vector<uint8_t>,
|
std::vector<uint8_t>,
|
||||||
AEffect,
|
AEffect,
|
||||||
DynamicSpeakerArrangement,
|
DynamicSpeakerArrangement,
|
||||||
VstIOProperties,
|
VstIOProperties,
|
||||||
VstMidiKeyName,
|
VstMidiKeyName,
|
||||||
VstParameterProperties,
|
VstParameterProperties,
|
||||||
VstRect,
|
VstRect,
|
||||||
VstTimeInfo>;
|
VstTimeInfo>;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s, EventResposnePayload& payload) {
|
void serialize(S& s, EventResultPayload& payload) {
|
||||||
s.ext(payload,
|
s.ext(payload,
|
||||||
bitsery::ext::StdVariant{
|
bitsery::ext::StdVariant{
|
||||||
[](S&, std::nullptr_t&) {},
|
[](S&, std::nullptr_t&) {},
|
||||||
@@ -468,14 +468,13 @@ struct EventResult {
|
|||||||
* into the void pointer, but sometimes an event response should forward
|
* into the void pointer, but sometimes an event response should forward
|
||||||
* some kind of special struct.
|
* some kind of special struct.
|
||||||
*/
|
*/
|
||||||
// TODO: Fix typo and rename to `EventResultPayload` for consistency
|
EventResultPayload payload;
|
||||||
EventResposnePayload payload;
|
|
||||||
/**
|
/**
|
||||||
* The same as the above value, but for returning values written to the
|
* The same as the above value, but for returning values written to the
|
||||||
* `intptr_t` value parameter. This is only used during
|
* `intptr_t` value parameter. This is only used during
|
||||||
* `effGetSpeakerArrangement`.
|
* `effGetSpeakerArrangement`.
|
||||||
*/
|
*/
|
||||||
std::optional<EventResposnePayload> value_payload;
|
std::optional<EventResultPayload> value_payload;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
|
|||||||
Reference in New Issue
Block a user