@blibliki/engine 0.3.10 → 0.4.2
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
- package/src/core/IO/AudioIO.ts +1 -0
- package/src/core/midi/adapters/WebMidiAdapter.ts +1 -1
- package/src/core/module/PolyModule.ts +4 -3
- package/src/modules/Constant.ts +1 -0
- package/src/modules/Envelope.ts +1 -0
- package/src/modules/Filter.ts +1 -0
- package/src/modules/Gain.ts +1 -0
- package/src/modules/Inspector.ts +1 -0
- package/src/modules/MidiSelector.ts +4 -1
- package/src/modules/Oscillator.ts +1 -0
- package/src/modules/StereoPanner.ts +1 -0
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -860
- package/src/nodePolyfill.ts +0 -25
package/dist/index.d.cts
DELETED
|
@@ -1,860 +0,0 @@
|
|
|
1
|
-
import * as _blibliki_utils from '@blibliki/utils';
|
|
2
|
-
import { Context, Optional, EmptyObject } from '@blibliki/utils';
|
|
3
|
-
export { Context } from '@blibliki/utils';
|
|
4
|
-
import * as _blibliki_transport from '@blibliki/transport';
|
|
5
|
-
import { Seconds, ContextTime, Transport, TransportEvent, BPM, TimeSignature } from '@blibliki/transport';
|
|
6
|
-
export { Position, TimeSignature, TransportState } from '@blibliki/transport';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Simple wrapper around MIDI message data (Uint8Array)
|
|
10
|
-
* Replaces the webmidi Message class with native Web MIDI API data
|
|
11
|
-
*/
|
|
12
|
-
declare class Message {
|
|
13
|
-
readonly data: Uint8Array;
|
|
14
|
-
constructor(data: Uint8Array);
|
|
15
|
-
/**
|
|
16
|
-
* Returns the data bytes (excluding the status byte)
|
|
17
|
-
*/
|
|
18
|
-
get dataBytes(): number[];
|
|
19
|
-
/**
|
|
20
|
-
* Returns the MIDI message type based on the status byte
|
|
21
|
-
*/
|
|
22
|
-
get type(): string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type INote = {
|
|
26
|
-
name: string;
|
|
27
|
-
octave: number;
|
|
28
|
-
frequency: number;
|
|
29
|
-
duration?: Seconds;
|
|
30
|
-
velocity?: number;
|
|
31
|
-
};
|
|
32
|
-
declare class Note implements INote {
|
|
33
|
-
static _notes: Note[];
|
|
34
|
-
name: string;
|
|
35
|
-
octave: number;
|
|
36
|
-
velocity: number;
|
|
37
|
-
duration?: Seconds;
|
|
38
|
-
static fromFrequency(frequency: number): Note;
|
|
39
|
-
static fromEvent(message: Message): Note;
|
|
40
|
-
static notes(octave?: number): Note[];
|
|
41
|
-
constructor(note: Omit<INote, "frequency"> | string);
|
|
42
|
-
get isSemi(): boolean;
|
|
43
|
-
get fullName(): string;
|
|
44
|
-
get frequency(): number;
|
|
45
|
-
midiData(noteOn?: boolean): Uint8Array;
|
|
46
|
-
get midiNumber(): number;
|
|
47
|
-
get noteIndex(): number;
|
|
48
|
-
valueOf(): string;
|
|
49
|
-
serialize(): INote;
|
|
50
|
-
private fromString;
|
|
51
|
-
private fromProps;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
declare enum MidiEventType {
|
|
55
|
-
noteOn = "noteon",
|
|
56
|
-
noteOff = "noteoff",
|
|
57
|
-
cc = "controlchange"
|
|
58
|
-
}
|
|
59
|
-
declare class MidiEvent {
|
|
60
|
-
note?: Note;
|
|
61
|
-
voiceNo?: number;
|
|
62
|
-
readonly triggeredAt: ContextTime;
|
|
63
|
-
private message;
|
|
64
|
-
static fromNote(noteName: string | Note | Omit<INote, "frequency">, noteOn: boolean | undefined, triggeredAt: ContextTime): MidiEvent;
|
|
65
|
-
static fromCC(cc: number, value: number, triggeredAt: ContextTime): MidiEvent;
|
|
66
|
-
constructor(message: Message, triggeredAt: ContextTime);
|
|
67
|
-
get type(): MidiEventType;
|
|
68
|
-
get isNote(): boolean;
|
|
69
|
-
get isCC(): boolean;
|
|
70
|
-
get cc(): number | undefined;
|
|
71
|
-
get ccValue(): number | undefined;
|
|
72
|
-
defineNotes(): void;
|
|
73
|
-
get rawMessage(): Message;
|
|
74
|
-
clone(voiceNo?: number): MidiEvent;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Platform-agnostic MIDI interfaces
|
|
79
|
-
* Allows switching between Web MIDI API and node-midi without refactoring
|
|
80
|
-
*/
|
|
81
|
-
interface IMidiMessageEvent {
|
|
82
|
-
data: Uint8Array;
|
|
83
|
-
timeStamp: number;
|
|
84
|
-
}
|
|
85
|
-
type MidiMessageCallback = (event: IMidiMessageEvent) => void;
|
|
86
|
-
interface IMidiInputPort {
|
|
87
|
-
readonly id: string;
|
|
88
|
-
readonly name: string;
|
|
89
|
-
readonly state: "connected" | "disconnected";
|
|
90
|
-
addEventListener(callback: MidiMessageCallback): void;
|
|
91
|
-
removeEventListener(callback: MidiMessageCallback): void;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare enum MidiPortState {
|
|
95
|
-
connected = "connected",
|
|
96
|
-
disconnected = "disconnected"
|
|
97
|
-
}
|
|
98
|
-
type IMidiDevice = {
|
|
99
|
-
id: string;
|
|
100
|
-
name: string;
|
|
101
|
-
state: MidiPortState;
|
|
102
|
-
};
|
|
103
|
-
type IMidiInput = IMidiDevice & {
|
|
104
|
-
eventListerCallbacks: EventListerCallback[];
|
|
105
|
-
};
|
|
106
|
-
type EventListerCallback = (event: MidiEvent) => void;
|
|
107
|
-
declare class MidiDevice implements IMidiDevice {
|
|
108
|
-
id: string;
|
|
109
|
-
name: string;
|
|
110
|
-
eventListerCallbacks: EventListerCallback[];
|
|
111
|
-
private context;
|
|
112
|
-
private input;
|
|
113
|
-
private messageHandler;
|
|
114
|
-
constructor(input: IMidiInputPort, context: Context);
|
|
115
|
-
get state(): MidiPortState;
|
|
116
|
-
connect(): void;
|
|
117
|
-
disconnect(): void;
|
|
118
|
-
serialize(): {
|
|
119
|
-
id: string;
|
|
120
|
-
name: string;
|
|
121
|
-
state: MidiPortState;
|
|
122
|
-
};
|
|
123
|
-
addEventListener(callback: EventListerCallback): void;
|
|
124
|
-
removeEventListener(callback: EventListerCallback): void;
|
|
125
|
-
private processEvent;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
declare class ComputerKeyboardInput implements IMidiInput {
|
|
129
|
-
id: string;
|
|
130
|
-
name: string;
|
|
131
|
-
state: MidiPortState;
|
|
132
|
-
eventListerCallbacks: EventListerCallback[];
|
|
133
|
-
private context;
|
|
134
|
-
constructor(context: Context);
|
|
135
|
-
addEventListener(callback: EventListerCallback): void;
|
|
136
|
-
removeEventListener(callback: EventListerCallback): void;
|
|
137
|
-
serialize(): {
|
|
138
|
-
id: string;
|
|
139
|
-
name: string;
|
|
140
|
-
state: MidiPortState;
|
|
141
|
-
};
|
|
142
|
-
onKeyTrigger: (noteOn: boolean) => (event: KeyboardEvent) => void;
|
|
143
|
-
private extractNote;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
type MidiInputProps = IOProps & {
|
|
147
|
-
ioType: IOType.MidiInput;
|
|
148
|
-
onMidiEvent: (event: MidiEvent) => void;
|
|
149
|
-
};
|
|
150
|
-
type MidiOutputProps = IOProps & {
|
|
151
|
-
ioType: IOType.MidiOutput;
|
|
152
|
-
};
|
|
153
|
-
declare class MidiInput extends IO<MidiOutput> implements MidiInputProps {
|
|
154
|
-
ioType: IOType.MidiInput;
|
|
155
|
-
onMidiEvent: MidiInputProps["onMidiEvent"];
|
|
156
|
-
constructor(module: Module<ModuleType> | PolyModule<ModuleType>, props: MidiInputProps);
|
|
157
|
-
}
|
|
158
|
-
declare class MidiOutput extends IO<MidiInput> implements MidiOutputProps {
|
|
159
|
-
ioType: IOType.MidiOutput;
|
|
160
|
-
onMidiEvent: (event: MidiEvent) => void;
|
|
161
|
-
private get midiConnections();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
type IOProps = {
|
|
165
|
-
name: string;
|
|
166
|
-
ioType: IOType;
|
|
167
|
-
};
|
|
168
|
-
type IIOSerialize = IOProps & {
|
|
169
|
-
id: string;
|
|
170
|
-
moduleId: string;
|
|
171
|
-
};
|
|
172
|
-
declare enum IOType {
|
|
173
|
-
AudioInput = "audioInput",
|
|
174
|
-
AudioOutput = "audioOutput",
|
|
175
|
-
PolyAudioInput = "polyAudioInput",
|
|
176
|
-
PolyAudioOutput = "polyAudioOutput",
|
|
177
|
-
MidiOutput = "midiOutput",
|
|
178
|
-
MidiInput = "midiInput"
|
|
179
|
-
}
|
|
180
|
-
type IIO = {
|
|
181
|
-
id: string;
|
|
182
|
-
module: Module<ModuleType> | PolyModule<ModuleType>;
|
|
183
|
-
} & IOProps;
|
|
184
|
-
declare abstract class Base implements IIO {
|
|
185
|
-
id: string;
|
|
186
|
-
ioType: IOType;
|
|
187
|
-
name: string;
|
|
188
|
-
module: Module<ModuleType> | PolyModule<ModuleType>;
|
|
189
|
-
connections: Base[];
|
|
190
|
-
constructor(module: Module<ModuleType> | PolyModule<ModuleType>, props: IOProps);
|
|
191
|
-
plug(io: Base, plugOther?: boolean): void;
|
|
192
|
-
unPlug(io: Base, plugOther?: boolean): void;
|
|
193
|
-
rePlugAll(callback?: () => void): void;
|
|
194
|
-
unPlugAll(): void;
|
|
195
|
-
isAudio(): this is AudioInput | AudioOutput | PolyAudioInput | PolyAudioOutput;
|
|
196
|
-
isMidi(): this is MidiInput | MidiOutput;
|
|
197
|
-
serialize(): IIOSerialize;
|
|
198
|
-
}
|
|
199
|
-
declare abstract class IO<Connection extends Base> extends Base {
|
|
200
|
-
connections: Connection[];
|
|
201
|
-
plug(io: Connection, plugOther?: boolean): void;
|
|
202
|
-
unPlug(io: Connection, plugOther?: boolean): void;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
type AudioInputProps = IOProps & {
|
|
206
|
-
ioType: IOType.AudioInput;
|
|
207
|
-
getAudioNode: () => AudioNode | AudioParam | AudioDestinationNode;
|
|
208
|
-
};
|
|
209
|
-
type AudioOutputProps = IOProps & {
|
|
210
|
-
ioType: IOType.AudioOutput;
|
|
211
|
-
getAudioNode: () => AudioNode;
|
|
212
|
-
};
|
|
213
|
-
declare class AudioInput extends IO<AudioOutput | PolyAudioOutput> implements AudioInputProps {
|
|
214
|
-
ioType: IOType.AudioInput;
|
|
215
|
-
getAudioNode: AudioInputProps["getAudioNode"];
|
|
216
|
-
constructor(module: Module<ModuleType>, props: AudioInputProps);
|
|
217
|
-
}
|
|
218
|
-
declare class AudioOutput extends IO<AudioInput | PolyAudioInput> implements AudioOutputProps {
|
|
219
|
-
ioType: IOType.AudioOutput;
|
|
220
|
-
getAudioNode: AudioOutputProps["getAudioNode"];
|
|
221
|
-
constructor(module: Module<ModuleType>, props: AudioOutputProps);
|
|
222
|
-
plug(io: AudioInput | PolyAudioInput, plugOther?: boolean): void;
|
|
223
|
-
unPlug(io: AudioInput | PolyAudioInput, plugOther?: boolean): void;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
type PolyAudioInputProps = IOProps & {
|
|
227
|
-
ioType: IOType.PolyAudioInput;
|
|
228
|
-
};
|
|
229
|
-
type PolyAudioOutputProps = IOProps & {
|
|
230
|
-
ioType: IOType.PolyAudioOutput;
|
|
231
|
-
};
|
|
232
|
-
declare class PolyAudioInput extends IO<PolyAudioOutput | AudioOutput> implements PolyAudioInputProps {
|
|
233
|
-
ioType: IOType.PolyAudioInput;
|
|
234
|
-
module: PolyModule<ModuleType>;
|
|
235
|
-
plug(io: PolyAudioOutput | AudioOutput, plugOther?: boolean): void;
|
|
236
|
-
unPlug(io: PolyAudioOutput | AudioOutput, plugOther?: boolean): void;
|
|
237
|
-
findIOByVoice(voice: number): AudioInput;
|
|
238
|
-
}
|
|
239
|
-
declare class PolyAudioOutput extends IO<PolyAudioInput | AudioInput> implements PolyAudioOutputProps {
|
|
240
|
-
ioType: IOType.PolyAudioOutput;
|
|
241
|
-
module: PolyModule<ModuleType>;
|
|
242
|
-
plug(io: PolyAudioInput | AudioInput, plugOther?: boolean): void;
|
|
243
|
-
unPlug(io: PolyAudioInput | AudioInput, plugOther?: boolean): void;
|
|
244
|
-
findIOByVoice(voice: number): AudioOutput;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
declare enum CollectionType {
|
|
248
|
-
Input = "Input",
|
|
249
|
-
Output = "Output"
|
|
250
|
-
}
|
|
251
|
-
type IMappedIOProps = {
|
|
252
|
-
[CollectionType.Input]: AudioInputProps | PolyAudioInputProps | MidiInputProps;
|
|
253
|
-
[CollectionType.Output]: AudioOutputProps | PolyAudioOutputProps | MidiOutputProps;
|
|
254
|
-
};
|
|
255
|
-
type IIOTypeTOClass = {
|
|
256
|
-
[IOType.AudioInput]: AudioInput;
|
|
257
|
-
[IOType.AudioOutput]: AudioOutput;
|
|
258
|
-
[IOType.PolyAudioInput]: PolyAudioInput;
|
|
259
|
-
[IOType.PolyAudioOutput]: PolyAudioOutput;
|
|
260
|
-
[IOType.MidiInput]: MidiInput;
|
|
261
|
-
[IOType.MidiOutput]: MidiOutput;
|
|
262
|
-
};
|
|
263
|
-
declare abstract class IOCollection<T extends CollectionType> {
|
|
264
|
-
module: Module<ModuleType> | PolyModule<ModuleType>;
|
|
265
|
-
collection: Base[];
|
|
266
|
-
collectionType: T;
|
|
267
|
-
constructor(collectionType: T, module: Module<ModuleType> | PolyModule<ModuleType>);
|
|
268
|
-
add<TT extends IMappedIOProps[T]>(props: TT): IIOTypeTOClass[TT["ioType"]];
|
|
269
|
-
unPlugAll(): void;
|
|
270
|
-
rePlugAll(callback?: () => void): void;
|
|
271
|
-
find(id: string): Base;
|
|
272
|
-
findByName(name: string): Base;
|
|
273
|
-
serialize(): IIOSerialize[];
|
|
274
|
-
private validateUniqName;
|
|
275
|
-
}
|
|
276
|
-
declare class InputCollection extends IOCollection<CollectionType.Input> {
|
|
277
|
-
constructor(module: Module<ModuleType> | PolyModule<ModuleType>);
|
|
278
|
-
}
|
|
279
|
-
declare class OutputCollection extends IOCollection<CollectionType.Output> {
|
|
280
|
-
constructor(module: Module<ModuleType> | PolyModule<ModuleType>);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
type IPolyModule<T extends ModuleType> = Omit<IModule<T>, "voiceNo"> & {
|
|
284
|
-
voices: number;
|
|
285
|
-
};
|
|
286
|
-
type IPolyModuleSerialize<T extends ModuleType> = IPolyModule<T> & {
|
|
287
|
-
inputs: IIOSerialize[];
|
|
288
|
-
outputs: IIOSerialize[];
|
|
289
|
-
};
|
|
290
|
-
type IPolyModuleConstructor<T extends ModuleType> = Optional<IPolyModule<T>, "id"> & {
|
|
291
|
-
monoModuleConstructor: (engineId: string, params: IModuleConstructor<T>) => Module<T>;
|
|
292
|
-
};
|
|
293
|
-
declare abstract class PolyModule<T extends ModuleType> implements IPolyModule<T> {
|
|
294
|
-
id: string;
|
|
295
|
-
engineId: string;
|
|
296
|
-
moduleType: T;
|
|
297
|
-
audioModules: Module<T>[];
|
|
298
|
-
inputs: InputCollection;
|
|
299
|
-
outputs: OutputCollection;
|
|
300
|
-
protected monoModuleConstructor: IPolyModuleConstructor<T>["monoModuleConstructor"];
|
|
301
|
-
protected _props: ModuleTypeToPropsMapping[T];
|
|
302
|
-
private _voices;
|
|
303
|
-
private _name;
|
|
304
|
-
private pendingUIUpdates;
|
|
305
|
-
constructor(engineId: string, params: IPolyModuleConstructor<T>);
|
|
306
|
-
get name(): string;
|
|
307
|
-
set name(value: string);
|
|
308
|
-
get props(): ModuleTypeToPropsMapping[T];
|
|
309
|
-
set props(value: Partial<ModuleTypeToPropsMapping[T]>);
|
|
310
|
-
get voices(): number;
|
|
311
|
-
set voices(value: number);
|
|
312
|
-
start(time: ContextTime): void;
|
|
313
|
-
stop(time: ContextTime): void;
|
|
314
|
-
serialize(): IPolyModuleSerialize<T>;
|
|
315
|
-
plug({ audioModule, from, to, }: {
|
|
316
|
-
audioModule: Module<ModuleType> | PolyModule<ModuleType>;
|
|
317
|
-
from: string;
|
|
318
|
-
to: string;
|
|
319
|
-
}): void;
|
|
320
|
-
rePlugAll(callback?: () => void): void;
|
|
321
|
-
protected unPlugAll(): void;
|
|
322
|
-
dispose(): void;
|
|
323
|
-
onMidiEvent: (midiEvent: MidiEvent) => void;
|
|
324
|
-
triggerPropsUpdate: () => void;
|
|
325
|
-
private sheduleTriggerUpdate;
|
|
326
|
-
findVoice(voiceNo: number): Module<T>;
|
|
327
|
-
protected registerDefaultIOs(value?: "both" | "in" | "out"): void;
|
|
328
|
-
protected registerAudioInput(props: Omit<PolyAudioInputProps, "ioType">): PolyAudioInput;
|
|
329
|
-
protected registerAudioOutput(props: Omit<PolyAudioOutputProps, "ioType">): PolyAudioOutput;
|
|
330
|
-
protected registerMidiInput(props: Omit<MidiInputProps, "ioType">): MidiInput;
|
|
331
|
-
protected registerMidiOutput(props: Omit<MidiOutputProps, "ioType">): MidiOutput;
|
|
332
|
-
private adjustNumberOfModules;
|
|
333
|
-
protected get engine(): Engine;
|
|
334
|
-
protected get context(): _blibliki_utils.Context;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
type BasePropType = {
|
|
338
|
-
label?: string;
|
|
339
|
-
description?: string;
|
|
340
|
-
};
|
|
341
|
-
type NumberProp = BasePropType & {
|
|
342
|
-
kind: "number";
|
|
343
|
-
min?: number;
|
|
344
|
-
max?: number;
|
|
345
|
-
step?: number;
|
|
346
|
-
exp?: number;
|
|
347
|
-
};
|
|
348
|
-
type EnumProp<T extends string | number> = BasePropType & {
|
|
349
|
-
kind: "enum";
|
|
350
|
-
options: T[];
|
|
351
|
-
};
|
|
352
|
-
type StringProp = BasePropType & {
|
|
353
|
-
kind: "string";
|
|
354
|
-
pattern?: RegExp;
|
|
355
|
-
};
|
|
356
|
-
type BooleanProp = BasePropType & {
|
|
357
|
-
kind: "boolean";
|
|
358
|
-
};
|
|
359
|
-
type ArrayProp = BasePropType & {
|
|
360
|
-
kind: "array";
|
|
361
|
-
};
|
|
362
|
-
type PropSchema = NumberProp | EnumProp<string> | EnumProp<number> | StringProp | BooleanProp | ArrayProp;
|
|
363
|
-
type PrimarySchemaForType<T> = T extends boolean ? BooleanProp : T extends string ? StringProp : T extends number ? NumberProp : T extends unknown[] ? ArrayProp : never;
|
|
364
|
-
/**
|
|
365
|
-
* Schema type that maps each property to its primary schema type, with optional overrides.
|
|
366
|
-
* This provides excellent IntelliSense for both simple and complex cases.
|
|
367
|
-
*
|
|
368
|
-
* Basic usage:
|
|
369
|
-
* ```typescript
|
|
370
|
-
* type MyProps = { count: number; name: string; enabled: boolean };
|
|
371
|
-
* const mySchema: ModulePropSchema<MyProps> = {
|
|
372
|
-
* count: { kind: "number", min: 0, max: 100 },
|
|
373
|
-
* name: { kind: "string" },
|
|
374
|
-
* enabled: { kind: "boolean" }
|
|
375
|
-
* };
|
|
376
|
-
* ```
|
|
377
|
-
*
|
|
378
|
-
* With overrides for custom schema types:
|
|
379
|
-
* ```typescript
|
|
380
|
-
* type MyProps = { wave: OscillatorWave; frequency: number };
|
|
381
|
-
* const mySchema: ModulePropSchema<MyProps, {
|
|
382
|
-
* wave: EnumProp<OscillatorWave>
|
|
383
|
-
* }> = {
|
|
384
|
-
* wave: { kind: "enum", options: Object.values(OscillatorWave) },
|
|
385
|
-
* frequency: { kind: "number", min: 0, max: 1000 }
|
|
386
|
-
* };
|
|
387
|
-
* ```
|
|
388
|
-
*/
|
|
389
|
-
type ModulePropSchema<T, TOverrides extends Partial<Record<keyof T, PropSchema>> = EmptyObject> = {
|
|
390
|
-
[K in keyof T]: K extends keyof TOverrides ? TOverrides[K] : PrimarySchemaForType<T[K]>;
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
type IOscillator = IModule<ModuleType.Oscillator>;
|
|
394
|
-
declare enum OscillatorWave {
|
|
395
|
-
sine = "sine",
|
|
396
|
-
triangle = "triangle",
|
|
397
|
-
square = "square",
|
|
398
|
-
sawtooth = "sawtooth"
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Props for the Oscillator module.
|
|
402
|
-
*
|
|
403
|
-
* @property wave - Waveform shape of the oscillator.
|
|
404
|
-
* One of: "sine", "square", "sawtooth", "triangle", or "custom".
|
|
405
|
-
* @property frequency - Base frequency in Hz (e.g. 440 for A4).
|
|
406
|
-
* @property fine - Fine tuning factor in the range [-1, 1], where ±1 represents ±1 semitone.
|
|
407
|
-
* @property coarse - Coarse tuning factor in the range [-1, 1], scaled to ±12 semitones.
|
|
408
|
-
* @property octave - Octave transposition value (e.g. +1 for one octave up, -2 for two octaves down).
|
|
409
|
-
* @property lowGain - Whether to gain reduction (-18dB). When false, oscillator runs at full gain.
|
|
410
|
-
*/
|
|
411
|
-
type IOscillatorProps = {
|
|
412
|
-
wave: OscillatorWave;
|
|
413
|
-
frequency: number;
|
|
414
|
-
fine: number;
|
|
415
|
-
coarse: number;
|
|
416
|
-
octave: number;
|
|
417
|
-
lowGain: boolean;
|
|
418
|
-
};
|
|
419
|
-
declare class Oscillator extends PolyModule<ModuleType.Oscillator> {
|
|
420
|
-
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Oscillator>);
|
|
421
|
-
start(time: ContextTime): void;
|
|
422
|
-
stop(time: ContextTime): void;
|
|
423
|
-
private registerInputs;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
type IVoiceSchedulerProps = EmptyObject;
|
|
427
|
-
declare class Voice extends Module<ModuleType.VoiceScheduler> {
|
|
428
|
-
audioNode: undefined;
|
|
429
|
-
activeNote: string | null;
|
|
430
|
-
triggeredAt: ContextTime;
|
|
431
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.VoiceScheduler>);
|
|
432
|
-
midiTriggered: (midiEvent: MidiEvent) => void;
|
|
433
|
-
}
|
|
434
|
-
declare class VoiceScheduler extends PolyModule<ModuleType.VoiceScheduler> {
|
|
435
|
-
audioModules: Voice[];
|
|
436
|
-
midiOutput: MidiOutput;
|
|
437
|
-
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.VoiceScheduler>);
|
|
438
|
-
onMidiEvent: (midiEvent: MidiEvent) => void;
|
|
439
|
-
private findFreeVoice;
|
|
440
|
-
private registerInputs;
|
|
441
|
-
private registerOutputs;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
type IConstantProps = {
|
|
445
|
-
value: number;
|
|
446
|
-
};
|
|
447
|
-
declare class Constant extends Module<ModuleType.Constant> implements Pick<SetterHooks<IConstantProps>, "onAfterSetValue"> {
|
|
448
|
-
audioNode: ConstantSourceNode;
|
|
449
|
-
isStated: boolean;
|
|
450
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.Constant>);
|
|
451
|
-
onAfterSetValue: SetterHooks<IConstantProps>["onAfterSetValue"];
|
|
452
|
-
start(time: ContextTime): void;
|
|
453
|
-
stop(time: ContextTime): void;
|
|
454
|
-
triggerAttack: (note: Note, triggeredAt: ContextTime) => void;
|
|
455
|
-
triggerRelease: () => void;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
type IEnvelopeProps = {
|
|
459
|
-
attack: number;
|
|
460
|
-
decay: number;
|
|
461
|
-
sustain: number;
|
|
462
|
-
release: number;
|
|
463
|
-
};
|
|
464
|
-
declare class Envelope extends PolyModule<ModuleType.Envelope> {
|
|
465
|
-
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Envelope>);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
type IFilterProps = {
|
|
469
|
-
cutoff: number;
|
|
470
|
-
envelopeAmount: number;
|
|
471
|
-
type: BiquadFilterType;
|
|
472
|
-
Q: number;
|
|
473
|
-
};
|
|
474
|
-
declare class Filter extends PolyModule<ModuleType.Filter> {
|
|
475
|
-
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Filter>);
|
|
476
|
-
private registerInputs;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
type IGain = IModule<ModuleType.Gain>;
|
|
480
|
-
type IGainProps = {
|
|
481
|
-
gain: number;
|
|
482
|
-
};
|
|
483
|
-
declare class Gain extends PolyModule<ModuleType.Gain> {
|
|
484
|
-
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Gain>);
|
|
485
|
-
private registerAdditionalInputs;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
type IInspectorProps = {
|
|
489
|
-
fftSize: number;
|
|
490
|
-
};
|
|
491
|
-
declare class Inspector extends Module<ModuleType.Inspector> implements Pick<SetterHooks<IInspectorProps>, "onAfterSetFftSize"> {
|
|
492
|
-
audioNode: AnalyserNode;
|
|
493
|
-
private _buffer?;
|
|
494
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.Inspector>);
|
|
495
|
-
onAfterSetFftSize: SetterHooks<IInspectorProps>["onAfterSetFftSize"];
|
|
496
|
-
get buffer(): Float32Array<ArrayBuffer>;
|
|
497
|
-
getValue(): number;
|
|
498
|
-
getValues(): Float32Array;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
type IMaster = IModule<ModuleType.Master>;
|
|
502
|
-
type IMasterProps = EmptyObject;
|
|
503
|
-
declare class Master extends Module<ModuleType.Master> {
|
|
504
|
-
audioNode: AudioDestinationNode;
|
|
505
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.Master>);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
type IMidiMapper = IModule<ModuleType.MidiMapper>;
|
|
509
|
-
type IMidiMapperProps = {
|
|
510
|
-
pages: MidiMappingPage[];
|
|
511
|
-
activePage: number;
|
|
512
|
-
globalMappings: MidiMapping<ModuleType>[];
|
|
513
|
-
};
|
|
514
|
-
type MidiMappingPage = {
|
|
515
|
-
name?: string;
|
|
516
|
-
mappings: MidiMapping<ModuleType>[];
|
|
517
|
-
};
|
|
518
|
-
declare enum MidiMappingMode {
|
|
519
|
-
direct = "direct",
|
|
520
|
-
directRev = "directRev",
|
|
521
|
-
toggleInc = "toggleInc",
|
|
522
|
-
toggleDec = "toggleDec",
|
|
523
|
-
incDec = "incDec",
|
|
524
|
-
incDecRev = "incDecRev"
|
|
525
|
-
}
|
|
526
|
-
type MidiMapping<T extends ModuleType> = {
|
|
527
|
-
cc?: number;
|
|
528
|
-
moduleId?: string;
|
|
529
|
-
moduleType?: T;
|
|
530
|
-
propName?: string;
|
|
531
|
-
autoAssign?: boolean;
|
|
532
|
-
mode?: MidiMappingMode;
|
|
533
|
-
threshold?: number;
|
|
534
|
-
step?: number;
|
|
535
|
-
};
|
|
536
|
-
type MidiMapperSetterHooks = Pick<SetterHooks<IMidiMapperProps>, "onSetActivePage">;
|
|
537
|
-
declare class MidiMapper extends Module<ModuleType.MidiMapper> implements MidiMapperSetterHooks {
|
|
538
|
-
audioNode: undefined;
|
|
539
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.MidiMapper>);
|
|
540
|
-
onSetActivePage: MidiMapperSetterHooks["onSetActivePage"];
|
|
541
|
-
handleCC: (event: MidiEvent, triggeredAt: ContextTime) => void;
|
|
542
|
-
forwardMapping: (event: MidiEvent, mapping: MidiMapping<ModuleType>, _triggeredAt: ContextTime) => void;
|
|
543
|
-
private checkAutoAssign;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
type IMidiSelectorProps = {
|
|
547
|
-
selectedId: string | undefined | null;
|
|
548
|
-
selectedName: string | undefined | null;
|
|
549
|
-
};
|
|
550
|
-
declare class MidiSelector extends Module<ModuleType.MidiSelector> implements Pick<SetterHooks<IMidiSelectorProps>, "onSetSelectedId"> {
|
|
551
|
-
audioNode: undefined;
|
|
552
|
-
midiOutput: MidiOutput;
|
|
553
|
-
_forwardMidiEvent?: (midiEvent: MidiEvent) => void;
|
|
554
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.MidiSelector>);
|
|
555
|
-
onSetSelectedId: SetterHooks<IMidiSelectorProps>["onSetSelectedId"];
|
|
556
|
-
private get forwardMidiEvent();
|
|
557
|
-
private addEventListener;
|
|
558
|
-
private removeEventListener;
|
|
559
|
-
private registerOutputs;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
type IScaleProps = {
|
|
563
|
-
min: number;
|
|
564
|
-
max: number;
|
|
565
|
-
current: number;
|
|
566
|
-
};
|
|
567
|
-
declare class Scale extends Module<ModuleType.Scale> implements Pick<SetterHooks<IScaleProps>, "onAfterSetMin" | "onAfterSetMax" | "onAfterSetCurrent"> {
|
|
568
|
-
audioNode: AudioWorkletNode;
|
|
569
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.Scale>);
|
|
570
|
-
get current(): AudioParam;
|
|
571
|
-
get min(): AudioParam;
|
|
572
|
-
get max(): AudioParam;
|
|
573
|
-
onAfterSetMin: SetterHooks<IScaleProps>["onAfterSetMin"];
|
|
574
|
-
onAfterSetMax: SetterHooks<IScaleProps>["onAfterSetMax"];
|
|
575
|
-
onAfterSetCurrent: SetterHooks<IScaleProps>["onAfterSetCurrent"];
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
type IStepSequencer = IModule<ModuleType.StepSequencer>;
|
|
579
|
-
type ISequence = {
|
|
580
|
-
active: boolean;
|
|
581
|
-
duration: string;
|
|
582
|
-
notes: INote[];
|
|
583
|
-
};
|
|
584
|
-
type IStepSequencerProps = {
|
|
585
|
-
bars: number;
|
|
586
|
-
steps: number;
|
|
587
|
-
sequences: ISequence[][];
|
|
588
|
-
};
|
|
589
|
-
declare class StepSequencer extends Module<ModuleType.StepSequencer> {
|
|
590
|
-
audioNode: undefined;
|
|
591
|
-
midiOutput: MidiOutput;
|
|
592
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.StepSequencer>);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
type IStereoPannerProps = {
|
|
596
|
-
pan: number;
|
|
597
|
-
};
|
|
598
|
-
declare class StereoPanner extends PolyModule<ModuleType.StereoPanner> {
|
|
599
|
-
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.StereoPanner>);
|
|
600
|
-
private registerAdditionalInputs;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
type IVirtualMidiProps = {
|
|
604
|
-
activeNotes: string[];
|
|
605
|
-
};
|
|
606
|
-
declare class VirtualMidi extends Module<ModuleType.VirtualMidi> {
|
|
607
|
-
audioNode: undefined;
|
|
608
|
-
midiOutput: MidiOutput;
|
|
609
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.VirtualMidi>);
|
|
610
|
-
sendMidi(midiEvent: MidiEvent): void;
|
|
611
|
-
triggerAttack: (note: Note, triggerAttack: ContextTime) => void;
|
|
612
|
-
triggerRelease: (note: Note, triggerAttack: ContextTime) => void;
|
|
613
|
-
private registerInputs;
|
|
614
|
-
private registerOutputs;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
declare enum ModuleType {
|
|
618
|
-
Master = "Master",
|
|
619
|
-
Oscillator = "Oscillator",
|
|
620
|
-
Gain = "Gain",
|
|
621
|
-
MidiSelector = "MidiSelector",
|
|
622
|
-
Envelope = "Envelope",
|
|
623
|
-
Filter = "Filter",
|
|
624
|
-
Scale = "Scale",
|
|
625
|
-
StereoPanner = "StereoPanner",
|
|
626
|
-
Inspector = "Inspector",
|
|
627
|
-
Constant = "Constant",
|
|
628
|
-
MidiMapper = "MidiMapper",
|
|
629
|
-
VirtualMidi = "VirtualMidi",
|
|
630
|
-
StepSequencer = "StepSequencer",
|
|
631
|
-
VoiceScheduler = "VoiceScheduler"
|
|
632
|
-
}
|
|
633
|
-
type ModuleTypeToPropsMapping = {
|
|
634
|
-
[ModuleType.Oscillator]: IOscillatorProps;
|
|
635
|
-
[ModuleType.Gain]: IGainProps;
|
|
636
|
-
[ModuleType.Master]: IMasterProps;
|
|
637
|
-
[ModuleType.MidiSelector]: IMidiSelectorProps;
|
|
638
|
-
[ModuleType.Envelope]: IEnvelopeProps;
|
|
639
|
-
[ModuleType.Filter]: IFilterProps;
|
|
640
|
-
[ModuleType.Scale]: IScaleProps;
|
|
641
|
-
[ModuleType.StereoPanner]: IStereoPannerProps;
|
|
642
|
-
[ModuleType.Inspector]: IInspectorProps;
|
|
643
|
-
[ModuleType.Constant]: IConstantProps;
|
|
644
|
-
[ModuleType.MidiMapper]: IMidiMapperProps;
|
|
645
|
-
[ModuleType.VirtualMidi]: IVirtualMidiProps;
|
|
646
|
-
[ModuleType.StepSequencer]: IStepSequencerProps;
|
|
647
|
-
[ModuleType.VoiceScheduler]: IVoiceSchedulerProps;
|
|
648
|
-
};
|
|
649
|
-
type ModuleTypeToModuleMapping = {
|
|
650
|
-
[ModuleType.Oscillator]: Oscillator;
|
|
651
|
-
[ModuleType.Gain]: Gain;
|
|
652
|
-
[ModuleType.Master]: Master;
|
|
653
|
-
[ModuleType.MidiSelector]: MidiSelector;
|
|
654
|
-
[ModuleType.Envelope]: Envelope;
|
|
655
|
-
[ModuleType.Filter]: Filter;
|
|
656
|
-
[ModuleType.Scale]: Scale;
|
|
657
|
-
[ModuleType.StereoPanner]: StereoPanner;
|
|
658
|
-
[ModuleType.Inspector]: Inspector;
|
|
659
|
-
[ModuleType.Constant]: Constant;
|
|
660
|
-
[ModuleType.MidiMapper]: MidiMapper;
|
|
661
|
-
[ModuleType.VirtualMidi]: VirtualMidi;
|
|
662
|
-
[ModuleType.StepSequencer]: StepSequencer;
|
|
663
|
-
[ModuleType.VoiceScheduler]: VoiceScheduler;
|
|
664
|
-
};
|
|
665
|
-
declare const moduleSchemas: {
|
|
666
|
-
Oscillator: ModulePropSchema<IOscillatorProps, {
|
|
667
|
-
wave: EnumProp<OscillatorWave>;
|
|
668
|
-
}>;
|
|
669
|
-
Gain: ModulePropSchema<IGainProps, _blibliki_utils.EmptyObject>;
|
|
670
|
-
Master: ModulePropSchema<_blibliki_utils.EmptyObject, _blibliki_utils.EmptyObject>;
|
|
671
|
-
MidiSelector: ModulePropSchema<IMidiSelectorProps, _blibliki_utils.EmptyObject>;
|
|
672
|
-
Envelope: ModulePropSchema<IEnvelopeProps, _blibliki_utils.EmptyObject>;
|
|
673
|
-
Filter: ModulePropSchema<IFilterProps, {
|
|
674
|
-
type: EnumProp<BiquadFilterType>;
|
|
675
|
-
}>;
|
|
676
|
-
Scale: ModulePropSchema<IScaleProps, _blibliki_utils.EmptyObject>;
|
|
677
|
-
StereoPanner: ModulePropSchema<IStereoPannerProps, _blibliki_utils.EmptyObject>;
|
|
678
|
-
Inspector: ModulePropSchema<IInspectorProps, {
|
|
679
|
-
fftSize: EnumProp<number>;
|
|
680
|
-
}>;
|
|
681
|
-
Constant: ModulePropSchema<IConstantProps, _blibliki_utils.EmptyObject>;
|
|
682
|
-
MidiMapper: ModulePropSchema<IMidiMapperProps, _blibliki_utils.EmptyObject>;
|
|
683
|
-
VirtualMidi: ModulePropSchema<IVirtualMidiProps, _blibliki_utils.EmptyObject>;
|
|
684
|
-
StepSequencer: ModulePropSchema<Omit<IStepSequencerProps, "sequences">, _blibliki_utils.EmptyObject>;
|
|
685
|
-
VoiceScheduler: ModulePropSchema<_blibliki_utils.EmptyObject, _blibliki_utils.EmptyObject>;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
type AnyModule = Module<ModuleType>;
|
|
689
|
-
type ICreateModule<T extends ModuleType> = {
|
|
690
|
-
id?: string;
|
|
691
|
-
name: string;
|
|
692
|
-
moduleType: T;
|
|
693
|
-
props: Partial<ModuleTypeToPropsMapping[T]>;
|
|
694
|
-
};
|
|
695
|
-
type ModuleParams = {
|
|
696
|
-
[K in ModuleType]: K extends ModuleType.Oscillator | ModuleType.Gain | ModuleType.Envelope | ModuleType.Filter | ModuleType.StereoPanner | ModuleType.VoiceScheduler ? IPolyModuleConstructor<K> : ICreateModule<K>;
|
|
697
|
-
}[ModuleType];
|
|
698
|
-
|
|
699
|
-
type IModule<T extends ModuleType> = {
|
|
700
|
-
id: string;
|
|
701
|
-
name: string;
|
|
702
|
-
voiceNo: number;
|
|
703
|
-
moduleType: T;
|
|
704
|
-
props: ModuleTypeToPropsMapping[T];
|
|
705
|
-
};
|
|
706
|
-
type IModuleSerialize<T extends ModuleType> = IModule<T> & {
|
|
707
|
-
inputs: IIOSerialize[];
|
|
708
|
-
outputs: IIOSerialize[];
|
|
709
|
-
};
|
|
710
|
-
type IModuleConstructor<T extends ModuleType> = Optional<IModule<T>, "id" | "voiceNo"> & {
|
|
711
|
-
audioNodeConstructor?: (context: Context) => AudioNode;
|
|
712
|
-
};
|
|
713
|
-
type SetterHooks<P> = {
|
|
714
|
-
[K in keyof P as `onSet${Capitalize<string & K>}`]: (value: P[K]) => P[K];
|
|
715
|
-
} & {
|
|
716
|
-
[K in keyof P as `onAfterSet${Capitalize<string & K>}`]: (value: P[K]) => void;
|
|
717
|
-
};
|
|
718
|
-
declare abstract class Module<T extends ModuleType> implements IModule<T> {
|
|
719
|
-
id: string;
|
|
720
|
-
engineId: string;
|
|
721
|
-
name: string;
|
|
722
|
-
moduleType: T;
|
|
723
|
-
voiceNo: number;
|
|
724
|
-
audioNode: AudioNode | undefined;
|
|
725
|
-
inputs: InputCollection;
|
|
726
|
-
outputs: OutputCollection;
|
|
727
|
-
protected _props: ModuleTypeToPropsMapping[T];
|
|
728
|
-
protected activeNotes: Note[];
|
|
729
|
-
private pendingUIUpdates;
|
|
730
|
-
constructor(engineId: string, params: IModuleConstructor<T>);
|
|
731
|
-
get props(): ModuleTypeToPropsMapping[T];
|
|
732
|
-
set props(value: Partial<ModuleTypeToPropsMapping[T]>);
|
|
733
|
-
private callPropHook;
|
|
734
|
-
serialize(): IModuleSerialize<T>;
|
|
735
|
-
plug({ audioModule, from, to, }: {
|
|
736
|
-
audioModule: AnyModule;
|
|
737
|
-
from: string;
|
|
738
|
-
to: string;
|
|
739
|
-
}): void;
|
|
740
|
-
protected rePlugAll(callback?: () => void): void;
|
|
741
|
-
protected unPlugAll(): void;
|
|
742
|
-
start(_time: ContextTime): void;
|
|
743
|
-
stop(_time: ContextTime): void;
|
|
744
|
-
triggerAttack(note: Note, _triggeredAt: ContextTime): void;
|
|
745
|
-
triggerRelease(note: Note, _triggeredAt: ContextTime): void;
|
|
746
|
-
handleCC(_event: MidiEvent, _triggeredAt: ContextTime): void;
|
|
747
|
-
onMidiEvent: (midiEvent: MidiEvent) => void;
|
|
748
|
-
triggerPropsUpdate: () => void;
|
|
749
|
-
private sheduleTriggerUpdate;
|
|
750
|
-
dispose(): void;
|
|
751
|
-
protected registerDefaultIOs(value?: "both" | "in" | "out"): void;
|
|
752
|
-
protected registerAudioInput(props: Omit<AudioInputProps, "ioType">): AudioInput;
|
|
753
|
-
protected registerAudioOutput(props: Omit<AudioOutputProps, "ioType">): AudioOutput;
|
|
754
|
-
protected registerMidiInput(props: Omit<MidiInputProps, "ioType">): MidiInput;
|
|
755
|
-
protected registerMidiOutput(props: Omit<MidiOutputProps, "ioType">): MidiOutput;
|
|
756
|
-
protected get engine(): Engine;
|
|
757
|
-
protected get context(): Context;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
type IPlug = {
|
|
761
|
-
moduleId: string;
|
|
762
|
-
ioName: string;
|
|
763
|
-
};
|
|
764
|
-
type IRoute = {
|
|
765
|
-
id: string;
|
|
766
|
-
source: IPlug;
|
|
767
|
-
destination: IPlug;
|
|
768
|
-
};
|
|
769
|
-
declare class Routes {
|
|
770
|
-
engine: Engine;
|
|
771
|
-
routes: Map<string, IRoute>;
|
|
772
|
-
constructor(engine: Engine);
|
|
773
|
-
addRoute(props: Optional<IRoute, "id">): IRoute;
|
|
774
|
-
removeRoute(id: string): void;
|
|
775
|
-
clear(): void;
|
|
776
|
-
replug(): void;
|
|
777
|
-
serialize(): IRoute[];
|
|
778
|
-
private plug;
|
|
779
|
-
private unPlug;
|
|
780
|
-
private find;
|
|
781
|
-
private getIOs;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
type ListenerCallback = (device: MidiDevice) => void;
|
|
785
|
-
declare class MidiDeviceManager {
|
|
786
|
-
devices: Map<string, MidiDevice | ComputerKeyboardInput>;
|
|
787
|
-
private initialized;
|
|
788
|
-
private listeners;
|
|
789
|
-
private context;
|
|
790
|
-
private midiAccess;
|
|
791
|
-
private adapter;
|
|
792
|
-
constructor(context: Context);
|
|
793
|
-
initialize(): Promise<void>;
|
|
794
|
-
find(id: string): MidiDevice | ComputerKeyboardInput | undefined;
|
|
795
|
-
findByName(name: string): MidiDevice | ComputerKeyboardInput | undefined;
|
|
796
|
-
addListener(callback: ListenerCallback): void;
|
|
797
|
-
private initializeDevices;
|
|
798
|
-
private addComputerKeyboard;
|
|
799
|
-
private listenChanges;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
type IUpdateModule<T extends ModuleType> = {
|
|
803
|
-
id: string;
|
|
804
|
-
moduleType: T;
|
|
805
|
-
changes: Partial<Omit<ICreateModule<T>, "id" | "moduleType" | "voice">> & {
|
|
806
|
-
voices?: number;
|
|
807
|
-
};
|
|
808
|
-
};
|
|
809
|
-
type ICreateRoute = Optional<IRoute, "id">;
|
|
810
|
-
interface IEngineSerialize {
|
|
811
|
-
bpm: BPM;
|
|
812
|
-
timeSignature: TimeSignature;
|
|
813
|
-
modules: (IModuleSerialize<ModuleType> | IPolyModuleSerialize<ModuleType>)[];
|
|
814
|
-
routes: IRoute[];
|
|
815
|
-
}
|
|
816
|
-
declare class Engine {
|
|
817
|
-
private static _engines;
|
|
818
|
-
private static _currentId;
|
|
819
|
-
private propsUpdateCallbacks;
|
|
820
|
-
readonly id: string;
|
|
821
|
-
context: Context;
|
|
822
|
-
isInitialized: boolean;
|
|
823
|
-
routes: Routes;
|
|
824
|
-
transport: Transport<TransportEvent>;
|
|
825
|
-
modules: Map<string, ModuleTypeToModuleMapping[keyof ModuleTypeToModuleMapping]>;
|
|
826
|
-
midiDeviceManager: MidiDeviceManager;
|
|
827
|
-
static getById(id: string): Engine;
|
|
828
|
-
static get current(): Engine;
|
|
829
|
-
static load(data: IEngineSerialize): Promise<Engine>;
|
|
830
|
-
constructor(context: Context);
|
|
831
|
-
get state(): _blibliki_transport.TransportState;
|
|
832
|
-
initialize(): Promise<void>;
|
|
833
|
-
addModule<T extends ModuleType>(params: ICreateModule<T>): IModuleSerialize<ModuleType.Scale> | IPolyModuleSerialize<ModuleType.VoiceScheduler> | IPolyModuleSerialize<ModuleType.Envelope> | IPolyModuleSerialize<ModuleType.Gain> | IPolyModuleSerialize<ModuleType.Oscillator> | IPolyModuleSerialize<ModuleType.Filter> | IPolyModuleSerialize<ModuleType.StereoPanner> | IModuleSerialize<ModuleType.Constant> | IModuleSerialize<ModuleType.Master> | IModuleSerialize<ModuleType.MidiSelector> | IModuleSerialize<ModuleType.Inspector> | IModuleSerialize<ModuleType.MidiMapper> | IModuleSerialize<ModuleType.VirtualMidi> | IModuleSerialize<ModuleType.StepSequencer>;
|
|
834
|
-
updateModule<T extends ModuleType>(params: IUpdateModule<T>): IModuleSerialize<ModuleType.Scale> | IPolyModuleSerialize<ModuleType.VoiceScheduler> | IPolyModuleSerialize<ModuleType.Envelope> | IPolyModuleSerialize<ModuleType.Gain> | IPolyModuleSerialize<ModuleType.Oscillator> | IPolyModuleSerialize<ModuleType.Filter> | IPolyModuleSerialize<ModuleType.StereoPanner> | IModuleSerialize<ModuleType.Constant> | IModuleSerialize<ModuleType.Master> | IModuleSerialize<ModuleType.MidiSelector> | IModuleSerialize<ModuleType.Inspector> | IModuleSerialize<ModuleType.MidiMapper> | IModuleSerialize<ModuleType.VirtualMidi> | IModuleSerialize<ModuleType.StepSequencer>;
|
|
835
|
-
removeModule(id: string): void;
|
|
836
|
-
addRoute(props: ICreateRoute): IRoute;
|
|
837
|
-
removeRoute(id: string): void;
|
|
838
|
-
validRoute(props: Optional<IRoute, "id">): boolean;
|
|
839
|
-
start(): Promise<void>;
|
|
840
|
-
stop(): void;
|
|
841
|
-
pause(): void;
|
|
842
|
-
get bpm(): number;
|
|
843
|
-
set bpm(value: number);
|
|
844
|
-
get timeSignature(): TimeSignature;
|
|
845
|
-
set timeSignature(value: TimeSignature);
|
|
846
|
-
resume(): Promise<void>;
|
|
847
|
-
dispose(): void;
|
|
848
|
-
serialize(): IEngineSerialize;
|
|
849
|
-
findModule(id: string): ModuleTypeToModuleMapping[keyof ModuleTypeToModuleMapping];
|
|
850
|
-
findIO(moduleId: string, ioName: string, type: "input" | "output"): Base;
|
|
851
|
-
findMidiDevice(id: string): MidiDevice | ComputerKeyboardInput | undefined;
|
|
852
|
-
findMidiDeviceByName(name: string): MidiDevice | ComputerKeyboardInput | undefined;
|
|
853
|
-
onPropsUpdate(callback: <T extends ModuleType>(params: IModule<T> | IPolyModule<T>) => void): void;
|
|
854
|
-
_triggerPropsUpdate<T extends ModuleType>(params: IModule<T> | IPolyModule<T>): void;
|
|
855
|
-
triggerVirtualMidi(id: string, noteName: string, type: "noteOn" | "noteOff"): void;
|
|
856
|
-
private onStart;
|
|
857
|
-
private onStop;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
export { type ArrayProp, type BooleanProp, Engine, type EnumProp, type ICreateModule, type ICreateRoute, type IEngineSerialize, type IGain, type IIOSerialize, type IMaster, type IMidiDevice, type IMidiMapper, type IMidiMapperProps, type IModule, type IModuleSerialize, type INote, type IOscillator, type IPolyModuleSerialize, type IRoute, type ISequence, type IStepSequencer, type IStepSequencerProps, type IUpdateModule, MidiDevice, type MidiMapping, MidiMappingMode, MidiPortState, type ModuleParams, type ModulePropSchema, ModuleType, type ModuleTypeToPropsMapping, Note, type NumberProp, OscillatorWave, type PropSchema, type StringProp, moduleSchemas };
|