From 5bbc72296d650cca75b0344efcae4658a14c9c62 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 18 Nov 2024 17:51:58 -0500 Subject: Rename jalv_internal.h to jalv.h The "internal" name never made much sense to begin with (since this is a program, not a library), but now this header only describes the "main" Jalv struct and functions directly associated with it (the top-level interface of the application), so name it accordingly. This also makes include-what-you-use actually check this header, which it wasn't before for some mysterious reason. --- src/jack.c | 2 +- src/jalv.c | 3 +- src/jalv.h | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/jalv_console.c | 2 +- src/jalv_gtk.c | 2 +- src/jalv_internal.h | 142 ---------------------------------------------------- src/jalv_qt.cpp | 2 +- src/main.c | 2 +- src/portaudio.c | 2 +- src/process.c | 2 +- src/state.c | 2 +- 11 files changed, 152 insertions(+), 151 deletions(-) create mode 100644 src/jalv.h delete mode 100644 src/jalv_internal.h (limited to 'src') diff --git a/src/jack.c b/src/jack.c index 3a0ca2a..b71b060 100644 --- a/src/jack.c +++ b/src/jack.c @@ -5,8 +5,8 @@ #include "comm.h" #include "frontend.h" +#include "jalv.h" #include "jalv_config.h" -#include "jalv_internal.h" #include "log.h" #include "lv2_evbuf.h" #include "port.h" diff --git a/src/jalv.c b/src/jalv.c index 1127586..24b41ab 100644 --- a/src/jalv.c +++ b/src/jalv.c @@ -1,13 +1,14 @@ // Copyright 2007-2022 David Robillard // SPDX-License-Identifier: ISC +#include "jalv.h" + #include "backend.h" #include "comm.h" #include "control.h" #include "dumper.h" #include "frontend.h" #include "jalv_config.h" -#include "jalv_internal.h" #include "log.h" #include "lv2_evbuf.h" #include "macros.h" diff --git a/src/jalv.h b/src/jalv.h new file mode 100644 index 0000000..e4d7d90 --- /dev/null +++ b/src/jalv.h @@ -0,0 +1,142 @@ +// Copyright 2007-2022 David Robillard +// SPDX-License-Identifier: ISC + +#ifndef JALV_JALV_H +#define JALV_JALV_H + +#include "attributes.h" +#include "control.h" +#include "dumper.h" +#include "features.h" +#include "jalv_config.h" +#include "log.h" +#include "mapper.h" +#include "nodes.h" +#include "options.h" +#include "port.h" +#include "types.h" +#include "urids.h" +#include "worker.h" + +#if USE_SUIL +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +// "Shared" internal application declarations +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 + 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) +#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 + uint32_t block_length; ///< Audio buffer size (block length) + size_t midi_buf_size; ///< Size of MIDI port buffers + 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) + float ui_update_hz; ///< Frequency of UI updates + float ui_scale_factor; ///< UI scale factor + float sample_rate; ///< Sample rate + 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 buf_size_set; ///< True iff buffer size callback fired + bool has_ui; ///< True iff a control UI is present + bool safe_restore; ///< Plugin restore() is thread-safe + JalvFeatures features; + const LV2_Feature** feature_list; +}; + +/// Load the plugin and set up the application +int +jalv_open(Jalv* jalv, int* argc, char*** argv); + +/// Shut down the application (counterpart to jalv_open) +int +jalv_close(Jalv* jalv); + +/// Activate audio processing +int +jalv_activate(Jalv* jalv); + +/// Deactivate audio processing +int +jalv_deactivate(Jalv* jalv); + +/// Allocate appropriately-sized port buffers and connect the plugin to them +void +jalv_allocate_port_buffers(Jalv* jalv); + +/// Find a port by symbol +JalvPort* +jalv_port_by_symbol(Jalv* jalv, const char* sym); + +/// Set a control to the given value +void +jalv_set_control(Jalv* jalv, + const ControlID* control, + uint32_t size, + LV2_URID type, + const void* body); + +/// Request and/or set initial control values to initialize the UI +void +jalv_init_ui(Jalv* jalv); + +/// Instantiate the UI instance using suil if available +void +jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent); + +/// Periodically update user interface +int +jalv_update(Jalv* jalv); + +JALV_END_DECLS + +#endif // JALV_JALV_H diff --git a/src/jalv_console.c b/src/jalv_console.c index 7219c87..0ea85b1 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -3,8 +3,8 @@ #include "control.h" #include "frontend.h" +#include "jalv.h" #include "jalv_config.h" -#include "jalv_internal.h" #include "log.h" #include "options.h" #include "port.h" diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index c9672dd..15d43bb 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -3,7 +3,7 @@ #include "control.h" #include "frontend.h" -#include "jalv_internal.h" +#include "jalv.h" #include "log.h" #include "options.h" #include "query.h" diff --git a/src/jalv_internal.h b/src/jalv_internal.h deleted file mode 100644 index 9ac458e..0000000 --- a/src/jalv_internal.h +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2007-2022 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef JALV_INTERNAL_H -#define JALV_INTERNAL_H - -#include "attributes.h" -#include "control.h" -#include "dumper.h" -#include "features.h" -#include "jalv_config.h" -#include "log.h" -#include "mapper.h" -#include "nodes.h" -#include "options.h" -#include "port.h" -#include "types.h" -#include "urids.h" -#include "worker.h" - -#if USE_SUIL -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// "Shared" internal application declarations -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 - 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) -#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 - uint32_t block_length; ///< Audio buffer size (block length) - size_t midi_buf_size; ///< Size of MIDI port buffers - 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) - float ui_update_hz; ///< Frequency of UI updates - float ui_scale_factor; ///< UI scale factor - float sample_rate; ///< Sample rate - 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 buf_size_set; ///< True iff buffer size callback fired - bool has_ui; ///< True iff a control UI is present - bool safe_restore; ///< Plugin restore() is thread-safe - JalvFeatures features; - const LV2_Feature** feature_list; -}; - -/// Load the plugin and set up the application -int -jalv_open(Jalv* jalv, int* argc, char*** argv); - -/// Shut down the application (counterpart to jalv_open) -int -jalv_close(Jalv* jalv); - -/// Activate audio processing -int -jalv_activate(Jalv* jalv); - -/// Deactivate audio processing -int -jalv_deactivate(Jalv* jalv); - -/// Allocate appropriately-sized port buffers and connect the plugin to them -void -jalv_allocate_port_buffers(Jalv* jalv); - -/// Find a port by symbol -JalvPort* -jalv_port_by_symbol(Jalv* jalv, const char* sym); - -/// Set a control to the given value -void -jalv_set_control(Jalv* jalv, - const ControlID* control, - uint32_t size, - LV2_URID type, - const void* body); - -/// Request and/or set initial control values to initialize the UI -void -jalv_init_ui(Jalv* jalv); - -/// Instantiate the UI instance using suil if available -void -jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent); - -/// Periodically update user interface -int -jalv_update(Jalv* jalv); - -JALV_END_DECLS - -#endif // JALV_INTERNAL_H diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index a84c089..24b4ce6 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -3,7 +3,7 @@ #include "jalv_qt.hpp" #include "frontend.h" -#include "jalv_internal.h" +#include "jalv.h" #include "nodes.h" #include "options.h" #include "port.h" diff --git a/src/main.c b/src/main.c index 32950bd..cf88af2 100644 --- a/src/main.c +++ b/src/main.c @@ -3,8 +3,8 @@ #include "backend.h" #include "frontend.h" +#include "jalv.h" #include "jalv_config.h" -#include "jalv_internal.h" #include "types.h" #include diff --git a/src/portaudio.c b/src/portaudio.c index e6f7f70..540e138 100644 --- a/src/portaudio.c +++ b/src/portaudio.c @@ -3,7 +3,7 @@ #include "backend.h" #include "comm.h" -#include "jalv_internal.h" +#include "jalv.h" #include "log.h" #include "lv2_evbuf.h" #include "port.h" diff --git a/src/process.c b/src/process.c index 3598589..2f88316 100644 --- a/src/process.c +++ b/src/process.c @@ -4,7 +4,7 @@ #include "process.h" #include "comm.h" -#include "jalv_internal.h" +#include "jalv.h" #include "log.h" #include "lv2_evbuf.h" #include "port.h" diff --git a/src/state.c b/src/state.c index 327cb1d..b0ba53b 100644 --- a/src/state.c +++ b/src/state.c @@ -4,7 +4,7 @@ #include "state.h" #include "comm.h" -#include "jalv_internal.h" +#include "jalv.h" #include "log.h" #include "mapper.h" #include "port.h" -- cgit v1.2.1