mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Add noexcept qualifications on the plugin side
See the last few commits.
This commit is contained in:
@@ -105,7 +105,7 @@ class PluginBridge {
|
||||
io_context.run();
|
||||
}) {}
|
||||
|
||||
virtual ~PluginBridge(){};
|
||||
virtual ~PluginBridge() noexcept {};
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ float get_parameter_proxy(AEffect*, int);
|
||||
* is sadly needed as a workaround to avoid using globals since we need free
|
||||
* function pointers to interface with the VST C API.
|
||||
*/
|
||||
Vst2PluginBridge& get_bridge_instance(const AEffect& plugin) {
|
||||
Vst2PluginBridge& get_bridge_instance(const AEffect& plugin) noexcept {
|
||||
return *static_cast<Vst2PluginBridge*>(plugin.ptr3);
|
||||
}
|
||||
|
||||
@@ -168,20 +168,26 @@ Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback)
|
||||
update_aeffect(plugin, initialized_plugin);
|
||||
}
|
||||
|
||||
Vst2PluginBridge::~Vst2PluginBridge() {
|
||||
// Drop all work make sure all sockets are closed
|
||||
plugin_host->terminate();
|
||||
Vst2PluginBridge::~Vst2PluginBridge() noexcept {
|
||||
try {
|
||||
// Drop all work make sure all sockets are closed
|
||||
plugin_host->terminate();
|
||||
|
||||
// The `stop()` method will cause the IO context to just drop all of its
|
||||
// outstanding work immediately
|
||||
io_context.stop();
|
||||
// The `stop()` method will cause the IO context to just drop all of its
|
||||
// outstanding work immediately
|
||||
io_context.stop();
|
||||
} catch (const boost::system::system_error&) {
|
||||
// It could be that the sockets have already been closed or that the
|
||||
// process has already exited (at which point we probably won't be
|
||||
// executing this, but maybe if all the stars align)
|
||||
}
|
||||
}
|
||||
|
||||
class DispatchDataConverter : DefaultDataConverter {
|
||||
public:
|
||||
DispatchDataConverter(std::vector<uint8_t>& chunk_data,
|
||||
AEffect& plugin,
|
||||
VstRect& editor_rectangle)
|
||||
VstRect& editor_rectangle) noexcept
|
||||
: chunk(chunk_data), plugin(plugin), rect(editor_rectangle) {}
|
||||
|
||||
EventPayload read(const int opcode,
|
||||
|
||||
@@ -52,7 +52,7 @@ class Vst2PluginBridge : PluginBridge<Vst2Sockets<std::jthread>> {
|
||||
* Terminate the Wine plugin host process and drop all work when the module
|
||||
* gets unloaded.
|
||||
*/
|
||||
~Vst2PluginBridge();
|
||||
~Vst2PluginBridge() noexcept override;
|
||||
|
||||
// The four below functions are the handlers from the VST2 API. They are
|
||||
// called through proxy functions in `plugin.cpp`.
|
||||
|
||||
@@ -363,10 +363,16 @@ Vst3PluginBridge::Vst3PluginBridge()
|
||||
});
|
||||
}
|
||||
|
||||
Vst3PluginBridge::~Vst3PluginBridge() {
|
||||
// Drop all work make sure all sockets are closed
|
||||
plugin_host->terminate();
|
||||
io_context.stop();
|
||||
Vst3PluginBridge::~Vst3PluginBridge() noexcept {
|
||||
try {
|
||||
// Drop all work make sure all sockets are closed
|
||||
plugin_host->terminate();
|
||||
io_context.stop();
|
||||
} catch (const boost::system::system_error&) {
|
||||
// It could be that the sockets have already been closed or that the
|
||||
// process has already exited (at which point we probably won't be
|
||||
// executing this, but maybe if all the stars align)
|
||||
}
|
||||
}
|
||||
|
||||
Steinberg::IPluginFactory* Vst3PluginBridge::get_plugin_factory() {
|
||||
|
||||
@@ -53,13 +53,13 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
* @throw std::runtime_error Thrown when the Wine plugin host could not be
|
||||
* found, or if it could not locate and load a VST3 module.
|
||||
*/
|
||||
Vst3PluginBridge();
|
||||
explicit Vst3PluginBridge();
|
||||
|
||||
/**
|
||||
* Terminate the Wine plugin host process and drop all work when the module
|
||||
* gets unloaded.
|
||||
*/
|
||||
~Vst3PluginBridge();
|
||||
~Vst3PluginBridge() noexcept;
|
||||
|
||||
/**
|
||||
* When the host loads the module it will call `GetPluginFactory()` which
|
||||
|
||||
@@ -64,6 +64,8 @@ HostProcess::HostProcess(boost::asio::io_context& io_context,
|
||||
logger.async_log_pipe_lines(stderr_pipe, stderr_buffer, "[Wine STDERR] ");
|
||||
}
|
||||
|
||||
HostProcess::~HostProcess() noexcept {}
|
||||
|
||||
IndividualHost::IndividualHost(boost::asio::io_context& io_context,
|
||||
Logger& logger,
|
||||
const PluginInfo& plugin_info,
|
||||
@@ -108,7 +110,7 @@ fs::path IndividualHost::path() {
|
||||
return host_path;
|
||||
}
|
||||
|
||||
bool IndividualHost::running() {
|
||||
bool IndividualHost::running() noexcept {
|
||||
return host.running();
|
||||
}
|
||||
|
||||
@@ -219,7 +221,7 @@ fs::path GroupHost::path() {
|
||||
return host_path;
|
||||
}
|
||||
|
||||
bool GroupHost::running() {
|
||||
bool GroupHost::running() noexcept {
|
||||
// When we are unable to connect to a new or existing group host process,
|
||||
// then we'll consider the startup failed and we'll allow the initialization
|
||||
// process to terminate.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
*/
|
||||
class HostProcess {
|
||||
public:
|
||||
virtual ~HostProcess(){};
|
||||
virtual ~HostProcess() noexcept;
|
||||
|
||||
/**
|
||||
* Return the full path to the host application in use. The host application
|
||||
@@ -53,7 +53,7 @@ class HostProcess {
|
||||
* Return true if the host process is still running. Used during startup to
|
||||
* abort connecting to sockets if the Wine process has crashed.
|
||||
*/
|
||||
virtual bool running() = 0;
|
||||
virtual bool running() noexcept = 0;
|
||||
|
||||
/**
|
||||
* Kill the process or cause the plugin that's being hosted to exit.
|
||||
@@ -133,7 +133,7 @@ class IndividualHost : public HostProcess {
|
||||
Sockets& sockets);
|
||||
|
||||
boost::filesystem::path path() override;
|
||||
bool running() override;
|
||||
bool running() noexcept override;
|
||||
void terminate() override;
|
||||
|
||||
private:
|
||||
@@ -180,7 +180,7 @@ class GroupHost : public HostProcess {
|
||||
std::string group_name);
|
||||
|
||||
boost::filesystem::path path() override;
|
||||
bool running() override;
|
||||
bool running() noexcept override;
|
||||
void terminate() override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user