@hiddentao/clockwork-engine
Version:
A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering
40 lines • 1.21 kB
TypeScript
/**
* Audio Layer Interface
*
* Platform-agnostic audio abstraction that wraps audio engines
* like Web Audio API or provides headless implementations.
*/
/**
* Audio context state (matches Web Audio API states)
*/
export declare enum AudioContextState {
SUSPENDED = "suspended",
RUNNING = "running",
CLOSED = "closed"
}
/**
* AudioBuffer interface (compatible with Web Audio API AudioBuffer)
*/
export interface AudioBuffer {
readonly numberOfChannels: number;
readonly length: number;
readonly sampleRate: number;
readonly duration: number;
getChannelData(channel: number): Float32Array;
}
/**
* Main audio layer interface
*/
export interface AudioLayer {
initialize(): Promise<void>;
destroy(): void;
loadSound(id: string, data: string | ArrayBuffer): Promise<void>;
createBuffer(channels: number, length: number, sampleRate: number): AudioBuffer;
loadSoundFromBuffer(id: string, buffer: AudioBuffer): void;
playSound(id: string, volume?: number, loop?: boolean): void;
stopSound(id: string): void;
stopAll(): void;
tryResumeOnce(): Promise<void>;
getState(): AudioContextState;
}
//# sourceMappingURL=AudioLayer.d.ts.map