diff options
author | David Robillard <d@drobilla.net> | 2022-05-30 19:19:58 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-17 13:50:24 -0400 |
commit | 67cac5bf9eed6cfd1afc6cbb67784779387b50d8 (patch) | |
tree | e7c61543941fec8d562284f7836064eef7ac4427 /src | |
parent | 7e1d058d3d305bb7baa413d85447b9d7955c6ec3 (diff) | |
download | jalv-67cac5bf9eed6cfd1afc6cbb67784779387b50d8.tar.gz jalv-67cac5bf9eed6cfd1afc6cbb67784779387b50d8.tar.bz2 jalv-67cac5bf9eed6cfd1afc6cbb67784779387b50d8.zip |
Move control-related type definitions to control.h
Diffstat (limited to 'src')
-rw-r--r-- | src/control.c | 2 | ||||
-rw-r--r-- | src/control.h | 56 | ||||
-rw-r--r-- | src/jack.c | 1 | ||||
-rw-r--r-- | src/jalv_console.c | 1 | ||||
-rw-r--r-- | src/jalv_internal.h | 53 | ||||
-rw-r--r-- | src/state.c | 1 |
6 files changed, 59 insertions, 55 deletions
diff --git a/src/control.c b/src/control.c index a75d999..3624d5c 100644 --- a/src/control.c +++ b/src/control.c @@ -5,8 +5,6 @@ #include "control.h" -#include "jalv_internal.h" - #include "lilv/lilv.h" #include "lv2/atom/atom.h" #include "lv2/atom/forge.h" diff --git a/src/control.h b/src/control.h index 037ef31..e638d10 100644 --- a/src/control.h +++ b/src/control.h @@ -4,13 +4,14 @@ #ifndef JALV_CONTROL_H #define JALV_CONTROL_H -#include "jalv_internal.h" #include "nodes.h" #include "lilv/lilv.h" #include "lv2/atom/forge.h" #include "lv2/urid/urid.h" +#include <stdbool.h> +#include <stddef.h> #include <stdint.h> #ifdef __cplusplus @@ -19,10 +20,62 @@ extern "C" { // Plugin control utilities +/// Type of plugin control +typedef enum { + PORT, ///< Control port + PROPERTY ///< Property (set via atom message) +} ControlType; + +// "Interesting" value in a control's value range +typedef struct { + float value; + char* label; +} ScalePoint; + +/// Plugin control +typedef struct { + ControlType type; ///< Type of control + LilvNode* node; ///< Port or property + LilvNode* symbol; ///< Symbol + LilvNode* label; ///< Human readable label + LV2_Atom_Forge* forge; ///< Forge (for URIDs) + LV2_URID property; ///< Iff type == PROPERTY + uint32_t index; ///< Iff type == PORT + LilvNode* group; ///< Port/control group, or NULL + void* widget; ///< Control Widget + size_t n_points; ///< Number of scale points + ScalePoint* points; ///< Scale points + LV2_URID value_type; ///< Type of control value + LilvNode* min; ///< Minimum value + LilvNode* max; ///< Maximum value + LilvNode* def; ///< Default value + bool is_toggle; ///< Boolean (0 and 1 only) + bool is_integer; ///< Integer values only + bool is_enumeration; ///< Point values only + bool is_logarithmic; ///< Logarithmic scale + bool is_writable; ///< Writable (input) + bool is_readable; ///< Readable (output) +} ControlID; + +/// Set of plugin controls +typedef struct { + size_t n_controls; + ControlID** controls; +} Controls; + +/// Control change event, sent through ring buffers for UI updates +typedef struct { + uint32_t index; + uint32_t protocol; + uint32_t size; + // Followed immediately by size bytes of data +} ControlChange; + /// Order scale points by value int scale_point_cmp(const ScalePoint* a, const ScalePoint* b); +/// Create a new ID for a control port ControlID* new_port_control(LilvWorld* world, const LilvPlugin* plugin, @@ -32,6 +85,7 @@ new_port_control(LilvWorld* world, const JalvNodes* nodes, LV2_Atom_Forge* forge); +/// Create a new ID for a property-based parameter ControlID* new_property_control(LilvWorld* world, const LilvNode* property, @@ -3,6 +3,7 @@ #include "backend.h" +#include "control.h" #include "frontend.h" #include "jalv_config.h" #include "jalv_internal.h" diff --git a/src/jalv_console.c b/src/jalv_console.c index 1460668..233f530 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -6,6 +6,7 @@ #define _BSD_SOURCE 1 #define _DEFAULT_SOURCE 1 +#include "control.h" #include "frontend.h" #include "jalv_config.h" #include "jalv_internal.h" diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 989b6cb..9230d43 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -4,6 +4,7 @@ #ifndef JALV_INTERNAL_H #define JALV_INTERNAL_H +#include "control.h" #include "jalv_config.h" #include "lv2_evbuf.h" #include "nodes.h" @@ -67,58 +68,6 @@ struct Port { float control; ///< For control ports, otherwise 0.0f }; -// Controls - -/// Type of plugin control -typedef enum { - PORT, ///< Control port - PROPERTY ///< Property (set via atom message) -} ControlType; - -typedef struct { - float value; - char* label; -} ScalePoint; - -/// Plugin control -typedef struct { - ControlType type; ///< Type of control - LilvNode* node; ///< Port or property - LilvNode* symbol; ///< Symbol - LilvNode* label; ///< Human readable label - LV2_Atom_Forge* forge; ///< Forge (for URIDs) - LV2_URID property; ///< Iff type == PROPERTY - uint32_t index; ///< Iff type == PORT - LilvNode* group; ///< Port/control group, or NULL - void* widget; ///< Control Widget - size_t n_points; ///< Number of scale points - ScalePoint* points; ///< Scale points - LV2_URID value_type; ///< Type of control value - LilvNode* min; ///< Minimum value - LilvNode* max; ///< Maximum value - LilvNode* def; ///< Default value - bool is_toggle; ///< Boolean (0 and 1 only) - bool is_integer; ///< Integer values only - bool is_enumeration; ///< Point values only - bool is_logarithmic; ///< Logarithmic scale - bool is_writable; ///< Writable (input) - bool is_readable; ///< Readable (output) -} ControlID; - -typedef struct { - size_t n_controls; - ControlID** controls; -} Controls; - -/// Control change event, sent through ring buffers for UI updates -typedef struct { - uint32_t index; - uint32_t protocol; - uint32_t size; - - // Followed immediately by size bytes of data -} ControlChange; - typedef struct { char* name; ///< Client name int name_exact; ///< Exit if name is taken diff --git a/src/state.c b/src/state.c index ab06c23..344e53d 100644 --- a/src/state.c +++ b/src/state.c @@ -3,6 +3,7 @@ #include "state.h" +#include "control.h" #include "jalv_internal.h" #include "log.h" #include "nodes.h" |