import { Sound as SoundElement, SoundType } from "../../nlcore/elements/sound"; import { SoundToken } from "@narraleaf/sound"; import { FadeOptions } from "../../nlcore/elements/type"; import { Awaitable } from "../../../util/data"; import { GameState } from "../gameState"; import { LogicAction } from "../../nlcore/action/logicAction"; export type AudioDataRaw = { isPlaying: boolean; position: number; }; export type AudioManagerDataRaw = { sounds: [string, AudioDataRaw][]; groups: [SoundType, number][]; }; export declare class AudioManager { private gameState; private state; private channels; private channelVolumes; private globalVolume; private sound; private ready; private isReady; constructor(gameState: GameState); /** * Must be called ONCE on the client side to prepare audio subsystem. * Doing it here avoids "AudioContext is not defined" on the server. */ initialize(): void; play(sound: SoundElement, options?: FadeOptions): Awaitable; playSoundToken(sound: SoundElement, options?: FadeOptions): Promise; stop(sound: SoundElement, duration?: number): Awaitable; setVolume(sound: SoundElement, volume: number, duration?: number): Awaitable; mute(sound: SoundElement, muted?: boolean): Awaitable; pause(sound: SoundElement, duration?: number): Awaitable; resume(sound: SoundElement, duration?: number): Awaitable; setRate(sound: SoundElement, rate: number): Awaitable; getPosition(sound: SoundElement): number; isPlaying(sound: SoundElement): boolean; getToken(sound: SoundElement): SoundToken | null; toData(): AudioManagerDataRaw; fromData(data: AudioManagerDataRaw, elementMap: Map): this; soundFromData(sound: SoundElement, data: AudioDataRaw): void; isManaged(sound: SoundElement): boolean; reset(): void; setGroupVolume(type: SoundType, volume: number): void; setGlobalVolume(volume: number): void; getGlobalVolume(): number; getGroupVolume(type: SoundType): number; destroy(): void; private setupGroupVolume; }