Skip to content

Commit

Permalink
Rename cpal feature to playback
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrGlad committed Dec 29, 2024
1 parent 40fa1a6 commit c30421e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ atomic_float = { version = "1.1.0", optional = true }
num-rational = "0.4.2"

[features]
default = ["flac", "vorbis", "wav", "mp3", "cpal"]
default = ["playback", "flac", "vorbis", "wav", "mp3"]
tracing = ["dep:tracing"]
experimental = ["dep:atomic_float"]
cpal = ["dep:cpal"]
playback = ["dep:cpal"]

flac = ["claxon"]
vorbis = ["lewton"]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ See [the docs](https://docs.rs/rodio/latest/rodio/#alternative-decoder-backends)

[The documentation](http://docs.rs/rodio) contains an introduction to the library.

## Dependencies(Linux only)
## Dependencies (Linux only)

Rodio uses `cpal` to send audio to the OS for playback. On Linux `cpal` needs the ALSA development files. These are provided as part of the `libasound2-dev` package on Debian and Ubuntu distributions and `alsa-lib-devel` on Fedora.
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.

### Minimal build

It is possible to build `rodio` without support for audio output. In this configuration `cpal` dependency and its requirements are excluded. This configuration may be useful, for example, for decoding and processing audio in environments when the audio output is not available (e.g. in case of Linux, when ALSA is not available). See `into_file` example that works with this build.
It is possible to build `rodio` without support for audio playback. In this configuration `cpal` dependency and its requirements are excluded. This configuration may be useful, for example, for decoding and processing audio in environments when the audio output is not available (e.g. in case of Linux, when ALSA is not available). See `into_file` example that works with this build.

In order to use `rodio` in this configuration disable default features and add the necessary ones. In this case the `Cargo.toml` dependency would look like:
```toml
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
//! down your program).
#![cfg_attr(test, deny(missing_docs))]
#[cfg(feature = "cpal")]
#[cfg(feature = "playback")]
pub use cpal::{
self, traits::DeviceTrait, Device, Devices, DevicesError, InputDevices, OutputDevices,
SupportedStreamConfig,
Expand All @@ -160,7 +160,7 @@ mod common;
mod conversions;
mod sink;
mod spatial_sink;
#[cfg(feature = "cpal")]
#[cfg(feature = "playback")]
mod stream;
#[cfg(feature = "wav")]
mod wav_output;
Expand All @@ -178,7 +178,7 @@ pub use crate::decoder::Decoder;
pub use crate::sink::Sink;
pub use crate::source::Source;
pub use crate::spatial_sink::SpatialSink;
#[cfg(feature = "cpal")]
#[cfg(feature = "playback")]
pub use crate::stream::{play, OutputStream, OutputStreamBuilder, PlayError, StreamError};
#[cfg(feature = "wav")]
pub use crate::wav_output::output_to_wav;

0 comments on commit c30421e

Please sign in to comment.