| Lift freeq's AV media plane out of sleek 90f8b89 nandi 19d ago | 1 | [package] |
| 2 | name = "cpal" |
| 3 | version = "0.18.0" |
| 4 | description = "Low-level cross-platform audio I/O library in pure Rust." |
| 5 | repository = "https://github.com/RustAudio/cpal" |
| 6 | documentation = "https://docs.rs/cpal" |
| 7 | license = "Apache-2.0" |
| 8 | keywords = ["audio", "sound"] |
| 9 | edition = "2021" |
| 10 | rust-version = "1.78" |
| 11 | |
| 12 | [features] |
| 13 | # Audio thread priority elevation |
| 14 | # Raises the audio callback thread to real-time priority for lower latency and fewer glitches |
| 15 | # Requires: On Linux, either rtkit or appropriate user permissions (e.g. limits.conf or capabilities) |
| 16 | # Platform: Linux, DragonFly BSD, FreeBSD, NetBSD, Windows |
| 17 | audio_thread_priority = ["dep:audio_thread_priority"] |
| 18 | |
| 19 | # ASIO backend for Windows |
| 20 | # Provides low-latency audio I/O by bypassing the Windows audio stack |
| 21 | # Requires: ASIO drivers and LLVM/Clang for build-time bindings |
| 22 | # See README for detailed setup instructions |
| 23 | asio = [ |
| 24 | "dep:asio-sys", |
| 25 | "dep:num-traits", |
| 26 | ] |
| 27 | |
| 28 | # Audio Worklet backend for WebAssembly |
| 29 | # Provides lower-latency web audio processing compared to default Web Audio API |
| 30 | # Requires: Build with atomics support and Cross-Origin headers for SharedArrayBuffer |
| 31 | # Platform: WebAssembly (wasm32-unknown-unknown) |
| 32 | audioworklet = [ |
| 33 | "wasm-bindgen", |
| 34 | "web-sys/Blob", |
| 35 | "web-sys/BlobPropertyBag", |
| 36 | "web-sys/Url", |
| 37 | "web-sys/AudioWorklet", |
| 38 | "web-sys/AudioWorkletNode", |
| 39 | "web-sys/AudioWorkletNodeOptions", |
| 40 | ] |
| 41 | |
| 42 | # Support for user-defined custom hosts, devices, and streams |
| 43 | # Allows integration with audio systems not natively supported by CPAL |
| 44 | # See examples/custom.rs for usage |
| 45 | # Platform: All platforms |
| 46 | custom = [] |
| 47 | |
| 48 | # JACK Audio Connection Kit backend |
| 49 | # Provides low-latency connections between applications and audio hardware |
| 50 | # Requires: JACK server and client libraries installed on the system |
| 51 | # Platform: Linux, DragonFly BSD, FreeBSD, NetBSD, macOS, Windows |
| 52 | # Note: JACK must be installed separately on all platforms |
| 53 | jack = ["dep:jack"] |
| 54 | |
| 55 | # PipeWire backend |
| 56 | # Provides audio I/O on Linux and some BSDs via the PipeWire multimedia server |
| 57 | # Requires: PipeWire server and client libraries installed on the system |
| 58 | # Platform: Linux, DragonFly BSD, FreeBSD, NetBSD |
| 59 | pipewire = ["dep:pipewire"] |
| 60 | |
| 61 | # PulseAudio backend |
| 62 | # Provides audio I/O support on Linux and some BSDs using the PulseAudio sound server |
| 63 | # Requires: PulseAudio server and client libraries installed on the system |
| 64 | # Platform: Linux, DragonFly BSD, FreeBSD, NetBSD |
| 65 | pulseaudio = ["dep:pulseaudio", "dep:futures"] |
| 66 | |
| 67 | # WebAssembly backend using wasm-bindgen |
| 68 | # Enables the Web Audio API backend for browser-based audio |
| 69 | # Required for any WebAssembly audio support |
| 70 | # Platform: WebAssembly (wasm32-unknown-unknown) |
| 71 | # Note: This is typically enabled automatically when targeting wasm32 |
| 72 | wasm-bindgen = ["dep:wasm-bindgen", "dep:wasm-bindgen-futures"] |
| 73 | |
| 74 | [dependencies] |
| 75 | dasp_sample = "0.11" |
| 76 | |
| 77 | [dev-dependencies] |
| 78 | anyhow = "1.0" |
| 79 | hound = "3.5" |
| 80 | ringbuf = "0.4" |
| 81 | clap = { version = ">=4.0, <=4.5.57", features = ["derive"] } |
| 82 | |
| 83 | # Support a range of versions in order to avoid duplication of this crate. Make sure to test all |
| 84 | # versions when bumping to a new release, and only increase the minimum when absolutely necessary. |
| 85 | # When updating this, also update the "windows-version" matrix in the CI workflow. |
| 86 | [target.'cfg(target_os = "windows")'.dependencies] |
| 87 | windows = { version = ">=0.59, <=0.62", features = [ |
| 88 | "Win32_Media_Audio", |
| 89 | "Win32_Foundation", |
| 90 | "Win32_Devices_Properties", |
| 91 | "Win32_Media_KernelStreaming", |
| 92 | "Win32_System_Com_StructuredStorage", |
| 93 | "Win32_System_Threading", |
| 94 | "Win32_Security", |
| 95 | "Win32_System_SystemServices", |
| 96 | "Win32_System_Variant", |
| 97 | "Win32_Media_Multimedia", |
| 98 | "Win32_UI_Shell_PropertiesSystem", |
| 99 | ] } |
| 100 | audio_thread_priority = { version = "0.34", optional = true } |
| 101 | asio-sys = { version = "0.3.0", path = "asio-sys", optional = true } |
| 102 | num-traits = { version = "0.2", optional = true } |
| 103 | jack = { version = "0.13", optional = true } |
| 104 | |
| 105 | [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd"))'.dependencies] |
| 106 | alsa = "0.11" |
| 107 | libc = "0.2" |
| 108 | audio_thread_priority = { version = "0.34", optional = true } |
| 109 | jack = { version = "0.13", optional = true } |
| 110 | pulseaudio = { version = "0.3", optional = true } |
| 111 | futures = { version = "0.3", optional = true } |
| 112 | pipewire = { version = "0.9", optional = true, features = ["v0_3_53"] } |
| 113 | |
| 114 | [target.'cfg(target_vendor = "apple")'.dependencies] |
| 115 | mach2 = "0.5" |
| 116 | coreaudio-rs = { version = "0.14", default-features = false, features = [ |
| 117 | "core_audio", |
| 118 | "audio_toolbox", |
| 119 | ] } |
| 120 | objc2-core-audio = { version = "0.3", default-features = false, features = [ |
| 121 | "std", |
| 122 | "AudioHardware", |
| 123 | "AudioHardwareDeprecated", |
| 124 | "objc2", |
| 125 | "objc2-foundation", |
| 126 | ] } |
| 127 | objc2-audio-toolbox = { version = "0.3", default-features = false, features = [ |
| 128 | "std", |
| 129 | "AUComponent", |
| 130 | "AudioUnitProperties", |
| 131 | ] } |
| 132 | objc2-core-audio-types = { version = "0.3", default-features = false, features = [ |
| 133 | "std", |
| 134 | "CoreAudioBaseTypes", |
| 135 | ] } |
| 136 | objc2-core-foundation = { version = "0.3" } |
| 137 | objc2-foundation = { version = "0.3" } |
| 138 | objc2 = { version = "0.6" } |
| 139 | |
| 140 | [target.'cfg(target_os = "macos")'.dependencies] |
| 141 | jack = { version = "0.13", optional = true } |
| 142 | |
| 143 | [target.'cfg(target_os = "ios")'.dependencies] |
| 144 | objc2-avf-audio = { version = "0.3", default-features = false, features = [ |
| 145 | "std", |
| 146 | "AVAudioSession", |
| 147 | ] } |
| 148 | |
| 149 | [target.'cfg(target_os = "emscripten")'.dependencies] |
| 150 | wasm-bindgen = { version = "0.2" } |
| 151 | wasm-bindgen-futures = "0.4" |
| 152 | js-sys = { version = "0.3" } |
| 153 | web-sys = { version = "0.3", features = [ |
| 154 | "AudioContext", |
| 155 | "AudioContextOptions", |
| 156 | "AudioBuffer", |
| 157 | "AudioBufferSourceNode", |
| 158 | "AudioNode", |
| 159 | "AudioDestinationNode", |
| 160 | "Window", |
| 161 | "AudioContextState", |
| 162 | ] } |
| 163 | |
| 164 | [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] |
| 165 | wasm-bindgen = { version = "0.2", optional = true } |
| 166 | wasm-bindgen-futures = { version = "0.4", optional = true } |
| 167 | js-sys = { version = "0.3" } |
| 168 | web-sys = { version = "0.3", features = [ |
| 169 | "AudioContext", |
| 170 | "AudioContextOptions", |
| 171 | "AudioBuffer", |
| 172 | "AudioBufferSourceNode", |
| 173 | "AudioNode", |
| 174 | "AudioDestinationNode", |
| 175 | "Window", |
| 176 | "AudioContextState", |
| 177 | ] } |
| 178 | |
| 179 | [target.'cfg(target_os = "android")'.dependencies] |
| 180 | ndk = { version = "0.9", default-features = false, features = [ |
| 181 | "audio", |
| 182 | "api-level-26", |
| 183 | ] } |
| 184 | ndk-context = "0.1" |
| 185 | jni = "0.21" |
| 186 | num-derive = "0.4" |
| 187 | num-traits = "0.2" |
| 188 | |
| 189 | [[example]] |
| 190 | name = "beep" |
| 191 | |
| 192 | [[example]] |
| 193 | name = "enumerate" |
| 194 | |
| 195 | [[example]] |
| 196 | name = "feedback" |
| 197 | |
| 198 | [[example]] |
| 199 | name = "record_wav" |
| 200 | |
| 201 | [[example]] |
| 202 | name = "synth_tones" |
| 203 | |
| 204 | [package.metadata.docs.rs] |
| 205 | all-features = true |
| 206 | rustdoc-args = ["--cfg", "docsrs"] |
| 207 | targets = [ |
| 208 | "x86_64-unknown-linux-gnu", |
| 209 | "x86_64-pc-windows-msvc", |
| 210 | "x86_64-apple-darwin", |
| 211 | "aarch64-apple-darwin", |
| 212 | "aarch64-apple-ios", |
| 213 | "wasm32-unknown-unknown", |
| 214 | "wasm32-unknown-emscripten", |
| 215 | "aarch64-linux-android", |
| 216 | "x86_64-unknown-freebsd", |
| 217 | "x86_64-unknown-netbsd", |
| 218 | "x86_64-unknown-dragonfly", |
| 219 | ] |