From 57006d3bf443f2ade18abe7021f8aa8a11b08bcb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 22 Nov 2024 19:12:33 -0500 Subject: Cleanly separate audio thread from the rest of the application --- src/jalv.h | 72 ++++++++++++++++++++++++-------------------------------------- 1 file changed, 28 insertions(+), 44 deletions(-) (limited to 'src/jalv.h') diff --git a/src/jalv.h b/src/jalv.h index 07e24e8..518f94d 100644 --- a/src/jalv.h +++ b/src/jalv.h @@ -14,10 +14,10 @@ #include "nodes.h" #include "options.h" #include "port.h" +#include "process.h" #include "settings.h" #include "types.h" #include "urids.h" -#include "worker.h" #if USE_SUIL # include @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -39,52 +38,37 @@ JALV_BEGIN_DECLS /// Internal application state struct JalvImpl { - JalvOptions opts; ///< Command-line options - LilvWorld* world; ///< Lilv World - JalvMapper* mapper; ///< URI mapper/unmapper - JalvURIDs urids; ///< URIDs - JalvNodes nodes; ///< Nodes - JalvLog log; ///< Log for error/warning/debug messages - LV2_Atom_Forge forge; ///< Atom forge - JalvDumper* dumper; ///< Atom dumper (console debug output) - JalvBackend* backend; ///< Audio system backend - JalvSettings settings; ///< Processing settings - ZixRing* ui_to_plugin; ///< Port events from UI - ZixRing* plugin_to_ui; ///< Port events from plugin - void* audio_msg; ///< Buffer for messages in the audio thread - void* ui_msg; ///< Buffer for messages in the UI thread - JalvWorker* worker; ///< Worker thread implementation - JalvWorker* state_worker; ///< Synchronous worker for state restore - ZixSem work_lock; ///< Lock for plugin work() method - ZixSem done; ///< Exit semaphore - ZixSem paused; ///< Paused signal from process thread - JalvRunState run_state; ///< Current process thread run state - char* temp_dir; ///< Temporary plugin state directory - char* save_dir; ///< Plugin save directory - const LilvPlugin* plugin; ///< Plugin class (RDF data) - LilvState* preset; ///< Current preset - LilvUIs* uis; ///< All plugin UIs (RDF data) - const LilvUI* ui; ///< Plugin UI (RDF data) - const LilvNode* ui_type; ///< Plugin UI type (unwrapped) - LilvInstance* instance; ///< Plugin instance (shared library) + JalvOptions opts; ///< Command-line options + LilvWorld* world; ///< Lilv World + JalvMapper* mapper; ///< URI mapper/unmapper + JalvURIDs urids; ///< URIDs + JalvNodes nodes; ///< Nodes + JalvLog log; ///< Log for error/warning/debug messages + LV2_Atom_Forge forge; ///< Atom forge + JalvDumper* dumper; ///< Atom dumper (console debug output) + JalvBackend* backend; ///< Audio system backend + JalvSettings settings; ///< Processing settings + void* ui_msg; ///< Buffer for messages in the UI thread + ZixSem work_lock; ///< Lock for plugin work() method + ZixSem done; ///< Exit semaphore + char* temp_dir; ///< Temporary plugin state directory + char* save_dir; ///< Plugin save directory + const LilvPlugin* plugin; ///< Plugin class (RDF data) + LilvState* preset; ///< Current preset + LilvUIs* uis; ///< All plugin UIs (RDF data) + const LilvUI* ui; ///< Plugin UI (RDF data) + const LilvNode* ui_type; ///< Plugin UI type (unwrapped) + JalvProcess process; ///< Process thread state #if USE_SUIL SuilHost* ui_host; ///< Plugin UI host support SuilInstance* ui_instance; ///< Plugin UI instance (shared library) #endif - void* window; ///< Window (if applicable) - JalvPort* ports; ///< Port array of size num_ports - Controls controls; ///< Available plugin controls - float* controls_buf; ///< Control port buffers array - size_t msg_buf_size; ///< Maximum size of a single message - uint32_t control_in; ///< Index of control input port - uint32_t num_ports; ///< Total number of ports on the plugin - uint32_t plugin_latency; ///< Latency reported by plugin (if any) - uint32_t event_delta_t; ///< Frames since last update sent to UI - uint32_t position; ///< Transport position in frames - float bpm; ///< Transport tempo in beats per minute - bool rolling; ///< Transport speed (0=stop, 1=play) - bool has_ui; ///< True iff a control UI is present - bool safe_restore; ///< Plugin restore() is thread-safe + void* window; ///< Window (if applicable) + JalvPort* ports; ///< Port array of size num_ports + Controls controls; ///< Available plugin controls + size_t ui_msg_size; ///< Maximum size of a single message + uint32_t num_ports; ///< Total number of ports on the plugin + bool safe_restore; ///< Plugin restore() is thread-safe JalvFeatures features; const LV2_Feature** feature_list; }; -- cgit v1.2.1