@blibliki/engine 0.5.2 → 0.9.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/README.md +22 -2
- package/dist/index.d.ts +501 -107
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/Engine.ts +46 -29
- package/src/core/index.ts +11 -2
- package/src/core/midi/BaseMidiDevice.ts +47 -0
- package/src/core/midi/ComputerKeyboardDevice.ts +2 -1
- package/src/core/midi/MidiDeviceManager.ts +125 -31
- package/src/core/midi/{MidiDevice.ts → MidiInputDevice.ts} +6 -30
- package/src/core/midi/MidiOutputDevice.ts +23 -0
- package/src/core/midi/adapters/NodeMidiAdapter.ts +99 -13
- package/src/core/midi/adapters/WebMidiAdapter.ts +68 -10
- package/src/core/midi/adapters/types.ts +13 -4
- package/src/core/midi/controllers/BaseController.ts +14 -0
- package/src/core/module/Module.ts +121 -13
- package/src/core/module/PolyModule.ts +36 -0
- package/src/core/module/VoiceScheduler.ts +150 -10
- package/src/core/module/index.ts +9 -4
- package/src/index.ts +27 -3
- package/src/modules/Chorus.ts +222 -0
- package/src/modules/Constant.ts +2 -2
- package/src/modules/Delay.ts +347 -0
- package/src/modules/Distortion.ts +182 -0
- package/src/modules/Envelope.ts +158 -92
- package/src/modules/Filter.ts +7 -7
- package/src/modules/Gain.ts +2 -2
- package/src/modules/LFO.ts +287 -0
- package/src/modules/LegacyEnvelope.ts +146 -0
- package/src/modules/{MidiSelector.ts → MidiInput.ts} +26 -19
- package/src/modules/MidiMapper.ts +59 -4
- package/src/modules/MidiOutput.ts +121 -0
- package/src/modules/Noise.ts +259 -0
- package/src/modules/Oscillator.ts +9 -3
- package/src/modules/Reverb.ts +379 -0
- package/src/modules/Scale.ts +49 -4
- package/src/modules/StepSequencer.ts +410 -22
- package/src/modules/StereoPanner.ts +1 -1
- package/src/modules/index.ts +142 -29
- package/src/processors/custom-envelope-processor.ts +125 -0
- package/src/processors/index.ts +10 -0
- package/src/processors/lfo-processor.ts +123 -0
- package/src/processors/scale-processor.ts +42 -5
- package/src/utils/WetDryMixer.ts +123 -0
- package/src/utils/expandPatternSequence.ts +18 -0
- package/src/utils/index.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,57 @@ import * as _blibliki_utils from '@blibliki/utils';
|
|
|
2
2
|
import { Context, Optional, EmptyObject } from '@blibliki/utils';
|
|
3
3
|
export { Context } from '@blibliki/utils';
|
|
4
4
|
import * as _blibliki_transport from '@blibliki/transport';
|
|
5
|
-
import { Seconds, ContextTime,
|
|
6
|
-
export { Position, TimeSignature, TransportState } from '@blibliki/transport';
|
|
5
|
+
import { Seconds, ContextTime, Division, IPattern, Resolution, PlaybackMode, IStep, Transport, BPM, TimeSignature } from '@blibliki/transport';
|
|
6
|
+
export { BPM, IPage, IPattern, IStep, IStepCC, IStepNote, PlaybackMode, Position, Resolution, TimeSignature, TransportState } from '@blibliki/transport';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Platform-agnostic MIDI interfaces
|
|
10
|
+
* Allows switching between Web MIDI API and node-midi without refactoring
|
|
11
|
+
*/
|
|
12
|
+
interface IMidiMessageEvent {
|
|
13
|
+
data: Uint8Array;
|
|
14
|
+
timeStamp: number;
|
|
15
|
+
}
|
|
16
|
+
type MidiMessageCallback = (event: IMidiMessageEvent) => void;
|
|
17
|
+
interface IMidiInputPort extends IMidiPort {
|
|
18
|
+
addEventListener(callback: MidiMessageCallback): void;
|
|
19
|
+
removeEventListener(callback: MidiMessageCallback): void;
|
|
20
|
+
}
|
|
21
|
+
interface IMidiOutputPort extends IMidiPort {
|
|
22
|
+
send(data: number[] | Uint8Array, timestamp?: number): void;
|
|
23
|
+
}
|
|
24
|
+
interface IMidiPort {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly state: "connected" | "disconnected";
|
|
28
|
+
readonly type: "input" | "output";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare enum MidiPortState {
|
|
32
|
+
connected = "connected",
|
|
33
|
+
disconnected = "disconnected"
|
|
34
|
+
}
|
|
35
|
+
type IMidiDevice = {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
state: MidiPortState;
|
|
39
|
+
};
|
|
40
|
+
declare abstract class BaseMidiDevice<T extends IMidiPort> implements IMidiDevice {
|
|
41
|
+
protected midiPort: T;
|
|
42
|
+
constructor(props: T);
|
|
43
|
+
abstract connect(): void;
|
|
44
|
+
abstract disconnect(): void;
|
|
45
|
+
get id(): string;
|
|
46
|
+
get name(): string;
|
|
47
|
+
get type(): "input" | "output";
|
|
48
|
+
get state(): MidiPortState;
|
|
49
|
+
serialize(): {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
type: "input" | "output";
|
|
53
|
+
state: MidiPortState;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
7
56
|
|
|
8
57
|
/**
|
|
9
58
|
* Simple wrapper around MIDI message data (Uint8Array)
|
|
@@ -74,52 +123,20 @@ declare class MidiEvent {
|
|
|
74
123
|
clone(voiceNo?: number): MidiEvent;
|
|
75
124
|
}
|
|
76
125
|
|
|
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 = {
|
|
126
|
+
type IMidiInput = {
|
|
99
127
|
id: string;
|
|
100
128
|
name: string;
|
|
101
129
|
state: MidiPortState;
|
|
102
|
-
};
|
|
103
|
-
type IMidiInput = IMidiDevice & {
|
|
104
130
|
eventListerCallbacks: EventListerCallback[];
|
|
105
131
|
};
|
|
106
132
|
type EventListerCallback = (event: MidiEvent) => void;
|
|
107
|
-
declare class
|
|
108
|
-
id: string;
|
|
109
|
-
name: string;
|
|
133
|
+
declare class MidiInputDevice extends BaseMidiDevice<IMidiInputPort> {
|
|
110
134
|
eventListerCallbacks: EventListerCallback[];
|
|
111
135
|
private context;
|
|
112
|
-
private input;
|
|
113
136
|
private messageHandler;
|
|
114
137
|
constructor(input: IMidiInputPort, context: Context);
|
|
115
|
-
get state(): MidiPortState;
|
|
116
138
|
connect(): void;
|
|
117
139
|
disconnect(): void;
|
|
118
|
-
serialize(): {
|
|
119
|
-
id: string;
|
|
120
|
-
name: string;
|
|
121
|
-
state: MidiPortState;
|
|
122
|
-
};
|
|
123
140
|
addEventListener(callback: EventListerCallback): void;
|
|
124
141
|
removeEventListener(callback: EventListerCallback): void;
|
|
125
142
|
private processEvent;
|
|
@@ -207,6 +224,21 @@ declare abstract class PolyModule<T extends ModuleType> implements IPolyModule<T
|
|
|
207
224
|
private _voices;
|
|
208
225
|
private _name;
|
|
209
226
|
private pendingUIUpdates;
|
|
227
|
+
/**
|
|
228
|
+
* Factory method for creating modules with proper initialization timing.
|
|
229
|
+
*
|
|
230
|
+
* This method ensures hooks are called AFTER the child class constructor completes,
|
|
231
|
+
* solving the ES6 class field initialization problem where function properties like hooks
|
|
232
|
+
* aren't available during super() call.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* const gain = Module.create(Gain, engineId, {
|
|
236
|
+
* name: "gain",
|
|
237
|
+
* moduleType: ModuleType.Gain,
|
|
238
|
+
* props: { gain: 0.5 }
|
|
239
|
+
* });
|
|
240
|
+
*/
|
|
241
|
+
static create<T extends ModuleType, M extends PolyModule<T>>(ModuleClass: new (engineId: string, params: IPolyModuleConstructor<T>) => M, engineId: string, params: IPolyModuleConstructor<T>): M;
|
|
210
242
|
constructor(engineId: string, params: IPolyModuleConstructor<T>);
|
|
211
243
|
get name(): string;
|
|
212
244
|
set name(value: string);
|
|
@@ -232,8 +264,8 @@ declare abstract class PolyModule<T extends ModuleType> implements IPolyModule<T
|
|
|
232
264
|
protected registerDefaultIOs(value?: "both" | "in" | "out"): void;
|
|
233
265
|
protected registerAudioInput(props: Omit<PolyAudioInputProps, "ioType">): PolyAudioInput;
|
|
234
266
|
protected registerAudioOutput(props: Omit<PolyAudioOutputProps, "ioType">): PolyAudioOutput;
|
|
235
|
-
protected registerMidiInput(props: Omit<MidiInputProps, "ioType">): MidiInput;
|
|
236
|
-
protected registerMidiOutput(props: Omit<MidiOutputProps, "ioType">): MidiOutput;
|
|
267
|
+
protected registerMidiInput(props: Omit<MidiInputProps, "ioType">): MidiInput$1;
|
|
268
|
+
protected registerMidiOutput(props: Omit<MidiOutputProps, "ioType">): MidiOutput$1;
|
|
237
269
|
private adjustNumberOfModules;
|
|
238
270
|
protected get engine(): Engine;
|
|
239
271
|
protected get context(): _blibliki_utils.Context;
|
|
@@ -246,12 +278,12 @@ type MidiInputProps = IOProps & {
|
|
|
246
278
|
type MidiOutputProps = IOProps & {
|
|
247
279
|
ioType: IOType.MidiOutput;
|
|
248
280
|
};
|
|
249
|
-
declare class MidiInput extends IO<MidiOutput> implements MidiInputProps {
|
|
281
|
+
declare class MidiInput$1 extends IO<MidiOutput$1> implements MidiInputProps {
|
|
250
282
|
ioType: IOType.MidiInput;
|
|
251
283
|
onMidiEvent: MidiInputProps["onMidiEvent"];
|
|
252
284
|
constructor(module: Module<ModuleType> | PolyModule<ModuleType>, props: MidiInputProps);
|
|
253
285
|
}
|
|
254
|
-
declare class MidiOutput extends IO<MidiInput> implements MidiOutputProps {
|
|
286
|
+
declare class MidiOutput$1 extends IO<MidiInput$1> implements MidiOutputProps {
|
|
255
287
|
ioType: IOType.MidiOutput;
|
|
256
288
|
onMidiEvent: (event: MidiEvent) => void;
|
|
257
289
|
private get midiConnections();
|
|
@@ -289,7 +321,7 @@ declare abstract class Base implements IIO {
|
|
|
289
321
|
rePlugAll(callback?: () => void): void;
|
|
290
322
|
unPlugAll(): void;
|
|
291
323
|
isAudio(): this is AudioInput | AudioOutput | PolyAudioInput | PolyAudioOutput;
|
|
292
|
-
isMidi(): this is MidiInput | MidiOutput;
|
|
324
|
+
isMidi(): this is MidiInput$1 | MidiOutput$1;
|
|
293
325
|
serialize(): IIOSerialize;
|
|
294
326
|
}
|
|
295
327
|
declare abstract class IO<Connection extends Base> extends Base {
|
|
@@ -311,8 +343,8 @@ type IIOTypeTOClass = {
|
|
|
311
343
|
[IOType.AudioOutput]: AudioOutput;
|
|
312
344
|
[IOType.PolyAudioInput]: PolyAudioInput;
|
|
313
345
|
[IOType.PolyAudioOutput]: PolyAudioOutput;
|
|
314
|
-
[IOType.MidiInput]: MidiInput;
|
|
315
|
-
[IOType.MidiOutput]: MidiOutput;
|
|
346
|
+
[IOType.MidiInput]: MidiInput$1;
|
|
347
|
+
[IOType.MidiOutput]: MidiOutput$1;
|
|
316
348
|
};
|
|
317
349
|
declare abstract class IOCollection<T extends CollectionType> {
|
|
318
350
|
module: Module<ModuleType> | PolyModule<ModuleType>;
|
|
@@ -353,6 +385,11 @@ type SetterHooks<P> = {
|
|
|
353
385
|
} & {
|
|
354
386
|
[K in keyof P as `onAfterSet${Capitalize<string & K>}`]: (value: P[K]) => void;
|
|
355
387
|
};
|
|
388
|
+
type StateSetterHooks<S> = {
|
|
389
|
+
[K in keyof S as `onSetState${Capitalize<string & K>}`]: (value: S[K]) => S[K];
|
|
390
|
+
} & {
|
|
391
|
+
[K in keyof S as `onAfterSetState${Capitalize<string & K>}`]: (value: S[K]) => void;
|
|
392
|
+
};
|
|
356
393
|
declare abstract class Module<T extends ModuleType> implements IModule<T> {
|
|
357
394
|
id: string;
|
|
358
395
|
engineId: string;
|
|
@@ -363,12 +400,34 @@ declare abstract class Module<T extends ModuleType> implements IModule<T> {
|
|
|
363
400
|
inputs: InputCollection;
|
|
364
401
|
outputs: OutputCollection;
|
|
365
402
|
protected _props: ModuleTypeToPropsMapping[T];
|
|
403
|
+
protected _state: ModuleTypeToStateMapping[T];
|
|
366
404
|
protected activeNotes: Note[];
|
|
405
|
+
protected _propsInitialized: boolean;
|
|
367
406
|
private pendingUIUpdates;
|
|
407
|
+
/**
|
|
408
|
+
* Factory method for creating modules with proper initialization timing.
|
|
409
|
+
*
|
|
410
|
+
* This method ensures hooks are called AFTER the child class constructor completes,
|
|
411
|
+
* solving the ES6 class field initialization problem where function properties like hooks
|
|
412
|
+
* aren't available during super() call.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* const gain = Module.create(MonoGain, engineId, {
|
|
416
|
+
* name: "gain",
|
|
417
|
+
* moduleType: ModuleType.Gain,
|
|
418
|
+
* props: { gain: 0.5 }
|
|
419
|
+
* });
|
|
420
|
+
*/
|
|
421
|
+
static create<T extends ModuleType, M extends Module<T>>(ModuleClass: new (engineId: string, params: ICreateModule<T>) => M, engineId: string, params: Omit<IModuleConstructor<T>, "props"> & {
|
|
422
|
+
props: Partial<IModule<T>["props"]>;
|
|
423
|
+
}): M;
|
|
368
424
|
constructor(engineId: string, params: IModuleConstructor<T>);
|
|
369
425
|
get props(): ModuleTypeToPropsMapping[T];
|
|
370
426
|
set props(value: Partial<ModuleTypeToPropsMapping[T]>);
|
|
371
427
|
private callPropHook;
|
|
428
|
+
get state(): ModuleTypeToStateMapping[T];
|
|
429
|
+
set state(value: Partial<ModuleTypeToStateMapping[T]>);
|
|
430
|
+
private callStateHook;
|
|
372
431
|
serialize(): IModuleSerialize<T>;
|
|
373
432
|
plug({ audioModule, from, to, }: {
|
|
374
433
|
audioModule: AnyModule;
|
|
@@ -389,12 +448,41 @@ declare abstract class Module<T extends ModuleType> implements IModule<T> {
|
|
|
389
448
|
protected registerDefaultIOs(value?: "both" | "in" | "out"): void;
|
|
390
449
|
protected registerAudioInput(props: Omit<AudioInputProps, "ioType">): AudioInput;
|
|
391
450
|
protected registerAudioOutput(props: Omit<AudioOutputProps, "ioType">): AudioOutput;
|
|
392
|
-
protected registerMidiInput(props: Omit<MidiInputProps, "ioType">): MidiInput;
|
|
393
|
-
protected registerMidiOutput(props: Omit<MidiOutputProps, "ioType">): MidiOutput;
|
|
451
|
+
protected registerMidiInput(props: Omit<MidiInputProps, "ioType">): MidiInput$1;
|
|
452
|
+
protected registerMidiOutput(props: Omit<MidiOutputProps, "ioType">): MidiOutput$1;
|
|
394
453
|
protected get engine(): Engine;
|
|
395
454
|
protected get context(): Context;
|
|
396
455
|
}
|
|
397
456
|
|
|
457
|
+
declare enum ReverbType {
|
|
458
|
+
room = "room",
|
|
459
|
+
hall = "hall",
|
|
460
|
+
plate = "plate",
|
|
461
|
+
spring = "spring",
|
|
462
|
+
chamber = "chamber",
|
|
463
|
+
reflections = "reflections"
|
|
464
|
+
}
|
|
465
|
+
type IReverbProps = {
|
|
466
|
+
mix: number;
|
|
467
|
+
decayTime: number;
|
|
468
|
+
preDelay: number;
|
|
469
|
+
type: ReverbType;
|
|
470
|
+
};
|
|
471
|
+
declare class Reverb extends Module<ModuleType.Reverb> implements Pick<SetterHooks<IReverbProps>, "onAfterSetMix" | "onAfterSetDecayTime" | "onAfterSetPreDelay" | "onAfterSetType"> {
|
|
472
|
+
audioNode: GainNode;
|
|
473
|
+
private outputNode;
|
|
474
|
+
private convolverNode;
|
|
475
|
+
private preDelayNode;
|
|
476
|
+
private wetDryMixer;
|
|
477
|
+
constructor(engineId: string, params: ICreateModule<ModuleType.Reverb>);
|
|
478
|
+
private registerCustomOutput;
|
|
479
|
+
onAfterSetMix: (value: number) => void;
|
|
480
|
+
onAfterSetDecayTime: () => void;
|
|
481
|
+
onAfterSetPreDelay: (value: number) => void;
|
|
482
|
+
onAfterSetType: () => void;
|
|
483
|
+
private regenerateImpulseResponse;
|
|
484
|
+
}
|
|
485
|
+
|
|
398
486
|
type BasePropType = {
|
|
399
487
|
label?: string;
|
|
400
488
|
description?: string;
|
|
@@ -451,6 +539,97 @@ type ModulePropSchema<T, TOverrides extends Partial<Record<keyof T, PropSchema>>
|
|
|
451
539
|
[K in keyof T]: K extends keyof TOverrides ? TOverrides[K] : PrimarySchemaForType<T[K]>;
|
|
452
540
|
};
|
|
453
541
|
|
|
542
|
+
type INoise = IModule<ModuleType.Noise>;
|
|
543
|
+
declare enum NoiseType {
|
|
544
|
+
white = "white",
|
|
545
|
+
pink = "pink",
|
|
546
|
+
brown = "brown",
|
|
547
|
+
blue = "blue"
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Props for the Noise module.
|
|
551
|
+
*
|
|
552
|
+
* @property type - Type of noise to generate.
|
|
553
|
+
* One of: "white", "pink", "brown", or "blue".
|
|
554
|
+
*/
|
|
555
|
+
type INoiseProps = {
|
|
556
|
+
type: NoiseType;
|
|
557
|
+
};
|
|
558
|
+
type NoiseSetterHooks = Pick<SetterHooks<INoiseProps>, "onAfterSetType">;
|
|
559
|
+
/**
|
|
560
|
+
* Noise generator module supporting white, pink, brown, and blue noise types.
|
|
561
|
+
*/
|
|
562
|
+
declare class Noise extends Module<ModuleType.Noise> implements NoiseSetterHooks {
|
|
563
|
+
audioNode: AudioBufferSourceNode;
|
|
564
|
+
isStated: boolean;
|
|
565
|
+
private noiseBuffers;
|
|
566
|
+
constructor(engineId: string, params: ICreateModule<ModuleType.Noise>);
|
|
567
|
+
onAfterSetType: NoiseSetterHooks["onAfterSetType"];
|
|
568
|
+
start(time: ContextTime): void;
|
|
569
|
+
stop(time: ContextTime): void;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
type ILFO = IModule<ModuleType.LFO>;
|
|
573
|
+
declare enum LFOWaveform {
|
|
574
|
+
sine = "sine",
|
|
575
|
+
triangle = "triangle",
|
|
576
|
+
square = "square",
|
|
577
|
+
sawtooth = "sawtooth",
|
|
578
|
+
rampDown = "rampDown",
|
|
579
|
+
random = "random"
|
|
580
|
+
}
|
|
581
|
+
type ILFOProps = {
|
|
582
|
+
sync: boolean;
|
|
583
|
+
frequency: number;
|
|
584
|
+
division: Division;
|
|
585
|
+
waveform: LFOWaveform;
|
|
586
|
+
offset: number;
|
|
587
|
+
amount: number;
|
|
588
|
+
};
|
|
589
|
+
declare class LFO extends PolyModule<ModuleType.LFO> {
|
|
590
|
+
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.LFO>);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
declare enum DelayTimeMode {
|
|
594
|
+
short = "short",
|
|
595
|
+
long = "long"
|
|
596
|
+
}
|
|
597
|
+
type IDelayProps = {
|
|
598
|
+
time: number;
|
|
599
|
+
timeMode: DelayTimeMode;
|
|
600
|
+
sync: boolean;
|
|
601
|
+
division: Division;
|
|
602
|
+
feedback: number;
|
|
603
|
+
mix: number;
|
|
604
|
+
stereo: boolean;
|
|
605
|
+
};
|
|
606
|
+
declare class Delay extends Module<ModuleType.Delay> implements Pick<SetterHooks<IDelayProps>, "onAfterSetTime" | "onAfterSetTimeMode" | "onAfterSetSync" | "onAfterSetDivision" | "onAfterSetFeedback" | "onAfterSetMix" | "onAfterSetStereo"> {
|
|
607
|
+
audioNode: GainNode;
|
|
608
|
+
private outputNode;
|
|
609
|
+
private wetDryMixer;
|
|
610
|
+
private delayNode;
|
|
611
|
+
private feedbackGain;
|
|
612
|
+
private delayLeft;
|
|
613
|
+
private delayRight;
|
|
614
|
+
private feedbackLeft;
|
|
615
|
+
private feedbackRight;
|
|
616
|
+
private merger;
|
|
617
|
+
constructor(engineId: string, params: ICreateModule<ModuleType.Delay>);
|
|
618
|
+
private setupBPMListener;
|
|
619
|
+
private updateDelayTime;
|
|
620
|
+
private connectMonoGraph;
|
|
621
|
+
private switchToStereo;
|
|
622
|
+
private disconnectAll;
|
|
623
|
+
private registerCustomOutput;
|
|
624
|
+
onAfterSetTime: (_value: number) => void;
|
|
625
|
+
onAfterSetTimeMode: (value: DelayTimeMode) => void;
|
|
626
|
+
onAfterSetSync: (_value: boolean) => void;
|
|
627
|
+
onAfterSetDivision: (_value: Division) => void;
|
|
628
|
+
onAfterSetFeedback: (value: number) => void;
|
|
629
|
+
onAfterSetMix: (value: number) => void;
|
|
630
|
+
onAfterSetStereo: (value: boolean) => void;
|
|
631
|
+
}
|
|
632
|
+
|
|
454
633
|
type IOscillator = IModule<ModuleType.Oscillator>;
|
|
455
634
|
declare enum OscillatorWave {
|
|
456
635
|
sine = "sine",
|
|
@@ -489,19 +668,72 @@ declare class Voice extends Module<ModuleType.VoiceScheduler> {
|
|
|
489
668
|
audioNode: undefined;
|
|
490
669
|
activeNote: string | null;
|
|
491
670
|
triggeredAt: ContextTime;
|
|
671
|
+
private occupationRanges;
|
|
492
672
|
constructor(engineId: string, params: ICreateModule<ModuleType.VoiceScheduler>);
|
|
673
|
+
/**
|
|
674
|
+
* Check if this voice is occupied at a given time
|
|
675
|
+
*/
|
|
676
|
+
isOccupiedAt(time: ContextTime): boolean;
|
|
677
|
+
/**
|
|
678
|
+
* Get the earliest end time of all occupation ranges at or after the given time
|
|
679
|
+
* Returns Infinity if the voice has infinite occupation
|
|
680
|
+
*/
|
|
681
|
+
getEarliestEndTimeAfter(time: ContextTime): ContextTime;
|
|
682
|
+
/**
|
|
683
|
+
* Clean up past occupation ranges that are no longer needed
|
|
684
|
+
*/
|
|
685
|
+
private cleanupPastRanges;
|
|
686
|
+
/**
|
|
687
|
+
* Clear all occupation ranges
|
|
688
|
+
* Useful when resetting or stopping playback
|
|
689
|
+
*/
|
|
690
|
+
clearOccupationRanges(): void;
|
|
493
691
|
midiTriggered: (midiEvent: MidiEvent) => void;
|
|
494
692
|
}
|
|
495
693
|
declare class VoiceScheduler extends PolyModule<ModuleType.VoiceScheduler> {
|
|
496
694
|
audioModules: Voice[];
|
|
497
|
-
midiOutput: MidiOutput;
|
|
695
|
+
midiOutput: MidiOutput$1;
|
|
498
696
|
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.VoiceScheduler>);
|
|
499
697
|
onMidiEvent: (midiEvent: MidiEvent) => void;
|
|
500
698
|
private findFreeVoice;
|
|
699
|
+
/**
|
|
700
|
+
* Clear all occupation ranges for all voices
|
|
701
|
+
* Call this when stopping playback or resetting the scheduler
|
|
702
|
+
*/
|
|
703
|
+
clearAllOccupationRanges(): void;
|
|
501
704
|
private registerInputs;
|
|
502
705
|
private registerOutputs;
|
|
503
706
|
}
|
|
504
707
|
|
|
708
|
+
type IChorusProps = {
|
|
709
|
+
rate: number;
|
|
710
|
+
depth: number;
|
|
711
|
+
mix: number;
|
|
712
|
+
feedback: number;
|
|
713
|
+
};
|
|
714
|
+
declare class Chorus extends Module<ModuleType.Chorus> implements Pick<SetterHooks<IChorusProps>, "onAfterSetRate" | "onAfterSetDepth" | "onAfterSetMix" | "onAfterSetFeedback"> {
|
|
715
|
+
audioNode: GainNode;
|
|
716
|
+
private outputNode;
|
|
717
|
+
private feedbackGain;
|
|
718
|
+
private delayLeft;
|
|
719
|
+
private delayRight;
|
|
720
|
+
private lfoLeft;
|
|
721
|
+
private lfoRight;
|
|
722
|
+
private depthLeft;
|
|
723
|
+
private depthRight;
|
|
724
|
+
private merger;
|
|
725
|
+
private wetDryMixer;
|
|
726
|
+
private rateModGain;
|
|
727
|
+
constructor(engineId: string, params: ICreateModule<ModuleType.Chorus>);
|
|
728
|
+
private registerAdditionalInputs;
|
|
729
|
+
private registerCustomOutput;
|
|
730
|
+
onAfterSetRate: SetterHooks<IChorusProps>["onAfterSetRate"];
|
|
731
|
+
onAfterSetDepth: SetterHooks<IChorusProps>["onAfterSetDepth"];
|
|
732
|
+
onAfterSetMix: SetterHooks<IChorusProps>["onAfterSetMix"];
|
|
733
|
+
onAfterSetFeedback: SetterHooks<IChorusProps>["onAfterSetFeedback"];
|
|
734
|
+
dispose(): void;
|
|
735
|
+
}
|
|
736
|
+
|
|
505
737
|
type IConstantProps = {
|
|
506
738
|
value: number;
|
|
507
739
|
};
|
|
@@ -513,16 +745,26 @@ declare class Constant extends Module<ModuleType.Constant> implements Pick<Sette
|
|
|
513
745
|
start(time: ContextTime): void;
|
|
514
746
|
stop(time: ContextTime): void;
|
|
515
747
|
triggerAttack: (note: Note, triggeredAt: ContextTime) => void;
|
|
516
|
-
triggerRelease: () => void;
|
|
748
|
+
triggerRelease: (_: Note, triggeredAt: ContextTime) => void;
|
|
517
749
|
}
|
|
518
750
|
|
|
519
|
-
type
|
|
751
|
+
type IDistortionProps = {
|
|
752
|
+
drive: number;
|
|
753
|
+
tone: number;
|
|
754
|
+
mix: number;
|
|
755
|
+
};
|
|
756
|
+
declare class PolyDistortion extends PolyModule<ModuleType.Distortion> {
|
|
757
|
+
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Distortion>);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
type ICustomEnvelopeProps = {
|
|
520
761
|
attack: number;
|
|
762
|
+
attackCurve: number;
|
|
521
763
|
decay: number;
|
|
522
764
|
sustain: number;
|
|
523
765
|
release: number;
|
|
524
766
|
};
|
|
525
|
-
declare class
|
|
767
|
+
declare class CustomEnvelope extends PolyModule<ModuleType.Envelope> {
|
|
526
768
|
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Envelope>);
|
|
527
769
|
}
|
|
528
770
|
|
|
@@ -559,6 +801,16 @@ declare class Inspector extends Module<ModuleType.Inspector> implements Pick<Set
|
|
|
559
801
|
getValues(): Float32Array;
|
|
560
802
|
}
|
|
561
803
|
|
|
804
|
+
type IEnvelopeProps = {
|
|
805
|
+
attack: number;
|
|
806
|
+
decay: number;
|
|
807
|
+
sustain: number;
|
|
808
|
+
release: number;
|
|
809
|
+
};
|
|
810
|
+
declare class Envelope extends PolyModule<ModuleType.LegacyEnvelope> {
|
|
811
|
+
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.LegacyEnvelope>);
|
|
812
|
+
}
|
|
813
|
+
|
|
562
814
|
type IMaster = IModule<ModuleType.Master>;
|
|
563
815
|
type IMasterProps = EmptyObject;
|
|
564
816
|
declare class Master extends Module<ModuleType.Master> {
|
|
@@ -566,6 +818,22 @@ declare class Master extends Module<ModuleType.Master> {
|
|
|
566
818
|
constructor(engineId: string, params: ICreateModule<ModuleType.Master>);
|
|
567
819
|
}
|
|
568
820
|
|
|
821
|
+
type IMidiInputProps = {
|
|
822
|
+
selectedId: string | undefined | null;
|
|
823
|
+
selectedName: string | undefined | null;
|
|
824
|
+
};
|
|
825
|
+
declare class MidiInput extends Module<ModuleType.MidiInput> implements Pick<SetterHooks<IMidiInputProps>, "onSetSelectedId"> {
|
|
826
|
+
audioNode: undefined;
|
|
827
|
+
midiOutput: MidiOutput$1;
|
|
828
|
+
_forwardMidiEvent?: (midiEvent: MidiEvent) => void;
|
|
829
|
+
constructor(engineId: string, params: ICreateModule<ModuleType.MidiInput>);
|
|
830
|
+
onSetSelectedId: SetterHooks<IMidiInputProps>["onSetSelectedId"];
|
|
831
|
+
private get forwardMidiEvent();
|
|
832
|
+
private addEventListener;
|
|
833
|
+
private removeEventListener;
|
|
834
|
+
private registerOutputs;
|
|
835
|
+
}
|
|
836
|
+
|
|
569
837
|
type IMidiMapper = IModule<ModuleType.MidiMapper>;
|
|
570
838
|
type IMidiMapperProps = {
|
|
571
839
|
pages: MidiMappingPage[];
|
|
@@ -586,6 +854,7 @@ declare enum MidiMappingMode {
|
|
|
586
854
|
}
|
|
587
855
|
type MidiMapping<T extends ModuleType> = {
|
|
588
856
|
cc?: number;
|
|
857
|
+
value?: number;
|
|
589
858
|
moduleId?: string;
|
|
590
859
|
moduleType?: T;
|
|
591
860
|
propName?: string;
|
|
@@ -597,6 +866,7 @@ type MidiMapping<T extends ModuleType> = {
|
|
|
597
866
|
type MidiMapperSetterHooks = Pick<SetterHooks<IMidiMapperProps>, "onSetActivePage">;
|
|
598
867
|
declare class MidiMapper extends Module<ModuleType.MidiMapper> implements MidiMapperSetterHooks {
|
|
599
868
|
audioNode: undefined;
|
|
869
|
+
private _midiOut;
|
|
600
870
|
constructor(engineId: string, params: ICreateModule<ModuleType.MidiMapper>);
|
|
601
871
|
onSetActivePage: MidiMapperSetterHooks["onSetActivePage"];
|
|
602
872
|
handleCC: (event: MidiEvent, triggeredAt: ContextTime) => void;
|
|
@@ -604,53 +874,73 @@ declare class MidiMapper extends Module<ModuleType.MidiMapper> implements MidiMa
|
|
|
604
874
|
private checkAutoAssign;
|
|
605
875
|
}
|
|
606
876
|
|
|
607
|
-
type
|
|
877
|
+
type IMidiOutputProps = {
|
|
608
878
|
selectedId: string | undefined | null;
|
|
609
879
|
selectedName: string | undefined | null;
|
|
610
880
|
};
|
|
611
|
-
declare class
|
|
881
|
+
declare class MidiOutput extends Module<ModuleType.MidiOutput> implements Pick<SetterHooks<IMidiOutputProps>, "onSetSelectedId"> {
|
|
612
882
|
audioNode: undefined;
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.
|
|
616
|
-
onSetSelectedId: SetterHooks<
|
|
617
|
-
|
|
618
|
-
private
|
|
619
|
-
private removeEventListener;
|
|
620
|
-
private registerOutputs;
|
|
883
|
+
midiInput: MidiInput$1;
|
|
884
|
+
private currentDevice?;
|
|
885
|
+
constructor(engineId: string, params: ICreateModule<ModuleType.MidiOutput>);
|
|
886
|
+
onSetSelectedId: SetterHooks<IMidiOutputProps>["onSetSelectedId"];
|
|
887
|
+
onMidiEvent: (midiEvent: MidiEvent) => void;
|
|
888
|
+
private registerInputs;
|
|
621
889
|
}
|
|
622
890
|
|
|
623
891
|
type IScaleProps = {
|
|
624
892
|
min: number;
|
|
625
893
|
max: number;
|
|
626
894
|
current: number;
|
|
895
|
+
mode: "exponential" | "linear";
|
|
627
896
|
};
|
|
628
|
-
declare class Scale extends
|
|
629
|
-
|
|
630
|
-
constructor(engineId: string, params: ICreateModule<ModuleType.Scale>);
|
|
631
|
-
get current(): AudioParam;
|
|
632
|
-
get min(): AudioParam;
|
|
633
|
-
get max(): AudioParam;
|
|
634
|
-
onAfterSetMin: SetterHooks<IScaleProps>["onAfterSetMin"];
|
|
635
|
-
onAfterSetMax: SetterHooks<IScaleProps>["onAfterSetMax"];
|
|
636
|
-
onAfterSetCurrent: SetterHooks<IScaleProps>["onAfterSetCurrent"];
|
|
897
|
+
declare class Scale extends PolyModule<ModuleType.Scale> {
|
|
898
|
+
constructor(engineId: string, params: IPolyModuleConstructor<ModuleType.Scale>);
|
|
637
899
|
}
|
|
638
900
|
|
|
639
901
|
type IStepSequencer = IModule<ModuleType.StepSequencer>;
|
|
640
|
-
|
|
641
|
-
active: boolean;
|
|
642
|
-
duration: string;
|
|
643
|
-
notes: INote[];
|
|
644
|
-
};
|
|
902
|
+
|
|
645
903
|
type IStepSequencerProps = {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
904
|
+
patterns: IPattern[];
|
|
905
|
+
activePatternNo: number;
|
|
906
|
+
activePageNo: number;
|
|
907
|
+
stepsPerPage: number;
|
|
908
|
+
resolution: Resolution;
|
|
909
|
+
playbackMode: PlaybackMode;
|
|
910
|
+
patternSequence: string;
|
|
911
|
+
enableSequence: boolean;
|
|
912
|
+
};
|
|
913
|
+
type IStepSequencerState = {
|
|
914
|
+
isRunning: boolean;
|
|
915
|
+
currentStep: number;
|
|
916
|
+
sequencePosition?: string;
|
|
649
917
|
};
|
|
650
|
-
declare
|
|
918
|
+
declare const stepPropSchema: ModulePropSchema<Pick<IStep, "probability" | "duration" | "microtimeOffset">, {
|
|
919
|
+
duration: EnumProp<Division>;
|
|
920
|
+
}>;
|
|
921
|
+
type StepSequencerSetterHooks = Pick<SetterHooks<IStepSequencerProps>, "onSetActivePatternNo" | "onAfterSetPatternSequence" | "onAfterSetPatterns" | "onAfterSetResolution" | "onAfterSetPlaybackMode" | "onAfterSetEnableSequence">;
|
|
922
|
+
declare class StepSequencer extends Module<ModuleType.StepSequencer> implements StepSequencerSetterHooks {
|
|
651
923
|
audioNode: undefined;
|
|
652
|
-
midiOutput: MidiOutput;
|
|
924
|
+
midiOutput: MidiOutput$1;
|
|
925
|
+
private scheduledNotes;
|
|
926
|
+
private source?;
|
|
653
927
|
constructor(engineId: string, params: ICreateModule<ModuleType.StepSequencer>);
|
|
928
|
+
onSetActivePatternNo: StepSequencerSetterHooks["onSetActivePatternNo"];
|
|
929
|
+
onAfterSetPatternSequence: StepSequencerSetterHooks["onAfterSetPatternSequence"];
|
|
930
|
+
onAfterSetPatterns: StepSequencerSetterHooks["onAfterSetPatterns"];
|
|
931
|
+
onAfterSetResolution: StepSequencerSetterHooks["onAfterSetResolution"];
|
|
932
|
+
onAfterSetPlaybackMode: StepSequencerSetterHooks["onAfterSetPlaybackMode"];
|
|
933
|
+
onAfterSetEnableSequence: StepSequencerSetterHooks["onAfterSetEnableSequence"];
|
|
934
|
+
private initializeSource;
|
|
935
|
+
private handleStepEvent;
|
|
936
|
+
private registerOutputs;
|
|
937
|
+
private triggerStep;
|
|
938
|
+
private sendNoteOn;
|
|
939
|
+
private sendNoteOff;
|
|
940
|
+
private sendCC;
|
|
941
|
+
start(contextTime: ContextTime): void;
|
|
942
|
+
stop(contextTime: ContextTime): void;
|
|
943
|
+
dispose(): void;
|
|
654
944
|
}
|
|
655
945
|
|
|
656
946
|
type IStereoPannerProps = {
|
|
@@ -666,7 +956,7 @@ type IVirtualMidiProps = {
|
|
|
666
956
|
};
|
|
667
957
|
declare class VirtualMidi extends Module<ModuleType.VirtualMidi> {
|
|
668
958
|
audioNode: undefined;
|
|
669
|
-
midiOutput: MidiOutput;
|
|
959
|
+
midiOutput: MidiOutput$1;
|
|
670
960
|
constructor(engineId: string, params: ICreateModule<ModuleType.VirtualMidi>);
|
|
671
961
|
sendMidi(midiEvent: MidiEvent): void;
|
|
672
962
|
triggerAttack: (note: Note, triggerAttack: ContextTime) => void;
|
|
@@ -679,49 +969,97 @@ declare enum ModuleType {
|
|
|
679
969
|
Master = "Master",
|
|
680
970
|
Oscillator = "Oscillator",
|
|
681
971
|
Gain = "Gain",
|
|
682
|
-
|
|
972
|
+
MidiInput = "MidiInput",
|
|
973
|
+
MidiOutput = "MidiOutput",
|
|
974
|
+
LegacyEnvelope = "LegacyEnvelope",// BACKWARD_COMPAT: Legacy envelope for old patches
|
|
683
975
|
Envelope = "Envelope",
|
|
684
976
|
Filter = "Filter",
|
|
685
977
|
Scale = "Scale",
|
|
686
978
|
StereoPanner = "StereoPanner",
|
|
687
979
|
Inspector = "Inspector",
|
|
980
|
+
Chorus = "Chorus",
|
|
688
981
|
Constant = "Constant",
|
|
982
|
+
Delay = "Delay",
|
|
983
|
+
Distortion = "Distortion",
|
|
689
984
|
MidiMapper = "MidiMapper",
|
|
690
985
|
VirtualMidi = "VirtualMidi",
|
|
691
986
|
StepSequencer = "StepSequencer",
|
|
692
|
-
VoiceScheduler = "VoiceScheduler"
|
|
987
|
+
VoiceScheduler = "VoiceScheduler",
|
|
988
|
+
LFO = "LFO",
|
|
989
|
+
Noise = "Noise",
|
|
990
|
+
Reverb = "Reverb"
|
|
693
991
|
}
|
|
694
992
|
type ModuleTypeToPropsMapping = {
|
|
695
993
|
[ModuleType.Oscillator]: IOscillatorProps;
|
|
696
994
|
[ModuleType.Gain]: IGainProps;
|
|
697
995
|
[ModuleType.Master]: IMasterProps;
|
|
698
|
-
[ModuleType.
|
|
699
|
-
[ModuleType.
|
|
996
|
+
[ModuleType.MidiInput]: IMidiInputProps;
|
|
997
|
+
[ModuleType.MidiOutput]: IMidiOutputProps;
|
|
998
|
+
[ModuleType.LegacyEnvelope]: IEnvelopeProps;
|
|
999
|
+
[ModuleType.Envelope]: ICustomEnvelopeProps;
|
|
700
1000
|
[ModuleType.Filter]: IFilterProps;
|
|
701
1001
|
[ModuleType.Scale]: IScaleProps;
|
|
702
1002
|
[ModuleType.StereoPanner]: IStereoPannerProps;
|
|
703
1003
|
[ModuleType.Inspector]: IInspectorProps;
|
|
1004
|
+
[ModuleType.Chorus]: IChorusProps;
|
|
704
1005
|
[ModuleType.Constant]: IConstantProps;
|
|
1006
|
+
[ModuleType.Delay]: IDelayProps;
|
|
1007
|
+
[ModuleType.Distortion]: IDistortionProps;
|
|
705
1008
|
[ModuleType.MidiMapper]: IMidiMapperProps;
|
|
706
1009
|
[ModuleType.VirtualMidi]: IVirtualMidiProps;
|
|
707
1010
|
[ModuleType.StepSequencer]: IStepSequencerProps;
|
|
708
1011
|
[ModuleType.VoiceScheduler]: IVoiceSchedulerProps;
|
|
1012
|
+
[ModuleType.LFO]: ILFOProps;
|
|
1013
|
+
[ModuleType.Noise]: INoiseProps;
|
|
1014
|
+
[ModuleType.Reverb]: IReverbProps;
|
|
1015
|
+
};
|
|
1016
|
+
type ModuleTypeToStateMapping = {
|
|
1017
|
+
[ModuleType.Oscillator]: never;
|
|
1018
|
+
[ModuleType.Gain]: never;
|
|
1019
|
+
[ModuleType.Master]: never;
|
|
1020
|
+
[ModuleType.MidiInput]: never;
|
|
1021
|
+
[ModuleType.MidiOutput]: never;
|
|
1022
|
+
[ModuleType.LegacyEnvelope]: never;
|
|
1023
|
+
[ModuleType.Envelope]: never;
|
|
1024
|
+
[ModuleType.Filter]: never;
|
|
1025
|
+
[ModuleType.Scale]: never;
|
|
1026
|
+
[ModuleType.StereoPanner]: never;
|
|
1027
|
+
[ModuleType.Inspector]: never;
|
|
1028
|
+
[ModuleType.Chorus]: never;
|
|
1029
|
+
[ModuleType.Constant]: never;
|
|
1030
|
+
[ModuleType.Delay]: never;
|
|
1031
|
+
[ModuleType.Distortion]: never;
|
|
1032
|
+
[ModuleType.MidiMapper]: never;
|
|
1033
|
+
[ModuleType.VirtualMidi]: never;
|
|
1034
|
+
[ModuleType.StepSequencer]: IStepSequencerState;
|
|
1035
|
+
[ModuleType.VoiceScheduler]: never;
|
|
1036
|
+
[ModuleType.LFO]: never;
|
|
1037
|
+
[ModuleType.Noise]: never;
|
|
1038
|
+
[ModuleType.Reverb]: never;
|
|
709
1039
|
};
|
|
710
1040
|
type ModuleTypeToModuleMapping = {
|
|
711
1041
|
[ModuleType.Oscillator]: Oscillator;
|
|
712
1042
|
[ModuleType.Gain]: Gain;
|
|
713
1043
|
[ModuleType.Master]: Master;
|
|
714
|
-
[ModuleType.
|
|
715
|
-
[ModuleType.
|
|
1044
|
+
[ModuleType.MidiInput]: MidiInput;
|
|
1045
|
+
[ModuleType.MidiOutput]: MidiOutput;
|
|
1046
|
+
[ModuleType.LegacyEnvelope]: Envelope;
|
|
1047
|
+
[ModuleType.Envelope]: CustomEnvelope;
|
|
716
1048
|
[ModuleType.Filter]: Filter;
|
|
717
1049
|
[ModuleType.Scale]: Scale;
|
|
718
1050
|
[ModuleType.StereoPanner]: StereoPanner;
|
|
719
1051
|
[ModuleType.Inspector]: Inspector;
|
|
1052
|
+
[ModuleType.Chorus]: Chorus;
|
|
720
1053
|
[ModuleType.Constant]: Constant;
|
|
1054
|
+
[ModuleType.Delay]: Delay;
|
|
1055
|
+
[ModuleType.Distortion]: PolyDistortion;
|
|
721
1056
|
[ModuleType.MidiMapper]: MidiMapper;
|
|
722
1057
|
[ModuleType.VirtualMidi]: VirtualMidi;
|
|
723
1058
|
[ModuleType.StepSequencer]: StepSequencer;
|
|
724
1059
|
[ModuleType.VoiceScheduler]: VoiceScheduler;
|
|
1060
|
+
[ModuleType.LFO]: LFO;
|
|
1061
|
+
[ModuleType.Noise]: Noise;
|
|
1062
|
+
[ModuleType.Reverb]: Reverb;
|
|
725
1063
|
};
|
|
726
1064
|
declare const moduleSchemas: {
|
|
727
1065
|
Oscillator: ModulePropSchema<IOscillatorProps, {
|
|
@@ -729,21 +1067,47 @@ declare const moduleSchemas: {
|
|
|
729
1067
|
}>;
|
|
730
1068
|
Gain: ModulePropSchema<IGainProps, _blibliki_utils.EmptyObject>;
|
|
731
1069
|
Master: ModulePropSchema<_blibliki_utils.EmptyObject, _blibliki_utils.EmptyObject>;
|
|
732
|
-
|
|
733
|
-
|
|
1070
|
+
MidiInput: ModulePropSchema<IMidiInputProps, _blibliki_utils.EmptyObject>;
|
|
1071
|
+
MidiOutput: ModulePropSchema<IMidiOutputProps, _blibliki_utils.EmptyObject>;
|
|
1072
|
+
LegacyEnvelope: ModulePropSchema<IEnvelopeProps, _blibliki_utils.EmptyObject>;
|
|
1073
|
+
Envelope: ModulePropSchema<ICustomEnvelopeProps, _blibliki_utils.EmptyObject>;
|
|
734
1074
|
Filter: ModulePropSchema<IFilterProps, {
|
|
735
1075
|
type: EnumProp<BiquadFilterType>;
|
|
736
1076
|
}>;
|
|
737
|
-
Scale: ModulePropSchema<IScaleProps,
|
|
1077
|
+
Scale: ModulePropSchema<IScaleProps, {
|
|
1078
|
+
mode: EnumProp<"exponential" | "linear">;
|
|
1079
|
+
}>;
|
|
738
1080
|
StereoPanner: ModulePropSchema<IStereoPannerProps, _blibliki_utils.EmptyObject>;
|
|
739
1081
|
Inspector: ModulePropSchema<IInspectorProps, {
|
|
740
1082
|
fftSize: EnumProp<number>;
|
|
741
1083
|
}>;
|
|
1084
|
+
Chorus: ModulePropSchema<IChorusProps, _blibliki_utils.EmptyObject>;
|
|
742
1085
|
Constant: ModulePropSchema<IConstantProps, _blibliki_utils.EmptyObject>;
|
|
1086
|
+
Delay: ModulePropSchema<IDelayProps, {
|
|
1087
|
+
timeMode: EnumProp<DelayTimeMode>;
|
|
1088
|
+
division: EnumProp<_blibliki_transport.Division>;
|
|
1089
|
+
}>;
|
|
1090
|
+
Distortion: ModulePropSchema<IDistortionProps, _blibliki_utils.EmptyObject>;
|
|
743
1091
|
MidiMapper: ModulePropSchema<IMidiMapperProps, _blibliki_utils.EmptyObject>;
|
|
744
1092
|
VirtualMidi: ModulePropSchema<IVirtualMidiProps, _blibliki_utils.EmptyObject>;
|
|
745
|
-
StepSequencer: ModulePropSchema<
|
|
1093
|
+
StepSequencer: ModulePropSchema<Pick<IStepSequencerProps, "activePatternNo" | "activePageNo" | "stepsPerPage" | "resolution" | "playbackMode" | "patternSequence" | "enableSequence">, {
|
|
1094
|
+
resolution: EnumProp<_blibliki_transport.Resolution>;
|
|
1095
|
+
playbackMode: EnumProp<_blibliki_transport.PlaybackMode>;
|
|
1096
|
+
}>;
|
|
746
1097
|
VoiceScheduler: ModulePropSchema<_blibliki_utils.EmptyObject, _blibliki_utils.EmptyObject>;
|
|
1098
|
+
LFO: ModulePropSchema<ILFOProps, {
|
|
1099
|
+
division: EnumProp<_blibliki_transport.Division>;
|
|
1100
|
+
waveform: EnumProp<LFOWaveform>;
|
|
1101
|
+
}>;
|
|
1102
|
+
Noise: ModulePropSchema<INoiseProps, {
|
|
1103
|
+
type: EnumProp<NoiseType>;
|
|
1104
|
+
}>;
|
|
1105
|
+
Reverb: ModulePropSchema<IReverbProps, {
|
|
1106
|
+
type: {
|
|
1107
|
+
kind: "enum";
|
|
1108
|
+
options: ReverbType[];
|
|
1109
|
+
};
|
|
1110
|
+
}>;
|
|
747
1111
|
};
|
|
748
1112
|
|
|
749
1113
|
type AnyModule = Module<ModuleType>;
|
|
@@ -754,10 +1118,10 @@ type ICreateModule<T extends ModuleType> = {
|
|
|
754
1118
|
props: Partial<ModuleTypeToPropsMapping[T]>;
|
|
755
1119
|
};
|
|
756
1120
|
type ModuleParams = {
|
|
757
|
-
[K in ModuleType]: K extends ModuleType.Oscillator | ModuleType.Gain | ModuleType.Envelope | ModuleType.Filter | ModuleType.StereoPanner | ModuleType.VoiceScheduler ? IPolyModuleConstructor<K> : ICreateModule<K>;
|
|
1121
|
+
[K in ModuleType]: K extends ModuleType.Oscillator | ModuleType.Gain | ModuleType.LegacyEnvelope | ModuleType.Envelope | ModuleType.Filter | ModuleType.StereoPanner | ModuleType.VoiceScheduler | ModuleType.Scale | ModuleType.LFO | ModuleType.Distortion ? IPolyModuleConstructor<K> : ICreateModule<K>;
|
|
758
1122
|
}[ModuleType];
|
|
759
1123
|
|
|
760
|
-
type IAnyModuleSerialize = IModuleSerialize<
|
|
1124
|
+
type IAnyModuleSerialize<MT extends ModuleType = ModuleType> = IModuleSerialize<MT> | IPolyModuleSerialize<MT>;
|
|
761
1125
|
|
|
762
1126
|
type IPlug = {
|
|
763
1127
|
moduleId: string;
|
|
@@ -783,9 +1147,17 @@ declare class Routes {
|
|
|
783
1147
|
private getIOs;
|
|
784
1148
|
}
|
|
785
1149
|
|
|
786
|
-
|
|
1150
|
+
declare class MidiOutputDevice extends BaseMidiDevice<IMidiOutputPort> {
|
|
1151
|
+
constructor(output: IMidiOutputPort);
|
|
1152
|
+
connect(): void;
|
|
1153
|
+
disconnect(): void;
|
|
1154
|
+
send(data: number[] | Uint8Array, timestamp?: number): void;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
type ListenerCallback = (device: MidiInputDevice | MidiOutputDevice) => void;
|
|
787
1158
|
declare class MidiDeviceManager {
|
|
788
|
-
|
|
1159
|
+
inputDevices: Map<string, MidiInputDevice | ComputerKeyboardInput>;
|
|
1160
|
+
outputDevices: Map<string, MidiOutputDevice>;
|
|
789
1161
|
private initialized;
|
|
790
1162
|
private listeners;
|
|
791
1163
|
private context;
|
|
@@ -793,8 +1165,13 @@ declare class MidiDeviceManager {
|
|
|
793
1165
|
private adapter;
|
|
794
1166
|
constructor(context: Context);
|
|
795
1167
|
initialize(): Promise<void>;
|
|
796
|
-
find(id: string):
|
|
797
|
-
findByName(name: string):
|
|
1168
|
+
find(id: string): MidiInputDevice | ComputerKeyboardInput | MidiOutputDevice | undefined;
|
|
1169
|
+
findByName(name: string): MidiInputDevice | ComputerKeyboardInput | MidiOutputDevice | undefined;
|
|
1170
|
+
findByFuzzyName(name: string, threshold?: number): MidiInputDevice | ComputerKeyboardInput | MidiOutputDevice | undefined;
|
|
1171
|
+
findInput(id: string): MidiInputDevice | ComputerKeyboardInput | undefined;
|
|
1172
|
+
findInputByName(name: string): MidiInputDevice | ComputerKeyboardInput | undefined;
|
|
1173
|
+
findOutput(id: string): MidiOutputDevice | undefined;
|
|
1174
|
+
findOutputByName(name: string): MidiOutputDevice | undefined;
|
|
798
1175
|
/**
|
|
799
1176
|
* Finds a device using fuzzy name matching
|
|
800
1177
|
* Useful for matching devices across browser/Node.js environments where names differ
|
|
@@ -803,8 +1180,12 @@ declare class MidiDeviceManager {
|
|
|
803
1180
|
* @param threshold - Minimum similarity score (0-1, default: 0.6)
|
|
804
1181
|
* @returns The best matching device and confidence score, or null
|
|
805
1182
|
*/
|
|
806
|
-
|
|
807
|
-
device:
|
|
1183
|
+
findInputByFuzzyName(targetName: string, threshold?: number): {
|
|
1184
|
+
device: MidiInputDevice | ComputerKeyboardInput;
|
|
1185
|
+
score: number;
|
|
1186
|
+
} | null;
|
|
1187
|
+
findOutputByFuzzyName(targetName: string, threshold?: number): {
|
|
1188
|
+
device: MidiOutputDevice;
|
|
808
1189
|
score: number;
|
|
809
1190
|
} | null;
|
|
810
1191
|
addListener(callback: ListenerCallback): void;
|
|
@@ -835,7 +1216,7 @@ declare class Engine {
|
|
|
835
1216
|
context: Context;
|
|
836
1217
|
isInitialized: boolean;
|
|
837
1218
|
routes: Routes;
|
|
838
|
-
transport: Transport
|
|
1219
|
+
transport: Transport;
|
|
839
1220
|
modules: Map<string, ModuleTypeToModuleMapping[keyof ModuleTypeToModuleMapping]>;
|
|
840
1221
|
midiDeviceManager: MidiDeviceManager;
|
|
841
1222
|
static getById(id: string): Engine;
|
|
@@ -844,8 +1225,8 @@ declare class Engine {
|
|
|
844
1225
|
constructor(context: Context);
|
|
845
1226
|
get state(): _blibliki_transport.TransportState;
|
|
846
1227
|
initialize(): Promise<void>;
|
|
847
|
-
addModule<T extends ModuleType>(params: ICreateModule<T>):
|
|
848
|
-
updateModule<T extends ModuleType>(params: IUpdateModule<T>):
|
|
1228
|
+
addModule<T extends ModuleType>(params: ICreateModule<T>): IPolyModuleSerialize<ModuleType.VoiceScheduler> | IPolyModuleSerialize<ModuleType.Distortion> | IPolyModuleSerialize<ModuleType.Envelope> | IPolyModuleSerialize<ModuleType.Gain> | IPolyModuleSerialize<ModuleType.Scale> | IPolyModuleSerialize<ModuleType.Filter> | IPolyModuleSerialize<ModuleType.LFO> | IPolyModuleSerialize<ModuleType.LegacyEnvelope> | IPolyModuleSerialize<ModuleType.Oscillator> | IPolyModuleSerialize<ModuleType.StereoPanner> | IModuleSerialize<ModuleType.Chorus> | IModuleSerialize<ModuleType.Constant> | IModuleSerialize<ModuleType.Delay> | IModuleSerialize<ModuleType.Inspector> | IModuleSerialize<ModuleType.Master> | IModuleSerialize<ModuleType.MidiInput> | IModuleSerialize<ModuleType.MidiMapper> | IModuleSerialize<ModuleType.MidiOutput> | IModuleSerialize<ModuleType.VirtualMidi> | IModuleSerialize<ModuleType.StepSequencer> | IModuleSerialize<ModuleType.Noise> | IModuleSerialize<ModuleType.Reverb>;
|
|
1229
|
+
updateModule<T extends ModuleType>(params: IUpdateModule<T>): IPolyModuleSerialize<ModuleType.VoiceScheduler> | IPolyModuleSerialize<ModuleType.Distortion> | IPolyModuleSerialize<ModuleType.Envelope> | IPolyModuleSerialize<ModuleType.Gain> | IPolyModuleSerialize<ModuleType.Scale> | IPolyModuleSerialize<ModuleType.Filter> | IPolyModuleSerialize<ModuleType.LFO> | IPolyModuleSerialize<ModuleType.LegacyEnvelope> | IPolyModuleSerialize<ModuleType.Oscillator> | IPolyModuleSerialize<ModuleType.StereoPanner> | IModuleSerialize<ModuleType.Chorus> | IModuleSerialize<ModuleType.Constant> | IModuleSerialize<ModuleType.Delay> | IModuleSerialize<ModuleType.Inspector> | IModuleSerialize<ModuleType.Master> | IModuleSerialize<ModuleType.MidiInput> | IModuleSerialize<ModuleType.MidiMapper> | IModuleSerialize<ModuleType.MidiOutput> | IModuleSerialize<ModuleType.VirtualMidi> | IModuleSerialize<ModuleType.StepSequencer> | IModuleSerialize<ModuleType.Noise> | IModuleSerialize<ModuleType.Reverb>;
|
|
849
1230
|
removeModule(id: string): void;
|
|
850
1231
|
addRoute(props: ICreateRoute): IRoute;
|
|
851
1232
|
removeRoute(id: string): void;
|
|
@@ -862,17 +1243,30 @@ declare class Engine {
|
|
|
862
1243
|
serialize(): IEngineSerialize;
|
|
863
1244
|
findModule(id: string): ModuleTypeToModuleMapping[keyof ModuleTypeToModuleMapping];
|
|
864
1245
|
findIO(moduleId: string, ioName: string, type: "input" | "output"): Base;
|
|
865
|
-
findMidiDevice(id: string):
|
|
866
|
-
findMidiDeviceByName(name: string):
|
|
867
|
-
findMidiDeviceByFuzzyName(name: string, threshold?: number):
|
|
868
|
-
|
|
1246
|
+
findMidiDevice(id: string): MidiInputDevice | ComputerKeyboardInput | MidiOutputDevice | undefined;
|
|
1247
|
+
findMidiDeviceByName(name: string): MidiInputDevice | ComputerKeyboardInput | MidiOutputDevice | undefined;
|
|
1248
|
+
findMidiDeviceByFuzzyName(name: string, threshold?: number): MidiInputDevice | ComputerKeyboardInput | MidiOutputDevice | undefined;
|
|
1249
|
+
findMidiInputDevice(id: string): MidiInputDevice | ComputerKeyboardInput | undefined;
|
|
1250
|
+
findMidiInputDeviceByName(name: string): MidiInputDevice | ComputerKeyboardInput | undefined;
|
|
1251
|
+
findMidiInputDeviceByFuzzyName(name: string, threshold?: number): {
|
|
1252
|
+
device: MidiInputDevice | ComputerKeyboardInput;
|
|
869
1253
|
score: number;
|
|
870
1254
|
} | null;
|
|
871
|
-
|
|
872
|
-
|
|
1255
|
+
findMidiOutputDevice(id: string): MidiOutputDevice | undefined;
|
|
1256
|
+
findMidiOutputDeviceByName(name: string): MidiOutputDevice | undefined;
|
|
1257
|
+
findMidiOutputDeviceByFuzzyName(name: string, threshold?: number): {
|
|
1258
|
+
device: MidiOutputDevice;
|
|
1259
|
+
score: number;
|
|
1260
|
+
} | null;
|
|
1261
|
+
onPropsUpdate(callback: <T extends ModuleType>(params: (IModule<T> | IPolyModule<T>) & {
|
|
1262
|
+
state?: ModuleTypeToStateMapping[T];
|
|
1263
|
+
}) => void): void;
|
|
1264
|
+
_triggerPropsUpdate<T extends ModuleType>(params: (IModule<T> | IPolyModule<T>) & {
|
|
1265
|
+
state?: ModuleTypeToStateMapping[T];
|
|
1266
|
+
}): void;
|
|
873
1267
|
triggerVirtualMidi(id: string, noteName: string, type: "noteOn" | "noteOff"): void;
|
|
874
1268
|
private onStart;
|
|
875
1269
|
private onStop;
|
|
876
1270
|
}
|
|
877
1271
|
|
|
878
|
-
export { type ArrayProp, type BooleanProp, Engine, type EnumProp, type IAnyModuleSerialize, 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
|
|
1272
|
+
export { type ArrayProp, type BooleanProp, DelayTimeMode, Engine, type EnumProp, type IAnyModuleSerialize, type ICreateModule, type ICreateRoute, type IEngineSerialize, type IGain, type IIOSerialize, type ILFO, type ILFOProps, type IMaster, type IMidiDevice, type IMidiMapper, type IMidiMapperProps, type IModule, type IModuleSerialize, type INoise, type INote, type IOscillator, type IPolyModuleSerialize, type IRoute, type IStepSequencer, type IStepSequencerProps, type IStepSequencerState, type IUpdateModule, LFOWaveform, MidiInputDevice as MidiDevice, MidiInputDevice, type MidiMapping, MidiMappingMode, MidiOutputDevice, MidiPortState, type ModuleParams, type ModulePropSchema, ModuleType, type ModuleTypeToPropsMapping, type ModuleTypeToStateMapping, NoiseType, Note, type NumberProp, OscillatorWave, type PropSchema, type SetterHooks, type StateSetterHooks, StepSequencer, type StringProp, moduleSchemas, stepPropSchema };
|