mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Add boilerplate for event handling
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
+4
-2
@@ -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 : []
|
||||
)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cinttypes>
|
||||
|
||||
// Calling convention
|
||||
#ifndef __WINE__
|
||||
|
||||
+21
-12
@@ -1,6 +1,9 @@
|
||||
#include "bridge.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <msgpack.hpp>
|
||||
|
||||
#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<char*>(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<char*>(result));
|
||||
|
||||
return 1; // TODO: Why?
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Unimplmemented
|
||||
return 0;
|
||||
return response.return_value;
|
||||
}
|
||||
|
||||
void Bridge::process(AEffect* /*plugin*/,
|
||||
|
||||
Reference in New Issue
Block a user