mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 20:40:11 +02:00
Rename the two handle_dispatch functions
To better differentiate between their intended uses.
This commit is contained in:
@@ -127,9 +127,9 @@ Vst2Bridge::Vst2Bridge(std::string plugin_dll_path,
|
||||
// `audioMasterIOChanged` host callback.
|
||||
write_object(host_vst_dispatch, EventResult{0, *plugin, std::nullopt});
|
||||
|
||||
// This works functionally identically to the `handle_dispatch()` function
|
||||
// below, but this socket will only handle MIDI events. This is needed
|
||||
// because of Win32 API limitations.
|
||||
// This works functionally identically to the `handle_dispatch_single()`
|
||||
// function below, but this socket will only handle MIDI events. This is
|
||||
// needed because of Win32 API limitations.
|
||||
dispatch_midi_events_handler =
|
||||
Win32Thread(handle_dispatch_midi_events_proxy, this);
|
||||
|
||||
@@ -139,7 +139,7 @@ Vst2Bridge::Vst2Bridge(std::string plugin_dll_path,
|
||||
Win32Thread(handle_process_replacing_proxy, this);
|
||||
}
|
||||
|
||||
void Vst2Bridge::handle_dispatch() {
|
||||
void Vst2Bridge::handle_dispatch_single() {
|
||||
using namespace std::placeholders;
|
||||
|
||||
// For our communication we use simple threads and blocking operations
|
||||
|
||||
@@ -51,13 +51,13 @@ struct EditorOpening {};
|
||||
* @remark Because of Win32 API limitations, all window handling has to be done
|
||||
* from the same thread. For individually hosted plugins this only means that
|
||||
* this class has to be initialized from the same thread as the one that calls
|
||||
* `handle_dispatch()`, and thus also runs the message loop. When using plugin
|
||||
* groups, however, all instantiation, editor event handling and message loop
|
||||
* pumping has to be done from a single thread. Most plugins won't have any
|
||||
* issues when using multiple message loops, but the Melda plugins for
|
||||
* instance will only update their GUIs from the message loop of the thread
|
||||
* that created the first instance. When running multiple plugins
|
||||
* `handle_dispatch(io_context)` should be used to make sure all plugins
|
||||
* `handle_dispatch_single()`, and thus also runs the message loop. When using
|
||||
* plugin groups, however, all instantiation, editor event handling and
|
||||
* message loop pumping has to be done from a single thread. Most plugins
|
||||
* won't have any issues when using multiple message loops, but the Melda
|
||||
* plugins for instance will only update their GUIs from the message loop of
|
||||
* the thread that created the first instance. When running multiple plugins
|
||||
* `handle_dispatch_multi()` should be used to make sure all plugins
|
||||
* handle their events on the same thread.
|
||||
*/
|
||||
class Vst2Bridge {
|
||||
@@ -71,7 +71,7 @@ class Vst2Bridge {
|
||||
* @param socket_endpoint_path A (Unix style) path to the Unix socket
|
||||
* endpoint the native VST plugin created to communicate over.
|
||||
*
|
||||
* @note When using plugin groups and `handle_dispatch(io_context)`, this
|
||||
* @note When using plugin groups and `handle_dispatch_multi()`, this
|
||||
* object has to be constructed from within the IO context.
|
||||
*
|
||||
* @throw std::runtime_error Thrown when the VST plugin could not be loaded,
|
||||
@@ -85,7 +85,7 @@ class Vst2Bridge {
|
||||
* events to be passed from the same thread it was initiated from. This is
|
||||
* then also the same thread that should handle Win32 GUI events.
|
||||
*/
|
||||
void handle_dispatch();
|
||||
void handle_dispatch_single();
|
||||
|
||||
/**
|
||||
* Handle events just like in the function above, but do the actual
|
||||
@@ -105,8 +105,8 @@ class Vst2Bridge {
|
||||
* instantiated from the same thread as the one that runs the IO context.
|
||||
*/
|
||||
template <typename F = bool()>
|
||||
void handle_dispatch(boost::asio::io_context& main_context,
|
||||
const F& message_loop_blocked) {
|
||||
void handle_dispatch_multi(boost::asio::io_context& main_context,
|
||||
const F& message_loop_blocked) {
|
||||
// This works exactly the same as the function above, but execute the
|
||||
// actual event and run the message loop from the main thread that's
|
||||
// also instantiating these plugins. This is required for a few plugins
|
||||
|
||||
@@ -61,7 +61,7 @@ int __cdecl main(int argc, char* argv[]) {
|
||||
<< std::endl;
|
||||
|
||||
// Blocks the main thread until the plugin shuts down
|
||||
bridge.handle_dispatch();
|
||||
bridge.handle_dispatch_single();
|
||||
} catch (const std::runtime_error& error) {
|
||||
std::cerr << "Error while initializing Wine VST host:" << std::endl;
|
||||
std::cerr << error.what() << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user