mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Add logging prefixes based on the plugin
This commit is contained in:
@@ -29,6 +29,8 @@
|
|||||||
// here.
|
// here.
|
||||||
|
|
||||||
namespace bp = boost::process;
|
namespace bp = boost::process;
|
||||||
|
// I'd rather use std::filesystem instead, but Boost.Process depends on
|
||||||
|
// boost::filesystem
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +44,7 @@ constexpr auto yabridge_wine_host_name = "yabridge-host.exe";
|
|||||||
constexpr char alphanumeric_characters[] =
|
constexpr char alphanumeric_characters[] =
|
||||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
|
std::string create_logger_prefix(const fs::path& socket_path);
|
||||||
fs::path find_vst_plugin();
|
fs::path find_vst_plugin();
|
||||||
fs::path find_wine_vst_host();
|
fs::path find_wine_vst_host();
|
||||||
fs::path generate_endpoint_name();
|
fs::path generate_endpoint_name();
|
||||||
@@ -74,7 +77,8 @@ HostBridge::HostBridge(audioMasterCallback host_callback)
|
|||||||
host_vst_process_replacing(io_context),
|
host_vst_process_replacing(io_context),
|
||||||
vst_host_aeffect(io_context),
|
vst_host_aeffect(io_context),
|
||||||
host_callback_function(host_callback),
|
host_callback_function(host_callback),
|
||||||
logger(Logger::create_from_environment()),
|
logger(Logger::create_from_environment(
|
||||||
|
create_logger_prefix(socket_endpoint.path()))),
|
||||||
vst_host(find_wine_vst_host(),
|
vst_host(find_wine_vst_host(),
|
||||||
// The Wine VST host needs to know which plugin to load
|
// The Wine VST host needs to know which plugin to load
|
||||||
// and which Unix domain socket to connect to
|
// and which Unix domain socket to connect to
|
||||||
@@ -229,6 +233,22 @@ fs::path find_wine_vst_host() {
|
|||||||
return vst_host_path;
|
return vst_host_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a logger prefix based on the unique socket path for easy
|
||||||
|
* identification. The socket path contains both the plugin's name and a unique
|
||||||
|
* identifier.
|
||||||
|
*
|
||||||
|
* @param socket_path The path to the socket endpoint in use.
|
||||||
|
*
|
||||||
|
* @return A prefix string for log messages.
|
||||||
|
*/
|
||||||
|
std::string create_logger_prefix(const fs::path& socket_path) {
|
||||||
|
std::ostringstream prefix;
|
||||||
|
prefix << "[" << socket_path.filename() << "] ";
|
||||||
|
|
||||||
|
return prefix.str();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the VST plugin .dll file that corresponds to this copy of
|
* Find the VST plugin .dll file that corresponds to this copy of
|
||||||
* `libyabridge.so`. This should be the same as the name of this file but with a
|
* `libyabridge.so`. This should be the same as the name of this file but with a
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
#include "plugin-bridge.h"
|
#include "plugin-bridge.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function pointer to what should be the entry point of a VST plugin.
|
* A function pointer to what should be the entry point of a VST plugin.
|
||||||
*/
|
*/
|
||||||
@@ -27,6 +31,8 @@ using VstEntryPoint = AEffect*(VST_CALL_CONV*)(audioMasterCallback);
|
|||||||
*/
|
*/
|
||||||
PluginBridge* current_bridge_isntance = nullptr;
|
PluginBridge* current_bridge_isntance = nullptr;
|
||||||
|
|
||||||
|
std::string create_logger_prefix(const fs::path& socket_path);
|
||||||
|
|
||||||
intptr_t VST_CALL_CONV
|
intptr_t VST_CALL_CONV
|
||||||
host_callback_proxy(AEffect*, int32_t, int32_t, intptr_t, void*, float);
|
host_callback_proxy(AEffect*, int32_t, int32_t, intptr_t, void*, float);
|
||||||
|
|
||||||
@@ -58,7 +64,8 @@ PluginBridge::PluginBridge(std::string plugin_dll_path,
|
|||||||
host_vst_parameters(io_context),
|
host_vst_parameters(io_context),
|
||||||
host_vst_process_replacing(io_context),
|
host_vst_process_replacing(io_context),
|
||||||
vst_host_aeffect(io_context),
|
vst_host_aeffect(io_context),
|
||||||
logger(Logger::create_from_environment("[WINE] ")),
|
logger(Logger::create_from_environment(
|
||||||
|
create_logger_prefix(socket_endpoint_path))),
|
||||||
process_buffer(std::make_unique<AudioBuffers::buffer_type>()) {
|
process_buffer(std::make_unique<AudioBuffers::buffer_type>()) {
|
||||||
// Got to love these C APIs
|
// Got to love these C APIs
|
||||||
if (plugin_handle == nullptr) {
|
if (plugin_handle == nullptr) {
|
||||||
@@ -192,6 +199,23 @@ intptr_t PluginBridge::host_callback(AEffect* /*plugin*/,
|
|||||||
return send_event(vst_host_callback, opcode, index, value, data, option);
|
return send_event(vst_host_callback, opcode, index, value, data, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a logger prefix based on the unique socket path for easy
|
||||||
|
* identification. The socket path contains both the plugin's name and a unique
|
||||||
|
* identifier.
|
||||||
|
*
|
||||||
|
* @param socket_path The path to the socket endpoint in use.
|
||||||
|
*
|
||||||
|
* @return A prefix string for log messages.
|
||||||
|
*/
|
||||||
|
std::string create_logger_prefix(const fs::path& socket_path) {
|
||||||
|
std::ostringstream prefix;
|
||||||
|
prefix << "[" << socket_path.filename() << "] ";
|
||||||
|
prefix << "[WINE] ";
|
||||||
|
|
||||||
|
return prefix.str();
|
||||||
|
}
|
||||||
|
|
||||||
intptr_t VST_CALL_CONV host_callback_proxy(AEffect* effect,
|
intptr_t VST_CALL_CONV host_callback_proxy(AEffect* effect,
|
||||||
int32_t opcode,
|
int32_t opcode,
|
||||||
int32_t index,
|
int32_t index,
|
||||||
|
|||||||
Reference in New Issue
Block a user