Phase 9: Add native processors and reproducible Linux release tooling
This commit is contained in:
parent
7db5fb7738
commit
de403b37d7
43 changed files with 1656 additions and 19 deletions
|
|
@ -2,15 +2,12 @@
|
|||
#define XTC_H
|
||||
|
||||
#include "xtc_types.h"
|
||||
#include "xtc_version.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define XTC_VERSION_MAJOR 0
|
||||
#define XTC_VERSION_MINOR 1
|
||||
#define XTC_VERSION_PATCH 0
|
||||
|
||||
typedef struct xtc_app xtc_app;
|
||||
|
||||
/* Creates an application context. On success, *out_app is caller-owned. */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ typedef enum {
|
|||
XTC_NODE_METER,
|
||||
XTC_NODE_OUTPUT,
|
||||
XTC_NODE_AUDIO, /* Timeline mix source, output only. */
|
||||
XTC_NODE_INSTRUMENT /* Internal MIDI instrument, output only. */
|
||||
XTC_NODE_INSTRUMENT, /* Internal MIDI instrument, output only. */
|
||||
XTC_NODE_NATIVE /* Trusted source/effect; see xtc_native.h. */
|
||||
} xtc_node_type;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
56
include/xtc/xtc_native.h
Normal file
56
include/xtc/xtc_native.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef XTC_NATIVE_H
|
||||
#define XTC_NATIVE_H
|
||||
#include "xtc_midi.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define XTC_NATIVE_ABI_VERSION 1U
|
||||
#define XTC_NATIVE_ID_BYTES 64U
|
||||
typedef enum { XTC_NATIVE_EFFECT = 1, XTC_NATIVE_SOURCE, XTC_NATIVE_INSTRUMENT } xtc_native_kind;
|
||||
typedef struct {
|
||||
const float *input; /* NULL is silence; may equal output. Borrowed for call. */
|
||||
float *output; /* Write every frame, including silence. */
|
||||
size_t frames;
|
||||
uint64_t position; /* Absolute sample position, no wall clock. */
|
||||
const xtc_midi_event *events; /* Instruments only, sorted block offsets. */
|
||||
size_t event_count;
|
||||
} xtc_native_block;
|
||||
typedef struct {
|
||||
unsigned int abi_version;
|
||||
size_t struct_size; /* Must equal sizeof(xtc_native_descriptor) for ABI 1. */
|
||||
char identifier[XTC_NATIVE_ID_BYTES]; /* Nonempty printable ASCII, terminated. */
|
||||
xtc_native_kind kind;
|
||||
/* Control thread. On error, any non-NULL *state is destroyed by host. */
|
||||
xtc_result (*prepare)(double sample_rate, size_t max_frames, float parameter, void **state);
|
||||
/* Single audio owner (or stopped). No allocation/free, I/O, locks or GUI. */
|
||||
void (*reset)(void *state);
|
||||
xtc_result (*process)(void *state, const xtc_native_block *block);
|
||||
/* Control thread after quiescence; must accept NULL. */
|
||||
void (*destroy)(void *state);
|
||||
} xtc_native_descriptor;
|
||||
typedef struct xtc_native xtc_native;
|
||||
/* Descriptors are copied; callback code must remain loaded through destruction.
|
||||
* Trusted statically linked C code, not a sandbox or stable shared-library ABI. */
|
||||
xtc_result xtc_native_validate(const xtc_native_descriptor *);
|
||||
xtc_result xtc_native_create(const xtc_native_descriptor *, double rate, size_t max_frames,
|
||||
float parameter, xtc_native **out_processor);
|
||||
void xtc_native_destroy(xtc_native *);
|
||||
void xtc_native_reset(xtc_native *);
|
||||
/* Bounded, single-owner, realtime-safe host path (callbacks must obey contract).
|
||||
* Invalid arguments leave state/output unchanged. Zero frames is a no-op.
|
||||
* Discontinuity resets before processing. Callback failure silences this block
|
||||
* and resets the processor. Successful nonfinite output samples become zero. */
|
||||
xtc_result xtc_native_process(xtc_native *, const xtc_native_block *);
|
||||
/* Graph accepts effects/sources; creates independent L/R instances on compile.
|
||||
* For instruments, process events explicitly then feed the existing instrument
|
||||
* source buffer through xtc_plan_process_sources/stereo. Graph add returns
|
||||
* UNSUPPORTED for instrument descriptors (no event port in current topology).
|
||||
* Native graphs are session-only: project save returns UNSUPPORTED. */
|
||||
xtc_result xtc_graph_add_native(xtc_graph *, const xtc_native_descriptor *, float parameter,
|
||||
size_t *out_id);
|
||||
xtc_result xtc_graph_get_native(const xtc_graph *, size_t node_id,
|
||||
xtc_native_descriptor *out_descriptor);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef XTC_VERSION_H
|
||||
#define XTC_VERSION_H
|
||||
|
||||
#define XTC_VERSION_MAJOR 0
|
||||
#define XTC_VERSION_MINOR 1
|
||||
#define XTC_VERSION_PATCH 0
|
||||
#define XTC_VERSION_STRING "0.1.0"
|
||||
#define XTC_PROJECT_NAME "xtc"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue