@blibliki/engine 0.1.20 → 0.1.22

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.
@@ -10,6 +10,14 @@ interface ContextInterface {
10
10
  interface InitializeInterface {
11
11
  context?: Partial<ContextInterface>;
12
12
  }
13
+ export interface UpdateModuleProps {
14
+ id: string;
15
+ changes: {
16
+ name?: string;
17
+ numberOfVoices?: number;
18
+ props?: AnyObject;
19
+ };
20
+ }
13
21
  declare class Engine {
14
22
  midiDeviceManager: MidiDeviceManager;
15
23
  private static instance;
@@ -28,6 +36,7 @@ declare class Engine {
28
36
  addModule(params: {
29
37
  id?: string;
30
38
  name: string;
39
+ numberOfVoices?: number;
31
40
  type: string;
32
41
  props?: AnyObject;
33
42
  }): {
@@ -39,7 +48,7 @@ declare class Engine {
39
48
  outputs: import(".").IOProps[];
40
49
  };
41
50
  removeModule(id: string): string[];
42
- updateNameModule(id: string, name: string): {
51
+ updateModule(params: UpdateModuleProps): {
43
52
  id: string;
44
53
  name: string;
45
54
  type: string;
@@ -49,19 +58,11 @@ declare class Engine {
49
58
  };
50
59
  onPropsUpdate(callback: (id: string, props: AnyObject) => void): void;
51
60
  _triggerPropsUpdate(id: string, props: AnyObject): void;
52
- updatePropsModule(id: string, props: AnyObject): {
53
- id: string;
54
- name: string;
55
- type: string;
56
- props: any;
57
- inputs: import(".").IOProps[];
58
- outputs: import(".").IOProps[];
59
- };
60
61
  addRoute(props: Optional<RouteInterface, "id">): {
61
62
  id: string;
62
63
  sourceId: string;
63
- sourceIOId: string;
64
64
  destinationId: string;
65
+ sourceIOId: string;
65
66
  destinationIOId: string;
66
67
  };
67
68
  removeRoute(id: string): void;
@@ -74,7 +75,6 @@ declare class Engine {
74
75
  get bpm(): number;
75
76
  set bpm(value: number);
76
77
  updateRoutes(): void;
77
- private applyRoutesRequired;
78
78
  private moduleRouteIds;
79
79
  }
80
80
  declare const _default: Engine;
@@ -5,6 +5,7 @@ import { AudioModule } from "./index";
5
5
  interface PolyModuleInterface<MonoAudioModule, PropsInterface> {
6
6
  id?: string;
7
7
  name: string;
8
+ numberOfVoices?: number;
8
9
  child: new (params: {
9
10
  id?: string;
10
11
  name: string;
@@ -39,6 +40,7 @@ export default abstract class PolyModule<MonoAudioModule extends Module<Connecta
39
40
  serialize(): {
40
41
  id: string;
41
42
  type: string;
43
+ numberOfVoices: number;
42
44
  inputs: import("../IO").IIOSerialize[];
43
45
  outputs: import("../IO").IIOSerialize[];
44
46
  name: string;
@@ -0,0 +1,11 @@
1
+ import { IMidiInput, TMidiPortState } from "./MidiDevice";
2
+ import MidiEvent from "./MidiEvent";
3
+ export default class ComputerKeyboardInput implements IMidiInput {
4
+ id: string;
5
+ name: string;
6
+ state: TMidiPortState;
7
+ onmidimessage: ((e: MidiEvent) => void) | null;
8
+ constructor();
9
+ onKeyTrigger: (noteOn: boolean) => (event: KeyboardEvent) => void;
10
+ private extractNote;
11
+ }
@@ -1,23 +1,27 @@
1
1
  import MidiEvent from "./MidiEvent";
2
+ export type TMidiPortState = "connected" | "disconnected";
2
3
  export interface MidiDeviceInterface {
3
4
  id: string;
4
5
  name: string;
5
- state: string;
6
+ state: TMidiPortState;
7
+ }
8
+ export interface IMidiInput extends MidiDeviceInterface {
9
+ onmidimessage: ((e: MidiEvent) => void) | null;
6
10
  }
7
11
  export type EventListerCallback = (event: MidiEvent) => void;
8
12
  export default class MidiDevice implements MidiDeviceInterface {
9
13
  id: string;
10
14
  name: string;
11
- state: string;
15
+ state: TMidiPortState;
12
16
  eventListerCallbacks: EventListerCallback[];
13
17
  private _midi;
14
- constructor(midi: MIDIInput);
18
+ constructor(midi: IMidiInput);
15
19
  connect(): void;
16
20
  disconnect(): void;
17
21
  serialize(): {
18
22
  id: string;
19
23
  name: string;
20
- state: string;
24
+ state: TMidiPortState;
21
25
  };
22
26
  addEventListener(callback: EventListerCallback): void;
23
27
  removeEventListener(callback: EventListerCallback): void;
@@ -4,6 +4,7 @@ export default class MidiDeviceManager {
4
4
  [Key: string]: MidiDevice;
5
5
  };
6
6
  private initialized;
7
+ private computerKeyboardInput;
7
8
  constructor();
8
9
  find(id: string): MidiDevice | null;
9
10
  onStateChange(callback: (device: MidiDevice) => void): void;
@@ -9,6 +9,8 @@ interface FilterInterface {
9
9
  }
10
10
  type FilterProps = Partial<FilterInterface>;
11
11
  declare class MonoFilter extends Module<InternalFilter, FilterInterface> {
12
+ private _cutoff;
13
+ private _amount;
12
14
  constructor(params: {
13
15
  id?: string;
14
16
  name: string;
@@ -25,6 +27,8 @@ declare class MonoFilter extends Module<InternalFilter, FilterInterface> {
25
27
  set resonance(value: number);
26
28
  get envelopeAmount(): number;
27
29
  set envelopeAmount(value: number);
30
+ private registerOutputs;
31
+ private updateAmountFactor;
28
32
  }
29
33
  export default class Filter extends PolyModule<MonoFilter, FilterInterface> {
30
34
  static moduleName: string;
@@ -33,5 +37,6 @@ export default class Filter extends PolyModule<MonoFilter, FilterInterface> {
33
37
  name: string;
34
38
  props: Partial<FilterInterface>;
35
39
  });
40
+ private registerOutputs;
36
41
  }
37
42
  export {};
@@ -21,6 +21,7 @@ export default class VoiceScheduler extends PolyModule<Voice, VoiceSchedulerInte
21
21
  };
22
22
  id: string;
23
23
  type: string;
24
+ numberOfVoices: number;
24
25
  inputs: import("../core/IO").IIOSerialize[];
25
26
  outputs: import("../core/IO").IIOSerialize[];
26
27
  name: string;
@@ -10,6 +10,7 @@ export { Envelope, AmpEnvelope, FreqEnvelope, EnvelopeStages, } from "./Envelope
10
10
  export interface ICreateModule {
11
11
  id?: string;
12
12
  name: string;
13
+ numberOfVoices?: number;
13
14
  type: string;
14
15
  props: any;
15
16
  }
@@ -11,8 +11,8 @@ export interface RouteInterface extends RouteProps {
11
11
  export declare function createRoute(props: Optional<RouteInterface, "id">): {
12
12
  id: string;
13
13
  sourceId: string;
14
- sourceIOId: string;
15
14
  destinationId: string;
15
+ sourceIOId: string;
16
16
  destinationIOId: string;
17
17
  };
18
18
  export declare function applyRoutes(routes: RouteInterface[]): void;