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)
|
- gcc (tested using GCC 9.2)
|
||||||
- A Wine installation with `wiengcc` and the development headers.
|
- 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:
|
The project can then be compiled as follows:
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -2,7 +2,7 @@ project(
|
|||||||
'yabridge',
|
'yabridge',
|
||||||
'cpp',
|
'cpp',
|
||||||
version : '0.1',
|
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
|
# 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
|
# about the way these two components work together can be found in the readme
|
||||||
# file.
|
# file.
|
||||||
|
|
||||||
|
msgpack_dep = dependency('msgpack')
|
||||||
|
|
||||||
include_dir = include_directories('src/include')
|
include_dir = include_directories('src/include')
|
||||||
|
|
||||||
common_src = []
|
common_src = []
|
||||||
@@ -38,7 +40,7 @@ shared_library(
|
|||||||
linux_plugin_src + common_src,
|
linux_plugin_src + common_src,
|
||||||
native : true,
|
native : true,
|
||||||
include_directories : include_dir,
|
include_directories : include_dir,
|
||||||
dependencies : [],
|
dependencies : [msgpack_dep],
|
||||||
link_args : []
|
link_args : []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <cinttypes>
|
||||||
|
|
||||||
// Calling convention
|
// Calling convention
|
||||||
#ifndef __WINE__
|
#ifndef __WINE__
|
||||||
|
|||||||
+21
-12
@@ -1,6 +1,9 @@
|
|||||||
#include "bridge.h"
|
#include "bridge.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <msgpack.hpp>
|
||||||
|
|
||||||
|
#include "../common/events.h"
|
||||||
|
|
||||||
// TODO: I should track down the VST2 SDK for clarification on some of the
|
// 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*
|
// implementation details, such as the use of intptr_t isntead of void*
|
||||||
@@ -12,10 +15,24 @@
|
|||||||
*/
|
*/
|
||||||
intptr_t Bridge::dispatch(AEffect* /*plugin*/,
|
intptr_t Bridge::dispatch(AEffect* /*plugin*/,
|
||||||
int32_t opcode,
|
int32_t opcode,
|
||||||
int32_t /*parameter*/,
|
int32_t parameter,
|
||||||
intptr_t /*value*/,
|
intptr_t value,
|
||||||
void* result,
|
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) {
|
switch (opcode) {
|
||||||
case effClose:
|
case effClose:
|
||||||
// TODO: Gracefully close the editor?
|
// TODO: Gracefully close the editor?
|
||||||
@@ -27,17 +44,9 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
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 response.return_value;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bridge::process(AEffect* /*plugin*/,
|
void Bridge::process(AEffect* /*plugin*/,
|
||||||
|
|||||||
Reference in New Issue
Block a user