|
138 | 138 | //! to avoid adding extra crates to your binary. |
139 | 139 | //! See the [available feature flags](https://docs.rs/crate/rodio/latest/features) for all options. |
140 | 140 | //! |
141 | | -//! ## Optional Features |
| 141 | +//! ## Feature Flags |
142 | 142 | //! |
143 | | -//! Rodio provides several optional features that are guarded with feature gates. |
| 143 | +//! ### Core |
144 | 144 | //! |
145 | | -//! ### Feature "tracing" |
| 145 | +//! | Feature | Description | |
| 146 | +//! |---------|-------------| |
| 147 | +//! | `playback` **(default)** | Audio playback | |
| 148 | +//! | `recording` **(default)** | Microphone input | |
| 149 | +//! | `wav_output` | Write decoded audio to a WAV file | |
| 150 | +//! | `tracing` | Record stream errors as `tracing` events instead of printing to stderr | |
| 151 | +//! | `experimental` | Experimental APIs backed by atomic floating-point operations | |
146 | 152 | //! |
147 | | -//! The "tracing" feature replaces the print to stderr when a stream error happens with a |
148 | | -//! recording an error event with tracing. |
| 153 | +//! ### Performance |
149 | 154 | //! |
150 | | -//! ### Feature "noise" |
| 155 | +//! | Feature | Description | |
| 156 | +//! |---------|-------------| |
| 157 | +//! | `simd` **(default)** | SIMD-accelerated decoding | |
| 158 | +//! | `64bit` | Use `f64` instead of `f32` for all samples and internal math [^1] | |
| 159 | +//! | `realtime` | Real-time thread scheduling priority (you must grant `rtprio` yourself) | |
| 160 | +//! | `realtime-dbus` | Like `realtime`, but uses D-Bus/rtkit to arrange limits automatically on desktop Linux | |
151 | 161 | //! |
152 | | -//! The "noise" feature adds support for white and pink noise sources. This feature requires the |
153 | | -//! "rand" crate. |
| 162 | +//! [^1]: By default, rodio uses 32-bit floats (`f32`), which offers better performance and is |
| 163 | +//! sufficient for most use cases. The 64-bit mode addresses precision drift when chaining many |
| 164 | +//! audio operations together, in long-running signal generators where phase errors compound |
| 165 | +//! over time, and during resampling where rounding errors accumulate. |
154 | 166 | //! |
155 | | -//! ### Feature "playback" |
| 167 | +//! ### Audio generation |
156 | 168 | //! |
157 | | -//! The "playback" feature adds support for playing audio. This feature requires the "cpal" crate. |
| 169 | +//! | Feature | Description | |
| 170 | +//! |---------|-------------| |
| 171 | +//! | `noise` | White and pink noise sources | |
| 172 | +//! | `dither` | Dithering; implies `noise` | |
158 | 173 | //! |
159 | | -//! ### Feature "64bit" |
| 174 | +//! ### Platform backends |
160 | 175 | //! |
161 | | -//! The "64bit" feature enables 64-bit sample precision using `f64` for audio samples and most |
162 | | -//! internal calculations. By default, rodio uses 32-bit floats (`f32`), which offers better |
163 | | -//! performance and is sufficient for most use cases. The 64-bit mode addresses precision drift |
164 | | -//! when chaining many audio operations together and in long-running signal generators where |
165 | | -//! phase errors compound over time. |
| 176 | +//! | Feature | Platform | Description | |
| 177 | +//! |---------|----------|-------------| |
| 178 | +//! | `pulseaudio` **(default)** | Linux | PulseAudio backend; also works on PipeWire systems via `pipewire-pulse`, with ALSA as fallback | |
| 179 | +//! | `asio` | Windows | ASIO low-latency backend | |
| 180 | +//! | `jack` | Linux/macOS/Windows | JACK Audio Connection Kit | |
| 181 | +//! | `pipewire` | Linux | Native PipeWire backend | |
| 182 | +//! | `audio-worklet` | Wasm | Audio Worklet backend | |
| 183 | +//! | `wasm-bindgen` | Wasm | wasm-bindgen Wasm backend | |
| 184 | +//! |
| 185 | +//! ### Audio format features |
| 186 | +//! |
| 187 | +//! See the [Decoder Backends](#decoder-backends) section above. |
166 | 188 | //! |
167 | 189 | //! ## How it works under the hood |
168 | 190 | //! |
|
0 commit comments