mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
Add boilerplate for event handling
This commit is contained in:
+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