1
0
Fork 0
forked from hanez/xtc

Phase 9: Add native processors and reproducible Linux release tooling

This commit is contained in:
Johannes Findeisen 2026-10-27 01:21:04 +01:00
commit de403b37d7
43 changed files with 1656 additions and 19 deletions

View file

@ -74,7 +74,8 @@ xtc_result xtc_graph_get_port(const xtc_graph *graph, size_t node_id,
node_id = node_index(graph, node_id);
if (node_id == SIZE_MAX) return XTC_ERR_NOT_FOUND;
type = graph->nodes[node_id].type;
if (port_id > 1U || (port_id == 0U && (type == XTC_NODE_OSCILLATOR || type == XTC_NODE_AUDIO || type == XTC_NODE_INSTRUMENT)) ||
if (port_id > 1U || (port_id == 0U && (type == XTC_NODE_OSCILLATOR || type == XTC_NODE_AUDIO || type == XTC_NODE_INSTRUMENT ||
(type == XTC_NODE_NATIVE && graph->nodes[node_id].native.kind != XTC_NATIVE_EFFECT))) ||
(port_id == 1U && type == XTC_NODE_OUTPUT)) return XTC_ERR_NOT_FOUND;
out_port->direction = port_id == 0U ? XTC_PORT_INPUT : XTC_PORT_OUTPUT;
out_port->signal_type = XTC_SIGNAL_AUDIO;
@ -250,3 +251,22 @@ xtc_result xtc_graph_apply_edit(const xtc_graph *source, const xtc_graph_edit *e
*out_graph = graph;
return XTC_OK;
}
xtc_result xtc_graph_add_native(xtc_graph *graph, const xtc_native_descriptor *descriptor, float value, size_t *out)
{
xtc_result result = xtc_native_validate(descriptor);
if (result != XTC_OK) return result;
if (descriptor->kind == XTC_NATIVE_INSTRUMENT) return XTC_ERR_UNSUPPORTED;
result = add_node(graph, XTC_NODE_NATIVE, value, out);
if (result == XTC_OK) graph->nodes[graph->node_count - 1].native = *descriptor;
return result;
}
xtc_result xtc_graph_get_native(const xtc_graph *graph, size_t id, xtc_native_descriptor *out)
{
size_t i;
if (!graph || !out) return XTC_ERR_INVALID_ARGUMENT;
i = node_index(graph, id);
if (i == SIZE_MAX) return XTC_ERR_NOT_FOUND;
if (graph->nodes[i].type != XTC_NODE_NATIVE) return XTC_ERR_INVALID_ARGUMENT;
*out = graph->nodes[i].native; return XTC_OK;
}

View file

@ -1,9 +1,10 @@
#ifndef XTC_GRAPH_INTERNAL_H
#define XTC_GRAPH_INTERNAL_H
#include "xtc/xtc_engine.h"
#include "xtc/xtc_native.h"
#define XTC_MAX_NODES 256U
#define XTC_MAX_FRAMES 65536U
typedef struct { xtc_node_type type; float value; size_t id; } xtc_node;
typedef struct { xtc_node_type type; float value; size_t id; xtc_native_descriptor native; } xtc_node;
typedef struct { size_t source; size_t destination; } xtc_edge;
struct xtc_graph {
size_t max_nodes, node_count, edge_count, next_id;