@aeonentertainment/mixer 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/dist/index.d.mts +462 -0
- package/dist/index.mjs +722 -0
- package/native/binding/index.d.ts +216 -0
- package/native/binding/index.darwin-arm64.node +0 -0
- package/native/binding/index.darwin-x64.node +0 -0
- package/native/binding/index.js +841 -0
- package/native/binding/index.linux-arm64-gnu.node +0 -0
- package/native/binding/index.linux-x64-gnu.node +0 -0
- package/native/binding/index.win32-x64-msvc.node +0 -0
- package/native/binding/package.json +6 -0
- package/package.json +44 -3
|
@@ -0,0 +1,216 @@
|
|
|
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 and timer clocks. */
|
|
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
|
+
/** What drives the audio thread. */
|
|
109
|
+
export declare const enum ClockKind {
|
|
110
|
+
/** The offline driver, pumped from JavaScript. */
|
|
111
|
+
Offline = 'offline',
|
|
112
|
+
/** The timer clock, for a box with no sound card: no device, and nothing to pump. */
|
|
113
|
+
Timer = 'timer',
|
|
114
|
+
/** An OS output. */
|
|
115
|
+
Device = 'device',
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface CorrectorInput {
|
|
119
|
+
enabled: boolean
|
|
120
|
+
strength: number
|
|
121
|
+
retuneMs: number
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface GuideInput {
|
|
125
|
+
notes: Array<NoteInput>
|
|
126
|
+
/** The key's pitch classes as bits, C in bit 0. */
|
|
127
|
+
keyMask: number
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type NativeEvent =
|
|
131
|
+
| { kind: 'ack'; id: number; positionFrames: number }
|
|
132
|
+
| { kind: 'level'; slot: number; rmsDb: number; peakDb: number }
|
|
133
|
+
| { kind: 'masterLevel'; rmsDb: number; peakDb: number }
|
|
134
|
+
| { kind: 'pitch'; slot: number; positionMs: number; hz: number; confidence: number }
|
|
135
|
+
| { kind: 'position'; frames: number }
|
|
136
|
+
| { kind: 'backingEnded' }
|
|
137
|
+
| { kind: 'underrun' }
|
|
138
|
+
| { kind: 'fault' }
|
|
139
|
+
| { kind: 'retired' }
|
|
140
|
+
| { kind: 'renderProgress'; job: number; fraction: number }
|
|
141
|
+
| { kind: 'renderFinished'; job: number }
|
|
142
|
+
|
|
143
|
+
export interface NoteInput {
|
|
144
|
+
midi: number
|
|
145
|
+
startFrame: number
|
|
146
|
+
endFrame: number
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface OpenOptions {
|
|
150
|
+
clock: 'offline' | 'timer' | 'device'
|
|
151
|
+
/** A device clock's output: an id from `outputs`, or the default output. */
|
|
152
|
+
device?: string
|
|
153
|
+
periodFrames: number
|
|
154
|
+
/** The jitter buffer's playout delay for every `rtp` and `l16` slot. */
|
|
155
|
+
playoutDelayFrames: number
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface OutputEntry {
|
|
159
|
+
id: string
|
|
160
|
+
name: string
|
|
161
|
+
isDefault: boolean
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface OutputInfo {
|
|
165
|
+
sampleRate: number
|
|
166
|
+
periodFrames: number
|
|
167
|
+
latencyMs: number
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface ReverbInput {
|
|
171
|
+
enabled: boolean
|
|
172
|
+
roomSize: number
|
|
173
|
+
mix: number
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** `MixerConfig.rtpReturn`, range-checked in `src/` before it crosses. */
|
|
177
|
+
export interface RtpReturnInput {
|
|
178
|
+
/** An IP literal: a name would be resolved on the control thread. */
|
|
179
|
+
host: string
|
|
180
|
+
port: number
|
|
181
|
+
payloadType: number
|
|
182
|
+
ssrc: number
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** What `Mixer.stats` says about the return stream. */
|
|
186
|
+
export interface RtpReturnStats {
|
|
187
|
+
/** Blocks the audio thread dropped because the network thread had not drained the ring. */
|
|
188
|
+
droppedBlocks: number
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface SlotParamsInput {
|
|
192
|
+
/** Linear amplitude. */
|
|
193
|
+
gain: number
|
|
194
|
+
/** -1 left to 1 right. */
|
|
195
|
+
pan: number
|
|
196
|
+
mute: boolean
|
|
197
|
+
solo: boolean
|
|
198
|
+
corrector: CorrectorInput
|
|
199
|
+
reverb: ReverbInput
|
|
200
|
+
guideOffsetMs: number
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** `SlotStats` as JavaScript reads it. */
|
|
204
|
+
export interface SlotStatsInfo {
|
|
205
|
+
pushed: number
|
|
206
|
+
lost: number
|
|
207
|
+
late: number
|
|
208
|
+
concealed: number
|
|
209
|
+
resyncs: number
|
|
210
|
+
jitterMs: number
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface StemGainsInput {
|
|
214
|
+
instrumental: number
|
|
215
|
+
guide: number
|
|
216
|
+
}
|
|
Binary file
|
|
Binary file
|