File size: 1,466 Bytes
4cadbaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

interface Plugin {
	empty (): boolean;
	hasPending (): boolean;
	setVolume (channel: number, volume: number): void;
	programChange (channel: number, program: number): void;
	noteOn (channel: number, note: number, velocity: number, timestamp: number): void;
	noteOff (channel: number, note: number, timestamp: number): void;
	chordOn (channel: number, chord: number[], velocity: number, delay: number): void;
	chordOff (channel: number, chord: number[], delay: number): void;
	stopAllNotes (): void;
}


type PluginCallback = () => any;


interface PluginConfig {
	instrument?: string | number;
	instruments?: string[] | number[];
	soundfontUrl?: string;
	api: "webmidi" | "webaudio" | "audiotag" | "flash";
	targetFormat?: "ogg" | "mp3";
	callback?: PluginCallback;
	outputDeviceIndex?: number;
}


declare const WebMIDI: Plugin;
declare const WebAudio: Plugin;
declare const AudioTag: Plugin;


declare const loadPlugin: (config: PluginConfig | PluginCallback) => Promise<any>;
declare const noteOn: (channel: number, note: number, velocity: number, timestamp: number) => void;
declare const noteOff: (channel: number, note: number, timestamp: number) => void;
declare const stopAllNotes: () => void;
declare const setVolume: (channel: number, volume: number) => void;
declare const programChange: (channel: number, program: number) => void;



export {
	WebMIDI,
	WebAudio,
	AudioTag,
	loadPlugin,
	noteOn,
	noteOff,
	stopAllNotes,
	setVolume,
	programChange,
};