@aeonentertainment/mixer 0.0.0-stage → 0.1.0

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.
@@ -0,0 +1,207 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
12
+ /**
13
+ * A song's stems being decoded and rendered for one mixer. JavaScript holds it from
14
+ * `createMixer` and installs it when the events thread says the job is done.
15
+ */
16
+ export declare class BackingRender {
17
+ /** The id the events thread's `renderProgress` and `renderFinished` events carry. */
18
+ get id(): number
19
+ }
20
+
21
+ export declare class Engine {
22
+ /**
23
+ * Starts the clock on the silent graph and the events thread, which calls `on_events` with
24
+ * every batch it drains.
25
+ */
26
+ constructor(options: OpenOptions, onEvents: (arg: Array<NativeEvent>) => void)
27
+ /**
28
+ * Builds a mixer with one slot per kind, in order: `"rtp"`, `"l16"` or `"push"`. The rtp
29
+ * and l16 slots bind their ports here and report them through `Mixer.port`; a return stream
30
+ * gets its socket and send task here too.
31
+ */
32
+ createMixer(kinds: Array<string>, rtpReturn?: RtpReturnInput | undefined | null): Mixer
33
+ get output(): OutputInfo
34
+ /** The outputs this OS offers, the default marked. Empty on the offline clock. */
35
+ outputs(): Array<OutputEntry>
36
+ /** Offline clock only: renders `blocks` blocks and returns them as interleaved stereo. */
37
+ pump(blocks: number): Float32Array
38
+ /** Writes one slot of the snapshot and publishes the whole of it. */
39
+ setSlotParams(index: number, params: SlotParamsInput): void
40
+ /**
41
+ * Moves `mixer`'s graph to the audio thread and returns the swap's id. The graph it replaces
42
+ * comes back through the retired ring as a `retired` event.
43
+ */
44
+ swap(mixer: Mixer): number
45
+ /** Swaps the silent graph in: the end of a mixer. */
46
+ swapSilent(): number
47
+ start(): number
48
+ /**
49
+ * Starts decoding and rendering a song's stems on the worker thread. The events thread
50
+ * reports the job's progress under the id the result carries.
51
+ */
52
+ startRender(input: BackingInput): BackingRender
53
+ seek(toFrame: number): number
54
+ pause(): number
55
+ resume(): number
56
+ setKey(semitones: number): number
57
+ stopAt(atFrame: number, fadeFrames: number): number
58
+ /** Writes the stem gains of the snapshot and publishes the whole of it. */
59
+ setStemGains(gains: StemGainsInput): void
60
+ /** Gives the live graph's slot a guide, or takes it away with nothing. No ack. */
61
+ setGuide(slot: number, guide?: GuideInput | undefined | null): void
62
+ /** The live graph's slot forgets the stream it was hearing. No ack. */
63
+ resetSlot(slot: number): void
64
+ /** Plays interleaved stereo on a free reaction voice; false when four already play. */
65
+ playReaction(stereo: Float32Array): boolean
66
+ /**
67
+ * Stops the clock, then the network thread with every port still on it, then the events
68
+ * thread. Whatever graph is live is dropped here.
69
+ */
70
+ close(): void
71
+ }
72
+
73
+ export declare class Mixer {
74
+ /** Moves a finished render's stems into the graph as its backing path, before `swap`. */
75
+ installBacking(render: BackingRender): void
76
+ /** The UDP port a slot listens on, or null for a push slot. */
77
+ port(index: number): number | null
78
+ /**
79
+ * Hands interleaved stereo PCM to a push slot, which folds it to mono as every slot is
80
+ * (docs/design.md 8.4), and returns how many frames it took.
81
+ */
82
+ push(index: number, stereo: Float32Array): number
83
+ /**
84
+ * Records what reaches an `rtp` or `l16` slot's port to a new pcap file at `path`, or stops
85
+ * recording it for null.
86
+ */
87
+ recordSlot(index: number, path?: string | undefined | null): void
88
+ /** Every slot's ingest counters, as the audio thread last published them. */
89
+ stats(): Array<SlotStatsInfo>
90
+ /** The return stream's counters, or null for a mixer without one. */
91
+ returnStats(): RtpReturnStats | null
92
+ /**
93
+ * The end of the mixer on this thread: closes the slots' ports, drops the push feeds, stops
94
+ * the return stream, and drops a graph that never started.
95
+ */
96
+ release(): void
97
+ }
98
+
99
+ export interface BackingInput {
100
+ instrumental: string
101
+ guide?: string
102
+ /** The armed key, rendered before start. */
103
+ semitones: number
104
+ /** The armed speed factor, rendered before start. */
105
+ speed: number
106
+ }
107
+
108
+ export interface CorrectorInput {
109
+ enabled: boolean
110
+ strength: number
111
+ retuneMs: number
112
+ }
113
+
114
+ export interface GuideInput {
115
+ notes: Array<NoteInput>
116
+ /** The key's pitch classes as bits, C in bit 0. */
117
+ keyMask: number
118
+ }
119
+
120
+ export type NativeEvent =
121
+ | { kind: 'ack'; id: number; positionFrames: number }
122
+ | { kind: 'level'; slot: number; rmsDb: number; peakDb: number }
123
+ | { kind: 'masterLevel'; rmsDb: number; peakDb: number }
124
+ | { kind: 'pitch'; slot: number; positionMs: number; hz: number; confidence: number }
125
+ | { kind: 'position'; frames: number }
126
+ | { kind: 'backingEnded' }
127
+ | { kind: 'underrun' }
128
+ | { kind: 'fault' }
129
+ | { kind: 'retired' }
130
+ | { kind: 'renderProgress'; job: number; fraction: number }
131
+ | { kind: 'renderFinished'; job: number }
132
+
133
+ export interface NoteInput {
134
+ midi: number
135
+ startFrame: number
136
+ endFrame: number
137
+ }
138
+
139
+ export interface OpenOptions {
140
+ /** The offline driver, pumped from JavaScript, instead of a device. */
141
+ offline: boolean
142
+ /** An id from `outputs`, or the default output. */
143
+ device?: string
144
+ periodFrames: number
145
+ /** The jitter buffer's playout delay for every `rtp` and `l16` slot. */
146
+ playoutDelayFrames: number
147
+ }
148
+
149
+ export interface OutputEntry {
150
+ id: string
151
+ name: string
152
+ isDefault: boolean
153
+ }
154
+
155
+ export interface OutputInfo {
156
+ sampleRate: number
157
+ periodFrames: number
158
+ latencyMs: number
159
+ }
160
+
161
+ export interface ReverbInput {
162
+ enabled: boolean
163
+ roomSize: number
164
+ mix: number
165
+ }
166
+
167
+ /** `MixerConfig.rtpReturn`, range-checked in `src/` before it crosses. */
168
+ export interface RtpReturnInput {
169
+ /** An IP literal: a name would be resolved on the control thread. */
170
+ host: string
171
+ port: number
172
+ payloadType: number
173
+ ssrc: number
174
+ }
175
+
176
+ /** What `Mixer.stats` says about the return stream. */
177
+ export interface RtpReturnStats {
178
+ /** Blocks the audio thread dropped because the network thread had not drained the ring. */
179
+ droppedBlocks: number
180
+ }
181
+
182
+ export interface SlotParamsInput {
183
+ /** Linear amplitude. */
184
+ gain: number
185
+ /** -1 left to 1 right. */
186
+ pan: number
187
+ mute: boolean
188
+ solo: boolean
189
+ corrector: CorrectorInput
190
+ reverb: ReverbInput
191
+ guideOffsetMs: number
192
+ }
193
+
194
+ /** `SlotStats` as JavaScript reads it. */
195
+ export interface SlotStatsInfo {
196
+ pushed: number
197
+ lost: number
198
+ late: number
199
+ concealed: number
200
+ resyncs: number
201
+ jitterMs: number
202
+ }
203
+
204
+ export interface StemGainsInput {
205
+ instrumental: number
206
+ guide: number
207
+ }