38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import ResonatorAudioContext from '../audio-context';
|
|
import AudioGraph from '../audio-graph';
|
|
import ResonatorScene from '../scenes/webaudio-scene';
|
|
import { BaseSource } from './base-source';
|
|
import { SourceType } from './source-type';
|
|
export default class AudioSource implements BaseSource {
|
|
playing: boolean;
|
|
looping: boolean;
|
|
private node;
|
|
private sceneNode;
|
|
private buffer;
|
|
private context;
|
|
private graph;
|
|
private scene;
|
|
private playOnLoad;
|
|
private position;
|
|
private playbackRate;
|
|
private volume;
|
|
private gain;
|
|
private type;
|
|
constructor(graph: AudioGraph, scene: ResonatorScene, context: ResonatorAudioContext, buffer?: AudioBuffer, type?: SourceType);
|
|
init(): void;
|
|
getBuffer(): AudioBuffer;
|
|
setBuffer(data: AudioBuffer): void;
|
|
play(when?: number, offset?: number, duration?: number): void;
|
|
setPosition(x: number, y: number, z: number): void;
|
|
setPlaybackRate(rate: number): void;
|
|
getPlaybackRate(): number;
|
|
setVolume(volume: number): void;
|
|
getVolume(): number;
|
|
private createConnections;
|
|
stop(): void;
|
|
destroy(): void;
|
|
loop(value: boolean): void;
|
|
fadeOut(time: number): void;
|
|
fadeIn(time: number): void;
|
|
}
|