-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
index.d.ts
110 lines (90 loc) · 3.71 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
declare module 'cordova-plugin-audioinput' { }
export interface AudioInputConfiguration {
// The Sample Rate in Hz.
// For convenience, use the audioinput.SAMPLERATE constants to set this parameter
sampleRate?: number;
// Maximum size in bytes of the capture buffer. Should be a power of two and <= 16384
bufferSize?: number;
// The number of channels to use: Mono (1) or Stereo (2).
// For convenience, use the audioinput.CHANNELS constants to set this parameter.
channels?: number;
// The audio format. Currently PCM_16BIT and PCM_8BIT are supported.
// For convenience, use the audioinput.FORMAT constant to access the possible
// formats that the plugin supports
format?: string;
// Specifies if the audio data should be normalized or not.
normalize?: boolean;
// Specifies the factor to use if normalization is performed.
normalizationFactor?: number;
// If set to true, the plugin will handle all conversion of the data to
// web audio. The plugin can then act as an AudioNode that can be connected
// to your web audio node chain.
streamToWebAudio?: boolean;
// Used in conjunction with streamToWebAudio. If no audioContext is given,
// one (prefixed) will be created by the plugin.
audioContext?: AudioContext;
// Defines how many chunks will be merged each time, a low value means lower latency
// but requires more CPU resources.
concatenateMaxChunks?: number;
// Specifies the type of the type of source audio your app requires.
// For convenience, use the audioinput.AUDIOSOURCE_TYPE constants to set this parameter:
// -DEFAULT
// -CAMCORDER - Microphone audio source with same orientation as camera if available.
// -UNPROCESSED - Unprocessed sound if available.
// -VOICE_COMMUNICATION - Tuned for voice communications such as VoIP.
// -MIC - Microphone audio source. (Android only)
// -VOICE_RECOGNITION - Tuned for voice recognition if available (Android only)
audioSourceType?: number;
// Optionally specifies a file://... URL to which the audio should be saved.
// If this is set, then no audioinput events will be raised during recording.
// When stop is called, a single audioinputfinished event will be raised, with
// a "file" argument that contains the URL to which the audio was written,
// and the callback passed into stop() will be invoked.
// Currently, only WAV format files are guaranteed to be supported on all platforms.
// When called initialize(), this should be a URL to the directory in which files will
// be saved when calling start(), so that initialize() can ensure access to the directory
// is available.
fileUrl?: string;
// Optional onError callback. Is called with error message string as parameter.
onError?: Function;
// Guess it?
debug?: boolean;
}
declare interface AudioInput {
FORMAT: {
PCM_16BIT: string;
PCM_8BIT: string;
}
CHANNELS: {
MONO: number;
STEREO: number;
}
SAMPLERATE: {
TELEPHONE_8000Hz: number;
CD_QUARTER_11025Hz: number;
VOIP_16000Hz: number;
CD_HALF_22050Hz: number;
MINI_DV_32000Hz: number;
CD_XA_37800Hz: number;
NTSC_44056Hz: number;
CD_AUDIO_44100Hz: number;
}
AUDIOSOURCE_TYPE: {
DEFAULT: number;
CAMCORDER: number;
MIC: number;
UNPROCESSED: number;
VOICE_COMMUNICATION: number;
VOICE_RECOGNITION: number;
}
initialize(cfg: AudioInputConfiguration, onComplete: any): void;
checkMicrophonePermission(onComplete: any): void;
getMicrophonePermission(onComplete: any): void;
start(cfg: AudioInputConfiguration): void;
stop(onStopped: any): void;
connect(audioNode: any): void;
disconnect(): void;
getAudioContext(): AudioContext;
getCfg(): AudioInputConfiguration;
isCapturing(): boolean | any[];
}