import { AudioFrame } from './audio_frame.js'; import '@livekit/rtc-ffi-bindings'; /** * Resampler quality. Higher quality settings result in better audio quality but require more * processing power. */ declare enum AudioResamplerQuality { QUICK = 0, LOW = 1, MEDIUM = 2, HIGH = 3, VERY_HIGH = 4 } /** * AudioResampler provides functionality to resample audio data from an input sample rate to * an output sample rate using the Sox resampling library. It supports multiple channels and * configurable resampling quality. */ declare class AudioResampler { #private; /** * Initializes a new AudioResampler. * * @param inputRate - The sample rate of the input audio data (in Hz). * @param outputRate - The desired sample rate of the output audio data (in Hz). * @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1. * @param quality - The quality setting for the resampler. Defaults to * `AudioResamplerQuality.MEDIUM`. */ constructor(inputRate: number, outputRate: number, channels?: number, quality?: AudioResamplerQuality); get inputRate(): number; get outputRate(): number; get channels(): number; /** * Releases the underlying native resampler handle. Must be called when * the resampler is no longer needed to avoid leaking the FD. */ close(): void; /** * Push audio data into the resampler and retrieve any available resampled data. * * This method accepts audio data, resamples it according to the configured input and output rates, * and returns any resampled data that is available after processing the input. * * @param data - The audio frame to resample * * @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may * be empty if no output data is available yet. */ push(data: AudioFrame): AudioFrame[]; /** * Flush any remaining audio data through the resampler and retrieve the resampled data. * * @remarks * This method should be called when no more input data will be provided to ensure that all * internal buffers are processed and all resampled data is output. */ flush(): AudioFrame[]; } export { AudioResampler, AudioResamplerQuality };