Add the ability to override writing back data

This commit is contained in:
Robbert van der Helm
2020-03-09 23:36:54 +01:00
parent ec96064cc1
commit 7e75f913fa
3 changed files with 36 additions and 29 deletions
+6 -6
View File
@@ -138,16 +138,16 @@ HostBridge::HostBridge(audioMasterCallback host_callback)
}
struct DispatchDataConverter : DefaultDataConverter {
EventPayload operator()(int opcode, void* data) {
EventPayload read(const int opcode, 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
// TODO: More of these structs
switch (opcode) {
case effProcessEvents:
return DynamicVstEvents(*static_cast<VstEvents*>(data));
return DynamicVstEvents(*static_cast<const VstEvents*>(data));
break;
default:
return DefaultDataConverter{}(opcode, data);
return DefaultDataConverter::read(opcode, data);
break;
}
}
@@ -183,9 +183,9 @@ intptr_t HostBridge::dispatch(AEffect* /*plugin*/,
}
// TODO: Maybe reuse buffers here when dealing with chunk data
return send_event<DispatchDataConverter>(
host_vst_dispatch, opcode, index, value, data, option,
std::pair<Logger&, bool>(logger, true));
DispatchDataConverter converter;
return send_event(host_vst_dispatch, converter, opcode, index, value, data,
option, std::pair<Logger&, bool>(logger, true));
}
void HostBridge::process_replacing(AEffect* /*plugin*/,