-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
118 lines (105 loc) · 3.26 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
export const LOOP_OPERATOR_SYNTH: 0;
export const LOOP_OPERATOR_OPTION: 1;
export const BUFFER_LENGTH: number;
export const NUM_BUFFERS: 4;
export const RUN_AS_WORKER: 0;
export const RUN_AS_INLINE: 1;
export const NODE_TYPE_LOOP: 0;
export const NODE_TYPE_INLINE: 1;
export const NODE_TYPE_FILTER: 2;
export const NODE_TYPE_OUT: 3;
export const MSG_INIT: 0;
export const MSG_RESET: 1;
export const MSG_LOG: 2;
export const MSG_ERROR: 3;
export const MSG_ANALYZE_STRUCTURE: 4;
export const MSG_WORKLET_READY: 5;
export const MSG_UPDATE: 6;
export const MSG_NOTE_PLAYED: 7;
export const MSG_SET_AMP: 8;
export const MSG_SET_VARS: 9;
export const MSG_PLAY: 10;
export const MSG_STOP: 11;
export const MSG_PAUSE: 12;
export const MSG_RESUME: 13;
export type VolumeType = {
master?: {
amp: number;
},
loops?: {
name: string;
amp: number;
}
};
export type InputParameterType = {
key: string;
value: number;
}
/**
* The Dittytoy class represents a Dittytoy synthesizer.
*/
export class Dittytoy {
/**
* Indicates whether the synthesizer is paused.
*/
paused: boolean;
/**
* Indicates whether the synthesizer is stopped.
*/
stopped: boolean;
/**
* Adds a listener for a specific event.
* @param event - The event to listen for.
* @param callback - The function to call when the event occurs.
*/
addListener(event: any, callback: any): void;
/**
* Removes a listener for a specific event.
* @param event - The event to stop listening for.
* @param callback - The function to remove from the event's listeners.
*/
removeListener(event: any, callback: any): void;
/**
* Sets the volume for the synthesizer.
* @param volume - The volume settings to apply.
*/
setVolume(volume: VolumeType): void;
/**
* Sets the input parameters for the synthesizer.
* @param inputParameters - The input parameters to set.
*/
setInputParameters(inputParameters: InputParameterType[]): void;
/**
* Compiles the provided code.
* @param code - The code to compile.
* @returns A promise that resolves when the code has been compiled.
*/
compile(code: string): Promise<any>;
/**
* Stops the synthesizer.
* @returns A promise that resolves when the synthesizer has been stopped.
*/
stop(): Promise<void>;
/**
* Pauses the synthesizer.
* @returns A promise that resolves when the synthesizer has been paused.
*/
pause(): Promise<void>;
/**
* Resumes the synthesizer.
* @param inputParameters - The input parameters to set (optional).
* @param volume - The volume settings to apply (optional).
* @param releaseMode - Whether to enable release mode (optional).
* @returns A promise that resolves when the synthesizer has been resumed.
*/
resume(inputParameters?: InputParameterType[], volume?: VolumeType, releaseMode?: boolean): Promise<void>;
/**
* Starts playing the synthesizer.
* @param inputParameters - The input parameters to set (optional).
* @param volume - The volume settings to apply (optional).
* @param releaseMode - Whether to enable release mode (optional).
* @returns A promise that resolves when the synthesizer has started playing.
*/
play(inputParameters?: InputParameterType[], volume?: VolumeType, releaseMode?: boolean): Promise<void>;
}
export {};