Add functions to encapsulate serialization

This commit is contained in:
Robbert van der Helm
2020-02-09 17:22:45 +01:00
parent b757001435
commit b6c9acc57c
4 changed files with 91 additions and 59 deletions
+3 -6
View File
@@ -6,7 +6,7 @@
#include <iostream>
#include <msgpack.hpp>
#include "../common/events.h"
#include "../common/communication.h"
// TODO: I should track down the VST2 SDK for clarification on some of the
// implementation details, such as the use of intptr_t isntead of void*
@@ -38,13 +38,10 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
intptr_t value,
void* result,
float option) {
// TODO: Send to the Wine process
Event event{opcode, parameter, value, option};
msgpack::sbuffer buffer;
msgpack::pack(buffer, event);
write_object(vst_stdin, event);
// TODO: Read the response
EventResult response;
EventResult response = read_object(vst_stdout);
if (response.result) {
std::copy(response.result->begin(), response.result->end(),
static_cast<char*>(result));