UNPKG

1.35 kBTypeScriptView Raw
1/**
2 * Create a new AudioContext
3 */
4export declare function createAudioContext(options?: AudioContextOptions): AudioContext;
5/**
6 * Create a new OfflineAudioContext
7 */
8export declare function createOfflineAudioContext(channels: number, length: number, sampleRate: number): OfflineAudioContext;
9/**
10 * Either the online or offline audio context
11 */
12export type AnyAudioContext = AudioContext | OfflineAudioContext;
13/**
14 * Interface for things that Tone.js adds to the window
15 */
16interface ToneWindow extends Window {
17 TONE_SILENCE_LOGGING?: boolean;
18 TONE_DEBUG_CLASS?: string;
19 BaseAudioContext: any;
20 AudioWorkletNode: any;
21}
22/**
23 * A reference to the window object
24 * @hidden
25 */
26export declare const theWindow: ToneWindow | null;
27/**
28 * If the browser has a window object which has an AudioContext
29 * @hidden
30 */
31export declare const hasAudioContext: boolean | null;
32export declare function createAudioWorkletNode(context: AnyAudioContext, name: string, options?: Partial<AudioWorkletNodeOptions>): AudioWorkletNode;
33/**
34 * This promise resolves to a boolean which indicates if the
35 * functionality is supported within the currently used browse.
36 * Taken from [standardized-audio-context](https://github.com/chrisguttandin/standardized-audio-context#issupported)
37 */
38export { isSupported as supported } from "standardized-audio-context";