mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-13 20:09:59 +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
|
||||
|
||||
Reference in New Issue
Block a user