Skip to content

Commit 381f18c

Browse files
authored
Merge pull request #888 from RustAudio/chore/improve-default-features
chore: update dependencies and improve feature documentation
2 parents 94b0b8b + 859c009 commit 381f18c

4 files changed

Lines changed: 60 additions & 28 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ rust-version = "1.89"
1313
[features]
1414
# Default feature set provides audio playback and common format support
1515
default = [
16-
"playback",
17-
"recording",
18-
"flac",
19-
"mp3",
20-
"mp4",
21-
"vorbis",
22-
"wav",
23-
"dither",
16+
# Core functionality
17+
"playback",
18+
"recording",
19+
# Audio format support
20+
"flac",
21+
"mp3",
22+
"mp4",
23+
"vorbis",
24+
"wav",
25+
# Platform-specific backends
26+
"pulseaudio",
27+
# Performance features
28+
"simd",
2429
]
2530

2631
# Core functionality features
@@ -48,8 +53,10 @@ noise = ["rand", "rand_distr"]
4853
# Perform all calculations with 64-bit floats (instead of 32)
4954
64bit = []
5055
# Real-time audio thread scheduling
56+
# With the realtime-dbus feature, rtkit arranges the necessary limits over D-Bus on typical desktop systems.
57+
# With the plain realtime feature, you must ensure that rtprio is granted yourself.
58+
# See: https://github.com/RustAudio/cpal#alsa-real-time-priority-promotion
5159
realtime = ["cpal/realtime"]
52-
# D-Bus/rtkit support on top of `realtime` for RT scheduling on Linux/BSD desktop systems
5360
realtime-dbus = ["cpal/realtime-dbus"]
5461
# SIMD-accelerated audio processing
5562
simd = ["symphonia/opt-simd"]

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ Rodio will keep a rolling MSRV (minimum supported rust version) policy of at lea
3838

3939
## Dependencies (Linux only)
4040

41-
Rodio uses `cpal` library to send audio to the OS for playback. ALSA development files are needed to build `cpal` on Linux. These are provided as part of the `libasound2-dev` package on Debian and Ubuntu distributions and `alsa-lib-devel` on Fedora.
41+
Rodio uses `cpal` for audio playback and recording. The following development libraries are required on Linux:
42+
43+
- **ALSA** (`libasound2-dev` on Debian/Ubuntu, `alsa-lib-devel` on Fedora): always required as the base audio layer.
44+
- **PulseAudio** (`libpulse-dev` on Debian/Ubuntu, `pulseaudio-libs-devel` on Fedora): required when the `pulseaudio` feature is enabled, which it is by default.
4245

4346
### Minimal build
4447

src/lib.rs

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,31 +138,53 @@
138138
//! to avoid adding extra crates to your binary.
139139
//! See the [available feature flags](https://docs.rs/crate/rodio/latest/features) for all options.
140140
//!
141-
//! ## Optional Features
141+
//! ## Feature Flags
142142
//!
143-
//! Rodio provides several optional features that are guarded with feature gates.
143+
//! ### Core
144144
//!
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 |
146152
//!
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
149154
//!
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 |
151161
//!
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.
154166
//!
155-
//! ### Feature "playback"
167+
//! ### Audio generation
156168
//!
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` |
158173
//!
159-
//! ### Feature "64bit"
174+
//! ### Platform backends
160175
//!
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.
166188
//!
167189
//! ## How it works under the hood
168190
//!

0 commit comments

Comments
 (0)