UNPKG

3.51 kBTypeScriptView Raw
1import { Seconds } from "../type/Units.js";
2import { Emitter } from "../util/Emitter.js";
3import { AnyAudioContext } from "./AudioContext.js";
4import type { DrawClass as Draw } from "../util/Draw.js";
5import type { DestinationClass as Destination } from "./Destination.js";
6import type { TransportClass as Transport } from "../clock/Transport.js";
7import type { ListenerClass as Listener } from "./Listener.js";
8export type ExcludedFromBaseAudioContext = "onstatechange" | "addEventListener" | "removeEventListener" | "listener" | "dispatchEvent" | "audioWorklet" | "destination" | "createScriptProcessor";
9export type BaseAudioContextSubset = Omit<BaseAudioContext, ExcludedFromBaseAudioContext>;
10export type ContextLatencyHint = AudioContextLatencyCategory;
11export declare abstract class BaseContext extends Emitter<"statechange" | "tick"> implements BaseAudioContextSubset {
12 abstract createAnalyser(): AnalyserNode;
13 abstract createOscillator(): OscillatorNode;
14 abstract createBufferSource(): AudioBufferSourceNode;
15 abstract createBiquadFilter(): BiquadFilterNode;
16 abstract createBuffer(_numberOfChannels: number, _length: number, _sampleRate: number): AudioBuffer;
17 abstract createChannelMerger(_numberOfInputs?: number | undefined): ChannelMergerNode;
18 abstract createChannelSplitter(_numberOfOutputs?: number | undefined): ChannelSplitterNode;
19 abstract createConstantSource(): ConstantSourceNode;
20 abstract createConvolver(): ConvolverNode;
21 abstract createDelay(_maxDelayTime?: number | undefined): DelayNode;
22 abstract createDynamicsCompressor(): DynamicsCompressorNode;
23 abstract createGain(): GainNode;
24 abstract createIIRFilter(_feedForward: number[] | Float32Array, _feedback: number[] | Float32Array): IIRFilterNode;
25 abstract createPanner(): PannerNode;
26 abstract createPeriodicWave(_real: number[] | Float32Array, _imag: number[] | Float32Array, _constraints?: PeriodicWaveConstraints | undefined): PeriodicWave;
27 abstract createStereoPanner(): StereoPannerNode;
28 abstract createWaveShaper(): WaveShaperNode;
29 abstract createMediaStreamSource(_stream: MediaStream): MediaStreamAudioSourceNode;
30 abstract createMediaElementSource(_element: HTMLMediaElement): MediaElementAudioSourceNode;
31 abstract createMediaStreamDestination(): MediaStreamAudioDestinationNode;
32 abstract decodeAudioData(_audioData: ArrayBuffer): Promise<AudioBuffer>;
33 abstract createAudioWorkletNode(_name: string, _options?: Partial<AudioWorkletNodeOptions>): AudioWorkletNode;
34 abstract get rawContext(): AnyAudioContext;
35 abstract addAudioWorkletModule(_url: string): Promise<void>;
36 abstract lookAhead: number;
37 abstract latencyHint: ContextLatencyHint | Seconds;
38 abstract resume(): Promise<void>;
39 abstract setTimeout(_fn: (...args: any[]) => void, _timeout: Seconds): number;
40 abstract clearTimeout(_id: number): this;
41 abstract setInterval(_fn: (...args: any[]) => void, _interval: Seconds): number;
42 abstract clearInterval(_id: number): this;
43 abstract getConstant(_val: number): AudioBufferSourceNode;
44 abstract get currentTime(): Seconds;
45 abstract get state(): AudioContextState;
46 abstract get sampleRate(): number;
47 abstract get listener(): Listener;
48 abstract get transport(): Transport;
49 abstract get draw(): Draw;
50 abstract get destination(): Destination;
51 abstract now(): Seconds;
52 abstract immediate(): Seconds;
53 toJSON(): Record<string, any>;
54 readonly isOffline: boolean;
55}