From c30421e456fd221fcfbddf78d79b3deea1e995fc Mon Sep 17 00:00:00 2001 From: Petr Gladkikh Date: Sun, 29 Dec 2024 22:51:00 +0400 Subject: [PATCH] Rename `cpal` feature to `playback` --- Cargo.toml | 4 ++-- README.md | 6 +++--- src/lib.rs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3c4906fb..296ea901 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/README.md b/README.md index cf32e74a..c2e5c914 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/lib.rs b/src/lib.rs index 199361d1..4d17d3b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, @@ -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; @@ -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;