diff --git a/README.md b/README.md index fed7af79..de011790 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ the following dependencies: - gcc (tested using GCC 9.2) - A Wine installation with `wiengcc` and the development headers. +- [msgpack-c](git@github.com:msgpack/msgpack-c.git) The project can then be compiled as follows: diff --git a/meson.build b/meson.build index 59114994..d341d712 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'yabridge', 'cpp', version : '0.1', - default_options : ['warning_level=3', 'cpp_std=c++17'] + default_options : ['warning_level=3', 'cpp_std=c++17', 'build.cpp_std=c++17'] ) # Meson does not let us set a default cross compiler, which makes sense, but it @@ -20,6 +20,8 @@ endif # about the way these two components work together can be found in the readme # file. +msgpack_dep = dependency('msgpack') + include_dir = include_directories('src/include') common_src = [] @@ -38,7 +40,7 @@ shared_library( linux_plugin_src + common_src, native : true, include_directories : include_dir, - dependencies : [], + dependencies : [msgpack_dep], link_args : [] ) diff --git a/src/include/vestige/aeffect.h b/src/include/vestige/aeffect.h index cf4f538d..e6e715a6 100644 --- a/src/include/vestige/aeffect.h +++ b/src/include/vestige/aeffect.h @@ -24,7 +24,7 @@ #pragma once -#include +#include // Calling convention #ifndef __WINE__ diff --git a/src/plugin/bridge.cpp b/src/plugin/bridge.cpp index 0fcf3538..102b4176 100644 --- a/src/plugin/bridge.cpp +++ b/src/plugin/bridge.cpp @@ -1,6 +1,9 @@ #include "bridge.h" #include +#include + +#include "../common/events.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* @@ -12,10 +15,24 @@ */ intptr_t Bridge::dispatch(AEffect* /*plugin*/, int32_t opcode, - int32_t /*parameter*/, - intptr_t /*value*/, + int32_t parameter, + intptr_t value, void* result, - float /*option*/) { + float option) { + // TODO: Send to the Wine process + Event event{opcode, parameter, value, option}; + msgpack::sbuffer buffer; + msgpack::pack(buffer, event); + + // TODO: Read the response + EventResult response; + if (response.result) { + std::copy(response.result->begin(), response.result->end(), + static_cast(result)); + } + + // Some events need some extra handling + // TODO: Handle other things such as GUI itneraction switch (opcode) { case effClose: // TODO: Gracefully close the editor? @@ -27,17 +44,9 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/, return 0; break; - case effGetEffectName: - const std::string plugin_name("Hello, world!"); - std::copy(plugin_name.begin(), plugin_name.end(), - static_cast(result)); - - return 1; // TODO: Why? - break; } - // TODO: Unimplmemented - return 0; + return response.return_value; } void Bridge::process(AEffect* /*plugin*/,