Answer event queries within the Wine VST host

This commit is contained in:
Robbert van der Helm
2020-02-09 20:05:47 +01:00
parent 73256d0055
commit 875308bd6f
5 changed files with 67 additions and 18 deletions
+11 -11
View File
@@ -15,7 +15,7 @@
namespace bp = boost::process;
namespace fs = boost::filesystem;
constexpr auto yabridge_wine_host_name = "yabridge-host.exeTODO";
constexpr auto yabridge_wine_host_name = "yabridge-host.exe";
fs::path find_wine_vst_host();
@@ -38,15 +38,6 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
intptr_t value,
void* result,
float option) {
Event event{opcode, parameter, value, option};
write_object(vst_stdin, event);
EventResult response = read_object(vst_stdout);
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) {
@@ -64,6 +55,15 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
break;
}
Event event{opcode, parameter, value, option};
write_object(vst_stdin, event);
auto response = read_object<EventResult>(vst_stdout);
if (response.result) {
std::copy(response.result->begin(), response.result->end(),
static_cast<char*>(result));
}
return response.return_value;
}
@@ -109,7 +109,7 @@ fs::path find_wine_vst_host() {
// Bosot will return an empty path if the file could not be found in the
// search path
fs::path vst_host_path = bp::search_path(yabridge_wine_host_name);
if (fs::is_empty(vst_host_path)) {
if (vst_host_path == "") {
throw std::runtime_error("Could not locate '" +
std::string(yabridge_wine_host_name) + "'");
}