// https://webaudio.github.io/web-audio-api/#enumdef-audiocontextlatencycategory
enum AudioContextLatencyCategory { "balanced", "interactive", "playback" };

// https://webaudio.github.io/web-audio-api/#AudioContext
[Exposed=Window]
interface AudioContext : BaseAudioContext {
    constructor(optional AudioContextOptions contextOptions = {});
    readonly attribute double baseLatency;
    readonly attribute double outputLatency;
    AudioTimestamp getOutputTimestamp ();
    Promise<undefined> resume ();
    Promise<undefined> suspend ();
    Promise<undefined> close ();
    MediaElementAudioSourceNode createMediaElementSource (HTMLMediaElement mediaElement);
    [FIXME] MediaStreamAudioSourceNode createMediaStreamSource (MediaStream mediaStream);
    [FIXME] MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (MediaStreamTrack mediaStreamTrack);
    [FIXME] MediaStreamAudioDestinationNode createMediaStreamDestination ();
};

// https://webaudio.github.io/web-audio-api/#AudioContextOptions
dictionary AudioContextOptions {
    (AudioContextLatencyCategory or double) latencyHint = "interactive";
    float sampleRate;
};

// https://webaudio.github.io/web-audio-api/#AudioTimestamp
dictionary AudioTimestamp {
    double contextTime;
    DOMHighResTimeStamp performanceTime;
};
