feat(midi): add device routing and bounded external note output (phase 101)

This commit is contained in:
Johannes Findeisen 2026-11-06 02:23:37 +01:00
commit 75dee16b6a
9 changed files with 251 additions and 15 deletions

View file

@ -21,6 +21,7 @@ typedef struct {
} xtc_meter_snapshot;
typedef struct xtc_backend xtc_backend;
typedef int (*xtc_backend_port_visitor)(const char *name, void *context);
typedef enum {
XTC_BACKEND_JACK = 1
@ -157,6 +158,16 @@ xtc_result xtc_backend_panic(xtc_backend *backend);
* @return XTC_OK on success, or an error code describing the failure.
*/
xtc_result xtc_backend_midi_port_name(const xtc_backend *backend, const char **out_name);
/* MIDI counterparts. direction is local for naming/routing, remote for visiting.
* Routing requires an active backend. No server starts or implicit device routes.
* Port names are JACK/PipeWire names; physical ALSA devices need host exposure. */
xtc_result xtc_backend_midi_name(const xtc_backend *,xtc_port_direction,const char **);
xtc_result xtc_backend_visit_midi_ports(xtc_backend *,xtc_port_direction,xtc_backend_port_visitor,void *);
xtc_result xtc_backend_route_midi(xtc_backend *,xtc_port_direction,const char *,int disconnect);
/* Stopped only. Input channel/output channel -1 preserves all/original channels,
* otherwise 0..15. thru=1 forwards supported live messages to MIDI output. */
xtc_result xtc_backend_set_midi_options(xtc_backend *,int input_channel,int output_channel,int thru);
/**
* @brief Attaches or detaches a borrowed recorder while the backend is stopped.
*
@ -210,7 +221,7 @@ xtc_result xtc_backend_port_name(const xtc_backend *backend, xtc_port_direction
* @param context Opaque pointer supplied to xtc_backend_visit_ports().
* @return Nonzero to stop enumeration, zero to continue.
*/
typedef int (*xtc_backend_port_visitor)(const char *name, void *context);
/**
* @brief Visits available audio ports matching the requested direction until the visitor stops.
*