/** The own voice transport on the main thread (GRYT-1818): one WebTransport session to the SFU, the send worklet feeding it and the receive worklet playing what comes back. */ import type { VoiceEffectSettings } from "../audio/voiceEffects.js"; import type { VoiceConfig } from "../types.js"; /** What room_joined offers: where to dial, the cert hash to pin, and a one-use ticket. */ export interface AudioTransportOffer { urls: string[]; certHash: string; ticket: string; /** The native engine's plain UDP (GRYT-1822), when the SFU runs it. */ udp?: AudioUDPOffer; } /** A session id and its key; a packet that opens with the key is the only proof the SFU needs. */ export interface AudioUDPOffer { addrs: string[]; session: number; key: string; } export interface AudioTransportSession { /** The offered address that answered first. */ url: string; /** Swap the microphone stream, after the pipeline is rebuilt. */ setInput(stream: MediaStream): void; /** Mute and push to talk. The timestamp keeps moving while off. */ setSending(on: boolean): void; setEffects(settings: VoiceEffectSettings): void; /** Mono bits per second; stereo follows at 4/3 of it. */ setBitrate(bitrate: number): void; /** Gain for everything heard: 0 when deafened. */ setOutputGain(gain: number): void; /** Volume per sender id on top of that, 1 for anyone not named (GRYT-1831). */ setSenderGains(gains: Map): void; close(): void; /** Settles when the session ends, for whatever reason. */ closed: Promise; } export declare const TRANSPORT_FRAME_MS = 2.5; export declare const TRANSPORT_BITRATE: { min: number; max: number; }; export declare const PASS_THROUGH: VoiceEffectSettings; /** The user's settings as the worklet's effects, chosen the way the graph chooses (microphonePipeline.ts). */ type EffectInputs = Pick; export declare function transportEffects(audio: EffectInputs, eSports: boolean): VoiceEffectSettings; export declare const audioTransportSupported: () => boolean; /** Dial the SFU and start sending `input` and playing into `output`. Rejects if the handshake fails. */ export declare function startAudioTransport(o: { offer: AudioTransportOffer; context: AudioContext; input: MediaStream; output: AudioNode; wasm: ArrayBuffer; effects: VoiceEffectSettings; /** Mono bits per second, clamped to TRANSPORT_BITRATE. */ bitrate?: number; /** The SFU's /audio-ws, for when WebTransport is missing or blocked (GRYT-1831). */ wsUrl?: string; /** The sender ids heard speaking, each time that changes (GRYT-1830). */ onSpeaking?: (senders: number[]) => void; /** Each sender's level in dBFS, about twenty times a second, for a halo (GRYT-1830). */ onLevels?: (levels: Map) => void; /** Each sender's audio waiting to play, in ms, with the levels: for the latency estimate. */ onBuffered?: (buffered: Map) => void; /** Measured round trips by sender, in ms, with the levels (GRYT-1836). */ onRoundTrip?: (rtt: Map) => void; }): Promise; export {};