xtc/include/xtc/xtc_control.h

40 lines
2.3 KiB
C

#ifndef XTC_CONTROL_H
#define XTC_CONTROL_H
#include "xtc_mixer.h"
#include "xtc_plugin.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Stable owner ID + parameter ID, never a dense list index or pointer.
* TRACK includes mix buses: parameters 0 gain / 1 pan.
* PLUGIN owner is a graph node; parameter is its actual LADSPA port.
* LIVE owner is MIDI channel 0..15; parameters 0 volume / 1 pan / 2 sustain.
* Live metadata describes reset defaults, not callback-owned current values. */
typedef enum { XTC_PARAMETER_TRACK = 1, XTC_PARAMETER_PLUGIN, XTC_PARAMETER_LIVE } xtc_parameter_kind;
typedef struct { xtc_parameter_kind kind; uint64_t owner; unsigned int parameter; } xtc_parameter_key;
typedef struct {
xtc_parameter_info info;
unsigned int flags; /* XTC_PLUGIN_* hint flags; units empty if unspecified. */
float value; /* Static configuration; automation may override it. */
int automated;
} xtc_parameter_state;
/* Control thread only. Plugin metadata executes trusted module discovery.
* Failure leaves output/model unchanged. Setter changes static configuration,
* never erases a lane. Compile/publish snapshots before callback use. */
xtc_result xtc_project_parameter(const xtc_project *project, xtc_parameter_key key, double rate, xtc_parameter_state *out);
xtc_result xtc_project_set_parameter(xtc_project *project, xtc_parameter_key key, double rate, float value);
/* Absolute ticks; step 0 linear / 1 hold for segment starting at this point.
* Integer/toggle plugin controls require hold. Live automation is unsupported.
* Remove ignores value/step and fails NOT_FOUND when no point exists. */
xtc_result xtc_project_automate(xtc_project *project, xtc_parameter_key key, double rate,
uint64_t tick, unsigned int step, float value, int remove);
#define XTC_CC_DISABLED 128U
/* Per-channel bindings in order volume, pan, sustain. Defaults 7,10,64.
* Enabled controllers must be distinct and <=127; 120/123 are reserved panic.
* No learn/capture. Copied into MIDI plans; never read from model in callback. */
xtc_result xtc_project_get_control_map(const xtc_project *project, unsigned int channel, unsigned int out[3]);
xtc_result xtc_project_set_control_map(xtc_project *project, unsigned int channel, const unsigned int controllers[3]);
#ifdef __cplusplus
}
#endif
#endif