mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Add a plugin group host application
This commit is contained in:
@@ -17,14 +17,29 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* The name of the wine host name, e.g. `yabridge-host.exe` for the regular 64
|
||||
* bit build.
|
||||
* The name of the Wine VST host application, e.g. `yabridge-host.exe` for the
|
||||
* regular 64-bit build.
|
||||
*/
|
||||
constexpr char yabridge_wine_host_name[] = "@host_binary_64bit@";
|
||||
constexpr char yabridge_individual_host_name[] =
|
||||
"@individual_host_binary_64bit@";
|
||||
|
||||
/**
|
||||
* The name of the 32-bit wine host name, e.g. `yabridge-host-32.exe`.` This is
|
||||
* used as a bitbridge to be able to load legacy 32-bit only Windows plugins
|
||||
* from a 64-bit Linux host.
|
||||
* The name of the group host application, e.g. `yabridge-group.exe` for the
|
||||
* regular 64-bit build.
|
||||
*/
|
||||
constexpr char yabridge_wine_host_name_32bit[] = "@host_binary_32bit@";
|
||||
constexpr char yabridge_group_host_name[] = "@group_host_binary_64bit@";
|
||||
|
||||
/**
|
||||
* The name of the 32-bit Wine VST host application, e.g.
|
||||
* `yabridge-host-32.exe`.` This is used as a bitbridge to be able to load
|
||||
* legacy 32-bit only Windows plugins from a 64-bit Linux host.
|
||||
*/
|
||||
constexpr char yabridge_individual_host_name_32bit[] =
|
||||
"@individual_host_binary_32bit@";
|
||||
|
||||
/**
|
||||
* The name of the 32-bit group host application, e.g. `yabridge-group-32.exe`.`
|
||||
* This is used as a bitbridge to be able to load legacy 32-bit only Windows
|
||||
* plugins from a 64-bit Linux host.
|
||||
*/
|
||||
constexpr char yabridge_group_host_name_32bit[] = "@group_host_binary_32bit@";
|
||||
|
||||
@@ -5,8 +5,10 @@ config_header = configure_file(
|
||||
output : 'config.h',
|
||||
configuration : configuration_data(
|
||||
{
|
||||
'host_binary_32bit': host_name_32bit + '.exe',
|
||||
'host_binary_64bit': host_name_64bit + '.exe',
|
||||
'individual_host_binary_32bit': individual_host_name_32bit + '.exe',
|
||||
'individual_host_binary_64bit': individual_host_name_64bit + '.exe',
|
||||
'group_host_binary_32bit': group_host_name_32bit + '.exe',
|
||||
'group_host_binary_64bit': group_host_name_64bit + '.exe',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -112,9 +112,10 @@ PluginArchitecture find_vst_architecture(fs::path plugin_path) {
|
||||
}
|
||||
|
||||
fs::path find_vst_host(PluginArchitecture plugin_arch) {
|
||||
auto host_name = yabridge_wine_host_name;
|
||||
// TODO: Take plugin group settings into account
|
||||
auto host_name = yabridge_individual_host_name;
|
||||
if (plugin_arch == PluginArchitecture::vst_32) {
|
||||
host_name = yabridge_wine_host_name_32bit;
|
||||
host_name = yabridge_individual_host_name_32bit;
|
||||
}
|
||||
|
||||
fs::path host_path =
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// yabridge: a Wine VST bridge
|
||||
// Copyright (C) 2020 Robbert van der Helm
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// Generated inside of build directory
|
||||
#include <src/common/config/config.h>
|
||||
#include <src/common/config/version.h>
|
||||
|
||||
#include "wine-bridge.h"
|
||||
|
||||
/**
|
||||
* This works very similar to the host application defined in
|
||||
* `individual-host.cpp`, but instead of just loading a single plugin this will
|
||||
* act as a daemon that can host multiple 'grouped' plugins. This works by
|
||||
* allowing the `libyabridge.so` instance to connect this this process over a
|
||||
* socket to ask this process to host a VST `.dll` file using a provided socket.
|
||||
* After that initialization step both the regular individual plugin host and
|
||||
* this group plugin host will function identically on both the plugin and the
|
||||
* Wine VST host side.
|
||||
*
|
||||
* The explicit calling convention is needed to work around a bug introduced in
|
||||
* Wine 5.7: https://bugs.winehq.org/show_bug.cgi?id=49138
|
||||
*/
|
||||
int __cdecl main(int argc, char* argv[]) {
|
||||
// Instead of directly hosting a plugin, this process will receive a UNIX
|
||||
// domain socket endpoint path that it should listen on to allow yabridge
|
||||
// instances to spawn plugins in this process.
|
||||
if (argc < 3) {
|
||||
std::cerr << "Usage: "
|
||||
#ifdef __i386__
|
||||
<< yabridge_group_host_name_32bit
|
||||
#else
|
||||
<< yabridge_group_host_name
|
||||
#endif
|
||||
<< " <group_name> <unix_domain_socket>" << std::endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
const std::string group_name(argv[1]);
|
||||
const std::string group_socket_endpoint_path(argv[2]);
|
||||
|
||||
// TODO: Before doing anything, try listening on the socket and fail
|
||||
// silently (or log a message?) if another application is already
|
||||
// listening on the socket. This way we don't need any complicated
|
||||
// inter-process synchronization to ensure that there is a single
|
||||
// active group host listening for this group.
|
||||
// TODO: We should somehow try and redirect this process's STDOUT and STDERR
|
||||
// streams to the logger so we can forward Wine's debug messages to
|
||||
// the log even the yabridge plugin instance that initially spawned
|
||||
// this group host process has exited. The only way I can think of
|
||||
// doing this would be using some kind of in memory file and the
|
||||
// `dup2()` system call.
|
||||
|
||||
Logger logger = Logger::create_from_environment(group_name);
|
||||
logger.log("Initializing yabridge group host version " +
|
||||
std::string(yabridge_git_version)
|
||||
#ifdef __i386__
|
||||
+ " (32-bit compatibility mode)"
|
||||
#endif
|
||||
);
|
||||
|
||||
// TODO: After initializing, listen for connections and spawn plugins
|
||||
// the exact same way as what happens in `individual-host.cpp`
|
||||
// TODO: Allow this process to exit when the last plugin exits. Make sure
|
||||
// that that doesn't cause any race conditions.
|
||||
}
|
||||
@@ -22,9 +22,14 @@
|
||||
|
||||
#include "wine-bridge.h"
|
||||
|
||||
// This explicit calling convention is needed to work around a bug introduced in
|
||||
// Wine 5.7
|
||||
// https://bugs.winehq.org/show_bug.cgi?id=49138
|
||||
/**
|
||||
* This is the default VST host application. It will load the specified VST2
|
||||
* plugin, and then connect back to the `libyabridge.so` instace that spawned
|
||||
* this over the socket.
|
||||
*
|
||||
* The explicit calling convention is needed to work around a bug introduced in
|
||||
* Wine 5.7: https://bugs.winehq.org/show_bug.cgi?id=49138
|
||||
*/
|
||||
int __cdecl main(int argc, char* argv[]) {
|
||||
// We pass the name of the VST plugin .dll file to load and the Unix domain
|
||||
// socket to connect to in plugin/bridge.cpp as the first two arguments of
|
||||
@@ -32,9 +37,9 @@ int __cdecl main(int argc, char* argv[]) {
|
||||
if (argc < 3) {
|
||||
std::cerr << "Usage: "
|
||||
#ifdef __i386__
|
||||
<< yabridge_wine_host_name_32bit
|
||||
<< yabridge_individual_host_name_32bit
|
||||
#else
|
||||
<< yabridge_wine_host_name
|
||||
<< yabridge_individual_host_name
|
||||
#endif
|
||||
<< " <vst_plugin_dll> <unix_domain_socket>" << std::endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user