@nodetool-ai/realtime-compiler 0.0.0-stage → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -2
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/CompilerSupport.d.ts +23 -0
- package/dist/CompilerSupport.d.ts.map +1 -0
- package/dist/CompilerSupport.js +123 -0
- package/dist/CompilerSupport.js.map +1 -0
- package/dist/ControlCompiler.d.ts +29 -0
- package/dist/ControlCompiler.d.ts.map +1 -0
- package/dist/ControlCompiler.js +371 -0
- package/dist/ControlCompiler.js.map +1 -0
- package/dist/Types.d.ts +255 -0
- package/dist/Types.d.ts.map +1 -0
- package/dist/Types.js +2 -0
- package/dist/Types.js.map +1 -0
- package/dist/compileAudioGraph.d.ts +4 -0
- package/dist/compileAudioGraph.d.ts.map +1 -0
- package/dist/compileAudioGraph.js +325 -0
- package/dist/compileAudioGraph.js.map +1 -0
- package/dist/compileRealtimeGraph.d.ts +4 -0
- package/dist/compileRealtimeGraph.d.ts.map +1 -0
- package/dist/compileRealtimeGraph.js +248 -0
- package/dist/compileRealtimeGraph.js.map +1 -0
- package/dist/generated/PlanSchema.d.ts +584 -0
- package/dist/generated/PlanSchema.d.ts.map +1 -0
- package/dist/generated/PlanSchema.js +784 -0
- package/dist/generated/PlanSchema.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -4
package/README.md
CHANGED
|
@@ -1,3 +1,114 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Realtime compiler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pure WP16 preparation against the [canonical plan schema](../../native/realtime/schema/README.md).
|
|
4
|
+
The compiler handles one render sink or one or more audio sinks. Render graphs support
|
|
5
|
+
registered shader/control descriptors, property/expression uniforms, render-domain
|
|
6
|
+
state and explicit batch texture boundaries. Audio graphs support built-in DSP
|
|
7
|
+
DAGs with property/control parameters. Results contain plan data, boundary reports,
|
|
8
|
+
parameter allocation and state keys, or graph-node diagnostics, without I/O.
|
|
9
|
+
|
|
10
|
+
Package builds read the canonical schema from `native/realtime/schema` and
|
|
11
|
+
generate the bundled schema module. Docker's build stage copies that source
|
|
12
|
+
asset explicitly. The compiler's Turbo build inputs include it, so schema
|
|
13
|
+
changes invalidate the build cache without changing the generated file by hand.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { compileRealtimeGraph } from "@nodetool-ai/realtime-compiler";
|
|
17
|
+
const result = compileRealtimeGraph({ graph, descriptors, outputs: [outputId], session, revision });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Descriptors are host-supplied contracts, not graph properties. Boundary textures
|
|
21
|
+
require explicit output contracts. Plans preserve graph identities and use stable
|
|
22
|
+
escaped slot names. A color-space mismatch warns. Straight RGBA8 inputs receive
|
|
23
|
+
an explicit `alpha.straightToPremul@1` pass when a consumer requires premultiplied
|
|
24
|
+
alpha. Consumers of the same source share the conversion. Dimensions, color-space
|
|
25
|
+
tags and retention follow the source. Unsupported alpha conversions reject.
|
|
26
|
+
Cycles and workflow execution-control edges
|
|
27
|
+
reject. Node and edge input order does not change the compiled plan.
|
|
28
|
+
|
|
29
|
+
Shader uniforms accept a property binding or `{ field, expression }`. Expression
|
|
30
|
+
leaves are `{ kind: "literal", value }` or `{ kind: "property", property, default }`.
|
|
31
|
+
Operations are `{ kind: "operation", op, inputs }` using the supported analytic
|
|
32
|
+
operation names. A connected property reads its control register instead of its
|
|
33
|
+
stored value. Repeated property references share the same graph input port.
|
|
34
|
+
Expressions contain data and never execute JavaScript supplied by the graph.
|
|
35
|
+
|
|
36
|
+
Constant arithmetic, comparisons, remap and vector packing fold at compile time.
|
|
37
|
+
Division by zero and zero-range remap follow the [executor contracts](../../native/realtime/control.md#operation-contracts).
|
|
38
|
+
`pow` and `tanh` remain runtime instructions to preserve the project's math.
|
|
39
|
+
Time and output-dimension sources also stay in the plan. Nonfinite fold results
|
|
40
|
+
remain runtime operations. Cyclic expressions, wrong arity, incompatible vector
|
|
41
|
+
widths and expressions beyond the compiler's size limit reject.
|
|
42
|
+
|
|
43
|
+
Audio descriptors specify an ABI 1 kernel, ordered input ports and parameters,
|
|
44
|
+
one output, a state version and an optional channel restriction. The compiler
|
|
45
|
+
validates the supported [built-in contracts](../../native/realtime/audio.md#built-in-kernels).
|
|
46
|
+
Each port uses the session layout. Parameter values are finite float32 scalars
|
|
47
|
+
with `none`, `ramp` or `onePole` smoothing and audio sync. Delay size is a
|
|
48
|
+
compile-time property. The delay kernel does not authorize graph feedback.
|
|
49
|
+
Pass ordering and buffer liveness are computed iteratively. Inputs remain live
|
|
50
|
+
through their last consumer, and outputs never overwrite inputs in the same node.
|
|
51
|
+
|
|
52
|
+
A DSP parameter's property port can connect to a live scalar control producer.
|
|
53
|
+
The compiler lowers that control region into the audio domain and emits an
|
|
54
|
+
`audioControl` register binding. Shared producers get one operation. The stored
|
|
55
|
+
parameter value supplies the initial smoothing endpoint. Offline execution samples
|
|
56
|
+
controls at quantum endpoints, independent of render frame rate, then applies the
|
|
57
|
+
declared smoothing. Vector producers and connected structural fields reject.
|
|
58
|
+
Runtime targets follow the native host's [scalar checks](../../native/realtime/audio.md#parameters-events-and-slots).
|
|
59
|
+
Audio and render lowering use the same control compiler. Sharing a stateful
|
|
60
|
+
producer between both domains still requires the deferred signal-history and
|
|
61
|
+
handoff work.
|
|
62
|
+
|
|
63
|
+
Pass the successful result's `allocation` back on the next call to preserve
|
|
64
|
+
parameter slots. This detached session ledger reserves removed `(node, field)`
|
|
65
|
+
identities, so removing/reintroducing a node cannot reuse another parameter's
|
|
66
|
+
slot. Discard the ledger when its session ends. The ledger is bounded, and
|
|
67
|
+
exhaustion rejects the candidate. It is not a cross-thread parameter table.
|
|
68
|
+
|
|
69
|
+
`stateKeys` contains SHA-256 identities for audio nodes and stateful controls,
|
|
70
|
+
using the design's graph identity, operation/version and session fields. Audio
|
|
71
|
+
keys also include structural delay size and channel layout. Nonstructural
|
|
72
|
+
parameter edits preserve those keys. Audio sink hashes include the logical
|
|
73
|
+
upstream edges, state keys, seed, initial parameter values, smoothing and control
|
|
74
|
+
dependencies. They exclude physical buffer IDs, parameter slot IDs and control
|
|
75
|
+
register numbers. Display dimensions enter a hash when a control reads them.
|
|
76
|
+
These are compiler metadata. State transfer and sink-ramp behavior remain WP18.
|
|
77
|
+
|
|
78
|
+
The `sample-player` descriptor declares `bufferInput`, an additional port for a
|
|
79
|
+
batch PCM value. Its ABI audio `inputs` array stays empty. Connect that port to
|
|
80
|
+
a node without a live descriptor and supply `batchPcm` metadata for the source
|
|
81
|
+
node/output: session `sampleRate` and `channels`, a positive integer `frames`
|
|
82
|
+
count below 2^32, and the full lowercase SHA-256 `contentHash` of prepared planar
|
|
83
|
+
float32 little-endian bytes. The compiler creates a stable buffer slot and reports
|
|
84
|
+
the boundary. Shared sources get one slot. Sample-player state keys include the
|
|
85
|
+
slot identity, frame count and content hash. Gain edits preserve those keys.
|
|
86
|
+
Direct batch-to-DSP audio ports remain unsupported.
|
|
87
|
+
|
|
88
|
+
PCM metadata is trusted host input for compile-time identity. The publishing host
|
|
89
|
+
must check it against the prepared bytes. The standalone CLI validates PCM shape
|
|
90
|
+
and finiteness. Decode/resample, contract verification during publication and live
|
|
91
|
+
slot replacement remain with the preparation/runner integration work.
|
|
92
|
+
|
|
93
|
+
Audio output IDs are unique and sorted in the resulting sink list. Shared DSP and
|
|
94
|
+
control producers execute once. Every sink producer remains live through the
|
|
95
|
+
quantum, including a source that also feeds downstream effects. Each sink hash
|
|
96
|
+
covers its own upstream path, so an independent branch can change without changing
|
|
97
|
+
that identity. This qualifies offline sink streams. Live device routing remains
|
|
98
|
+
deferred.
|
|
99
|
+
|
|
100
|
+
Build and test with `npm run build --workspace=packages/realtime-compiler` and
|
|
101
|
+
`npm run test --workspace=packages/realtime-compiler`. Both prepare the schema
|
|
102
|
+
asset from its canonical native source. The generated module is bundled for
|
|
103
|
+
browser/QuickJS hosts and ships in the package, with no runtime filesystem import.
|
|
104
|
+
Run `npm run test:native --workspace=packages/realtime-compiler -- <executable>`
|
|
105
|
+
for snapshot-to-native-loader/render and WAV checks with a configured software GPU.
|
|
106
|
+
|
|
107
|
+
WP16 remains open. Mixed audio/render graphs, cross-domain control sharing, render
|
|
108
|
+
parameter slots, the full descriptor
|
|
109
|
+
expression vocabulary, reverse/floating-point alpha conversion, delayed feedback,
|
|
110
|
+
batch graph rewriting and cross-domain stateful handoffs remain unimplemented.
|
|
111
|
+
This package does not register product node descriptors or integrate the runner,
|
|
112
|
+
editor or live devices. Media preparation/publication and live slot lifecycle
|
|
113
|
+
remain [WP19](https://github.com/nodetool-ai/nodetool/issues/7410).
|
|
114
|
+
See the [deferral ledger](../../native/realtime/M1_STATUS.md#deferred-acceptance-work).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-11-26T12:48:34.120Z
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Edge, NodeDescriptor } from "@nodetool-ai/protocol";
|
|
2
|
+
import type { CompileInput, Diagnostic, ParameterAllocation, Session, ValueBinding } from "./Types.js";
|
|
3
|
+
export declare class CompileFailure extends Error {
|
|
4
|
+
readonly diagnostic: Diagnostic;
|
|
5
|
+
constructor(diagnostic: Diagnostic);
|
|
6
|
+
}
|
|
7
|
+
export declare function fail(node: string, reason: string, detail: string): never;
|
|
8
|
+
export declare function integer(value: number, min: number, max: number, node: string): void;
|
|
9
|
+
export declare function compareNames(a: string, b: string): number;
|
|
10
|
+
export declare function identity(node: string, field: string): string;
|
|
11
|
+
export declare function hash(value: unknown): string;
|
|
12
|
+
export declare function stateKey(node: string, operation: string, version: number, session: Session, structural?: readonly unknown[]): string;
|
|
13
|
+
export declare function values(node: NodeDescriptor, binding: ValueBinding): number[];
|
|
14
|
+
export declare function literalValues(value: unknown, node: string, field: string): number[];
|
|
15
|
+
export declare function prepareGraph(input: CompileInput, multipleAudioOutputs?: boolean): {
|
|
16
|
+
nodes: Map<string, NodeDescriptor>;
|
|
17
|
+
incoming: Map<string, Map<string, Edge>>;
|
|
18
|
+
};
|
|
19
|
+
export declare function parameterAllocator(previous?: ParameterAllocation): {
|
|
20
|
+
slot(node: string, field: string): number;
|
|
21
|
+
snapshot(): ParameterAllocation;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=CompilerSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompilerSupport.d.ts","sourceRoot":"","sources":["../src/CompilerSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAqB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1H,qBAAa,cAAe,SAAQ,KAAK;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU;IAA3C,YAAqB,UAAU,EAAE,UAAU,EAA+B;CAC3E;AACD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAwD;AACjI,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnF;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAuC;AACjG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAA0C;AACvG,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAA6C;AACzF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAGpI;AACD,wBAAgB,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,EAAE,CAG5E;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAYnF;AACD,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,UAAQ,GAAG;IAC/E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;CAC9E,CAwBA;AACD,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,mBAAmB;IAc7D,IAAI,OAAO,MAAM,SAAS,MAAM,GAAG,MAAM;IAMzC,QAAQ,IAAI,mBAAmB;EAElC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { sha256Hex } from "@nodetool-ai/protocol/sha256";
|
|
2
|
+
import { PLAN_SCHEMA } from "./generated/PlanSchema.js";
|
|
3
|
+
export class CompileFailure extends Error {
|
|
4
|
+
diagnostic;
|
|
5
|
+
constructor(diagnostic) {
|
|
6
|
+
super(diagnostic.detail);
|
|
7
|
+
this.diagnostic = diagnostic;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function fail(node, reason, detail) { throw new CompileFailure({ node, reason, detail }); }
|
|
11
|
+
export function integer(value, min, max, node) {
|
|
12
|
+
if (!Number.isSafeInteger(value) || value < min || value > max) {
|
|
13
|
+
fail(node, "range", `Expected integer in [${min}, ${max}]`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function compareNames(a, b) { return a < b ? -1 : a > b ? 1 : 0; }
|
|
17
|
+
export function identity(node, field) { return JSON.stringify([node, field]); }
|
|
18
|
+
export function hash(value) { return sha256Hex(JSON.stringify(value)); }
|
|
19
|
+
export function stateKey(node, operation, version, session, structural) {
|
|
20
|
+
return hash(structural === undefined ? ["control", node, operation, version, session.sampleRate, session.quantum] :
|
|
21
|
+
["audio", node, operation, version, structural, session.sampleRate, session.quantum, session.channels]);
|
|
22
|
+
}
|
|
23
|
+
export function values(node, binding) {
|
|
24
|
+
const value = node.properties && Object.hasOwn(node.properties, binding.property) ? node.properties[binding.property] : binding.default;
|
|
25
|
+
return literalValues(value, node.id, binding.property);
|
|
26
|
+
}
|
|
27
|
+
export function literalValues(value, node, field) {
|
|
28
|
+
if (typeof value === "boolean") {
|
|
29
|
+
return [Number(value)];
|
|
30
|
+
}
|
|
31
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
32
|
+
return [value];
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(value) && value.length >= 1 && value.length <= 4) {
|
|
35
|
+
const lanes = [];
|
|
36
|
+
for (const lane of value) {
|
|
37
|
+
if (typeof lane !== "number" || !Number.isFinite(lane)) {
|
|
38
|
+
fail(node, "control_value", field);
|
|
39
|
+
}
|
|
40
|
+
lanes.push(lane);
|
|
41
|
+
}
|
|
42
|
+
return lanes;
|
|
43
|
+
}
|
|
44
|
+
return fail(node, "control_value", `Expected finite scalar or vector: ${field}`);
|
|
45
|
+
}
|
|
46
|
+
export function prepareGraph(input, multipleAudioOutputs = false) {
|
|
47
|
+
const { session, graph } = input;
|
|
48
|
+
integer(input.revision, 0, PLAN_SCHEMA.properties.revision.maximum, "$plan");
|
|
49
|
+
integer(session.width, 1, 16384, "$session");
|
|
50
|
+
integer(session.height, 1, 16384, "$session");
|
|
51
|
+
integer(session.seed, 0, 4294967295, "$session");
|
|
52
|
+
if ((session.sampleRate !== 44100 && session.sampleRate !== 48000) || session.quantum !== 128 ||
|
|
53
|
+
(session.channels !== "mono" && session.channels !== "stereo")) {
|
|
54
|
+
fail("$session", "session", "Unsupported session layout");
|
|
55
|
+
}
|
|
56
|
+
if (graph.nodes.length > 100000 || graph.edges.length > 100000) {
|
|
57
|
+
fail("$graph", "limit", "Graph exceeds v1 compiler limits");
|
|
58
|
+
}
|
|
59
|
+
if (input.outputs.length < 1 || input.outputs.length > (multipleAudioOutputs ? 100000 : 1) || new Set(input.outputs).size !== input.outputs.length) {
|
|
60
|
+
fail("$graph", "outputs", multipleAudioOutputs ? "Audio outputs must be nonempty, unique and within compiler limits" : "This slice requires exactly one render output");
|
|
61
|
+
}
|
|
62
|
+
const nodes = new Map();
|
|
63
|
+
const incoming = new Map();
|
|
64
|
+
for (const node of graph.nodes) {
|
|
65
|
+
if (!node.id || nodes.has(node.id)) {
|
|
66
|
+
fail(node.id, "duplicate_node", "Node identity is empty or duplicated");
|
|
67
|
+
}
|
|
68
|
+
nodes.set(node.id, node);
|
|
69
|
+
incoming.set(node.id, new Map());
|
|
70
|
+
}
|
|
71
|
+
for (const edge of graph.edges) {
|
|
72
|
+
if (!edge.sourceHandle || !edge.targetHandle) {
|
|
73
|
+
fail(edge.target, "port", "Edge handles must be nonempty");
|
|
74
|
+
}
|
|
75
|
+
const inputs = incoming.get(edge.target);
|
|
76
|
+
if (!nodes.has(edge.source) || !inputs) {
|
|
77
|
+
fail(edge.target, "missing_node", "Edge endpoint is missing");
|
|
78
|
+
}
|
|
79
|
+
if (inputs.has(edge.targetHandle)) {
|
|
80
|
+
fail(edge.target, "multiple_inputs", edge.targetHandle);
|
|
81
|
+
}
|
|
82
|
+
inputs.set(edge.targetHandle, edge);
|
|
83
|
+
}
|
|
84
|
+
return { nodes, incoming };
|
|
85
|
+
}
|
|
86
|
+
export function parameterAllocator(previous) {
|
|
87
|
+
const entries = [];
|
|
88
|
+
const identities = new Map();
|
|
89
|
+
const slots = new Set();
|
|
90
|
+
let nextSlot = previous?.nextSlot ?? 0;
|
|
91
|
+
integer(nextSlot, 0, 4294967296, "$params");
|
|
92
|
+
if ((previous?.entries.length ?? 0) > 100000) {
|
|
93
|
+
fail("$params", "limit", "Parameter ledger exceeds compiler limits");
|
|
94
|
+
}
|
|
95
|
+
for (const entry of previous?.entries ?? []) {
|
|
96
|
+
integer(entry.slot, 0, 4294967295, entry.node);
|
|
97
|
+
const key = identity(entry.node, entry.field);
|
|
98
|
+
if (!entry.node || !entry.field || identities.has(key) || slots.has(entry.slot) || entry.slot >= nextSlot) {
|
|
99
|
+
fail(entry.node, "parameter_allocation", "Invalid or duplicated parameter identity/slot");
|
|
100
|
+
}
|
|
101
|
+
identities.set(key, entry.slot);
|
|
102
|
+
slots.add(entry.slot);
|
|
103
|
+
entries.push({ node: entry.node, field: entry.field, slot: entry.slot });
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
slot(node, field) {
|
|
107
|
+
const key = identity(node, field);
|
|
108
|
+
const existing = identities.get(key);
|
|
109
|
+
if (existing !== undefined) {
|
|
110
|
+
return existing;
|
|
111
|
+
}
|
|
112
|
+
if (entries.length >= 100000 || nextSlot > 4294967295) {
|
|
113
|
+
return fail(node, "limit", "Parameter allocation exhausted");
|
|
114
|
+
}
|
|
115
|
+
const slot = nextSlot++;
|
|
116
|
+
entries.push({ node, field, slot });
|
|
117
|
+
identities.set(key, slot);
|
|
118
|
+
return slot;
|
|
119
|
+
},
|
|
120
|
+
snapshot() { return { entries: entries.sort((a, b) => a.slot - b.slot), nextSlot }; }
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=CompilerSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompilerSupport.js","sourceRoot":"","sources":["../src/CompilerSupport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,MAAM,OAAO,cAAe,SAAQ,KAAK;IAClB,UAAU;IAA/B,YAAqB,UAAsB;QAA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C,CAAC;YAAC,OAAO,IAAI,CAAC;QACvG,CAAC;QACD,QAAQ,KAA0B,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;KAC3G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Edge, NodeDescriptor } from "@nodetool-ai/protocol";
|
|
2
|
+
import type { CompileInput, ControlDescriptor, ControlInstruction, ExpressionBinding, ShaderDescriptor, ValueBinding } from "./Types.js";
|
|
3
|
+
export declare function createControlCompiler(domain: "audio" | "render", input: CompileInput, nodes: ReadonlyMap<string, NodeDescriptor>, incoming: ReadonlyMap<string, ReadonlyMap<string, Edge>>): {
|
|
4
|
+
inputPorts: (descriptor: ControlDescriptor | ShaderDescriptor, node: string) => string[];
|
|
5
|
+
lower: (node: NodeDescriptor, descriptor: ControlDescriptor) => void;
|
|
6
|
+
lowerRegion: (seeds: readonly string[]) => void;
|
|
7
|
+
bind: (node: NodeDescriptor, field: ValueBinding) => {
|
|
8
|
+
index: number;
|
|
9
|
+
width: number;
|
|
10
|
+
};
|
|
11
|
+
uniform(node: NodeDescriptor, field: ValueBinding | ExpressionBinding): {
|
|
12
|
+
index: number;
|
|
13
|
+
width: number;
|
|
14
|
+
};
|
|
15
|
+
hash(index: number): string;
|
|
16
|
+
program(): {
|
|
17
|
+
registers: number;
|
|
18
|
+
ops: ControlInstruction[];
|
|
19
|
+
stateful: (ControlInstruction & {
|
|
20
|
+
stateVersion: number;
|
|
21
|
+
})[];
|
|
22
|
+
};
|
|
23
|
+
stateKeys(): {
|
|
24
|
+
node: string;
|
|
25
|
+
kind: "control";
|
|
26
|
+
key: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=ControlCompiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlCompiler.d.ts","sourceRoot":"","sources":["../src/ControlCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAqB,YAAY,EAAE,iBAAiB,EAAqB,kBAAkB,EAAE,iBAAiB,EAAkB,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAmD/L,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,KAAK,EAAE,YAAY,EACnF,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;6BAmIpE,iBAAiB,GAAG,gBAAgB,QAAQ,MAAM,KAAG,MAAM,EAAE;kBAnBxE,cAAc,cAAc,iBAAiB,KAAG,IAAI;yBAyB7C,SAAS,MAAM,EAAE,KAAG,IAAI;iBAjF7B,cAAc,SAAS,YAAY,KAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;kBAoH7E,cAAc,SAAS,YAAY,GAAG,iBAAiB;eApHD,MAAM;eAAS,MAAM;;gBAqH7E,MAAM,GAAG,MAAM;;;;;0BA3KoE,MAAM;;;;;cAkLnC,SAAS;;;EAE9E"}
|