-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
42 lines (40 loc) · 1.65 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
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface Options {
volume?: number
speed?: number
isBlocking?: boolean
}
export interface Data {
channels: number
currentFrameLen?: number
sampleRate: number
/** In seconds. */
totalDuration?: number
/** Provides controls to play, pause, and stop the audio. */
controller?: Controller
}
/**
* This method blocks the thread by default. Set `isBlocking` to `false` to allow this method to spawn a thread in the background. Note that this incurs some additional overhead.
* The speed and volume is both set to 1.0 by default. Take note that a controller is only returned if the method is non-blocking,
*/
export function playFromBuf(buf: Buffer, opt?: Options | undefined | null): Data
/**
* This method blocks the thread by default. Set `isBlocking` to `false` to allow this method to spawn a thread in the background. Note that this incurs some additional overhead.
* The speed and volume is both set to 1.0 by default. Take note that a controller is only returned if the method is non-blocking,
*/
export function playFromSine(freq: number, ms: number, opt?: Options | undefined | null): Data
/** Provides methods to play, pause, and stop the audio. */
export class Controller {
/** Resumes playback. */
play(): void
/** Pauses playback. No effect if already paused. A paused controller can be resumed with `play()`. */
pause(): void
/** Stops the playback. Once stopped, the audio track can never be played again. */
stop(): void
/** Sets the playback speed. */
setSpeed(speed: number): void
/** Sets the playback volume. */
setVolume(volume: number): void
}