UNPKG

pw-client

Version:

Node.js wrapper for developing PipeWire clients

64 lines (63 loc) 2.37 kB
import { AudioFormat } from "./audio-format.mjs"; /** * Audio quality presets that balance performance and audio quality. * Quality affects the internal format negotiation order but users always * work with JavaScript Numbers (Float64). * The quality level determines the internal format negotiations for best performance. * * @enum AudioQuality * * @example * ```typescript * // For music production * const stream = await session.createAudioOutputStream({ * quality: AudioQuality.High * }); * * // For games and general use * const stream = await session.createAudioOutputStream({ * quality: AudioQuality.Standard * }); * * // For system sounds * const stream = await session.createAudioOutputStream({ * quality: AudioQuality.Efficient * }); * ``` */ export declare enum AudioQuality { /** * Highest quality audio with maximum precision. * Best for: Music production, mastering, critical listening * Performance: Highest CPU usage, best quality * Formats: Float64 → Float32 → Int32 → Int24_32 → Int16 * Sample rates: 192kHz → 96kHz → 88.2kHz → 48kHz → 44.1kHz */ High = "high", /** * Balanced quality and performance. * Best for: General music playback, games, most applications * Performance: Good balance of CPU usage and quality * Formats: Float32 → Float64 → Int16 → Int32 * Sample rates: 48kHz → 44.1kHz → 96kHz → 88.2kHz → 32kHz */ Standard = "standard", /** * Lower quality, optimized for performance. * Best for: Voice, system sounds, resource-constrained environments * Performance: Lowest CPU usage, acceptable quality * Formats: Int16 → Float32 → Float64 → Int32 * Sample rates: 44.1kHz → 48kHz → 32kHz → 22.05kHz → 16kHz */ Efficient = "efficient" } /** * Get the optimal format preference order for a given quality level. * This internal function maps user-friendly quality levels to technical format negotiations. */ export declare function getFormatPreferences(quality: AudioQuality): Array<AudioFormat>; /** * Get the optimal sample rate preference order for a given quality level. * This internal function maps user-friendly quality levels to technical rate negotiations. */ export declare function getRatePreferences(quality: AudioQuality): Array<number>;