mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Remove the now unused ability to skip opcodes
If this is needed again in the future (it shouldn't be), then it should be re-implemented using a separate function.
This commit is contained in:
+8
-18
@@ -34,13 +34,11 @@ class DefaultDataConverter {
|
||||
/**
|
||||
* Read data from the `data` void pointer into a an `EventPayload` value
|
||||
* that can be serialized and conveys the meaning of the event.
|
||||
*
|
||||
* If this returns a nullopt, then the event will be skipped.
|
||||
*/
|
||||
virtual std::optional<EventPayload> read(const int /*opcode*/,
|
||||
const int /*index*/,
|
||||
const intptr_t /*value*/,
|
||||
const void* data) {
|
||||
virtual EventPayload read(const int /*opcode*/,
|
||||
const int /*index*/,
|
||||
const intptr_t /*value*/,
|
||||
const void* data) {
|
||||
if (data == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -125,24 +123,16 @@ intptr_t send_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
void* data,
|
||||
float option) {
|
||||
// Encode the right payload type for this event. Check the documentation for
|
||||
// `EventPayload` for more information. We have to skip some opcodes because
|
||||
// some VST hsots will outright crash if they receive them, please let me
|
||||
// know if there's a better way to do this.
|
||||
const std::optional<EventPayload> payload =
|
||||
// `EventPayload` for more information
|
||||
const EventPayload payload =
|
||||
data_converter.read(opcode, index, value, data);
|
||||
if (!payload.has_value()) {
|
||||
// A 0 usually means that the event was not supported by the other
|
||||
// rendpoint
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (logging.has_value()) {
|
||||
auto [logger, is_dispatch] = logging.value();
|
||||
logger.log_event(is_dispatch, opcode, index, value, payload.value(),
|
||||
option);
|
||||
logger.log_event(is_dispatch, opcode, index, value, payload, option);
|
||||
}
|
||||
|
||||
const Event event{opcode, index, value, option, payload.value()};
|
||||
const Event event{opcode, index, value, option, payload};
|
||||
|
||||
// Prevent two threads from writing over the socket at the same time and
|
||||
// messages getting out of order. This is needed because we can't prevent
|
||||
|
||||
@@ -186,10 +186,10 @@ class DispatchDataConverter : DefaultDataConverter {
|
||||
VstRect& editor_rectangle)
|
||||
: chunk(chunk_data), rect(editor_rectangle) {}
|
||||
|
||||
std::optional<EventPayload> read(const int opcode,
|
||||
const int index,
|
||||
const intptr_t value,
|
||||
const void* data) {
|
||||
EventPayload read(const int opcode,
|
||||
const int index,
|
||||
const intptr_t value,
|
||||
const void* data) {
|
||||
// There are some events that need specific structs that we can't simply
|
||||
// serialize as a string because they might contain null bytes
|
||||
switch (opcode) {
|
||||
|
||||
@@ -284,10 +284,10 @@ class HostCallbackDataConverter : DefaultDataConverter {
|
||||
std::optional<VstTimeInfo>& time_info)
|
||||
: plugin(plugin), time_info(time_info) {}
|
||||
|
||||
std::optional<EventPayload> read(const int opcode,
|
||||
const int index,
|
||||
const intptr_t value,
|
||||
const void* data) {
|
||||
EventPayload read(const int opcode,
|
||||
const int index,
|
||||
const intptr_t value,
|
||||
const void* data) {
|
||||
switch (opcode) {
|
||||
case audioMasterGetTime:
|
||||
return WantsVstTimeInfo{};
|
||||
|
||||
Reference in New Issue
Block a user