UNPKG

ez-web-audio

Version:

Making the Web Audio API super EZ since 2024.

82 lines 2.92 kB
import { Playable } from './interfaces/playable'; import { Connectable, Connection } from './interfaces/connectable'; import { TimeObject } from './utils/create-time-object'; import { BaseParamController, ControlType, ParamController, RampType, RatioType } from './param-controller'; export interface OscillatorOptsFilterValues { frequency?: number; q?: number; } export interface OscillatorOpts { startOffset?: number; frequency?: number; detune?: number; gain?: number; type?: OscillatorType; highpass?: OscillatorOptsFilterValues; bandpass?: OscillatorOptsFilterValues; lowpass?: OscillatorOptsFilterValues; lowshelf?: OscillatorOptsFilterValues; highshelf?: OscillatorOptsFilterValues; peaking?: OscillatorOptsFilterValues; notch?: OscillatorOptsFilterValues; allpass?: OscillatorOptsFilterValues; } export declare class Oscillator implements Playable, Connectable { private audioContext; private filters; private type; protected freq: number; private controller; private oscillator; private gainNode; private pannerNode; connections: Connection[]; constructor(audioContext: AudioContext, options?: OscillatorOpts); onPlaySet(type: ControlType): { to: (value: number) => { at: (time: number) => void; endingAt: (time: number, rampType?: RampType) => void; }; }; onPlayRamp(type: ControlType, rampType?: RampType): { from: (startValue: number) => { to: (endValue: number) => { in: (endTime: number) => void; }; }; }; private setup; wireConnections(): void; addConnection(connection: Connection): void; removeConnection(name: string): void; getConnection(name: string): Connection | undefined; getNodeFrom<T extends AudioNode>(connectionName: string): T | undefined; get audioSourceNode(): OscillatorNode; update(type: ControlType): { to: (value: number) => { from: (method: RatioType) => void; }; }; changePanTo(value: number): void; changeGainTo(value: number): void; play(): void; playFor(duration: number): void; playAt(time: number): void; stop(): void; private _isPlaying; get isPlaying(): boolean; get duration(): TimeObject; get percentGain(): number; } export declare class OscillatorController extends BaseParamController implements ParamController { private oscillator; protected gainNode: GainNode; protected pannerNode: StereoPannerNode; constructor(oscillator: OscillatorNode, gainNode: GainNode, pannerNode: StereoPannerNode); updateAudioSource(oscillator: OscillatorNode): void; protected _update(type: ControlType, value: number): void; setValuesAtTimes(): void; private applyValues; private applyRampValues; } //# sourceMappingURL=oscillator.d.ts.map