Pulp
1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
plugin_main_thread.hpp
Go to the documentation of this file.
1
#pragma once
2
3
// Plugin-mode main-thread cooperation.
4
//
5
// Standalone macOS apps register a Cocoa `MainThreadDispatcher` backend from
6
// `WindowHost::create()` so cross-subsystem work can post to
7
// `dispatch_get_main_queue()`. In plugin mode (AU v3 / VST3 / CLAP loaded
8
// inside a DAW like Logic / Cubase / Bitwig), there is no Pulp window — the DAW
9
// owns the main `NSApplication`/`CFRunLoop`. Without an explicit registration,
10
// `MainThreadDispatcher::call_async` returns false and adapter-side code that
11
// asks "please run this on the host's main thread" no-ops.
12
//
13
// The helpers in this header let format adapters and plugin instance owners
14
// register a process-wide Cocoa backend at instantiation time and unregister
15
// it at teardown. On non-macOS platforms the calls degrade to no-ops so
16
// adapter code can call them unconditionally; the dispatcher then simply
17
// stays in its "no backend" state on those platforms (Windows / Linux own
18
// their own message-loop integration paths).
19
//
20
// Reference-counted under the hood — call register_plugin_backend() once
21
// per loaded plugin instance, and `unregister_plugin_backend()` once on
22
// teardown. The first register installs a backend; subsequent registers bump
23
// the refcount; the last unregister removes the backend. Safe to call from
24
// any thread.
25
26
#include <
pulp/events/main_thread_dispatcher.hpp
>
27
28
namespace
pulp::events
{
29
36
MainThreadDispatcher::Token
register_plugin_backend
();
37
41
bool
unregister_plugin_backend
(
MainThreadDispatcher::Token
token);
42
46
bool
plugin_backend_available
();
47
48
}
// namespace pulp::events
pulp::events::MainThreadDispatcher::Token
std::uint64_t Token
Definition
main_thread_dispatcher.hpp:24
main_thread_dispatcher.hpp
pulp::events
Definition
child_process_manager.hpp:18
pulp::events::register_plugin_backend
MainThreadDispatcher::Token register_plugin_backend()
Register a process-wide Cocoa main-thread backend for plugin-mode use.
pulp::events::unregister_plugin_backend
bool unregister_plugin_backend(MainThreadDispatcher::Token token)
Tear down a backend installed via register_plugin_backend().
pulp::events::plugin_backend_available
bool plugin_backend_available()
Whether the host platform has a plugin-mode backend implementation.
core
events
include
pulp
events
plugin_main_thread.hpp
Generated by
1.15.0