mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Factor out sending and passing through events
Since we can use this both for the dispatch function and for host callbacks.
This commit is contained in:
+1
-15
@@ -96,21 +96,7 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
|
||||
break;
|
||||
}
|
||||
|
||||
auto payload =
|
||||
data == nullptr
|
||||
? std::nullopt
|
||||
: std::make_optional(std::string(static_cast<char*>(data)));
|
||||
|
||||
const Event event{opcode, index, value, option, payload};
|
||||
write_object(host_vst_dispatch, event);
|
||||
|
||||
const auto response = read_object<EventResult>(host_vst_dispatch);
|
||||
if (response.data.has_value()) {
|
||||
std::copy(response.data->begin(), response.data->end(),
|
||||
static_cast<char*>(data));
|
||||
}
|
||||
|
||||
return response.return_value;
|
||||
return send_event(host_vst_dispatch, opcode, index, value, data, option);
|
||||
}
|
||||
|
||||
void Bridge::process(AEffect* /*plugin*/,
|
||||
|
||||
Reference in New Issue
Block a user