Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 136 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ noise = ["rand", "rand_distr"]
#
# Enable WebAssembly support for web browsers
wasm-bindgen = ["cpal/wasm-bindgen"]
# Use shared C++ stdlib on Android (reduces APK size, fixes linking issues)
cpal-shared-stdcxx = ["cpal/oboe-shared-stdcxx"]

# To decode an audio source with Rodio, you need to enable the appropriate features for *both* the
# demuxer and the decoder.
Expand Down Expand Up @@ -103,7 +101,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
cpal = { version = "0.16", optional = true }
cpal = { git = "https://github.com/RustAudio/cpal", rev = "a8269d3c993f7d375d4655b53d3437429d4f6bd8", optional = true }
dasp_sample = "0.11.0"
claxon = { version = "0.4.2", optional = true }
hound = { version = "3.5", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion examples/microphone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.prompt()?;

let input = MicrophoneBuilder::new()
.device(input)?
.device(input.into_inner())?
.default_config()?
.open_stream()?;

Expand Down
12 changes: 6 additions & 6 deletions src/microphone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
//!
//! // Use a specific device (e.g., the second one)
//! let mic = MicrophoneBuilder::new()
//! .device(inputs[1].clone())?
//! .device(inputs[1].clone().into_inner())?
//! .default_config()?
//! .open_stream()?;
//! # Ok(())
Expand Down Expand Up @@ -130,9 +130,10 @@ pub struct Input {
inner: cpal::Device,
}

impl From<Input> for cpal::Device {
fn from(val: Input) -> Self {
val.inner
impl Input {
/// Consumes the input and returns the inner device.
pub fn into_inner(self) -> cpal::Device {
self.inner
}
}

Expand Down Expand Up @@ -271,8 +272,7 @@ impl Microphone {
I64, i64;
U8, u8;
U16, u16;
// TODO: uncomment when https://github.com/RustAudio/cpal/pull/1011 is merged
// U24, cpal::U24;
U24, cpal::U24;
U32, u32;
U64, u64
)
Expand Down
2 changes: 1 addition & 1 deletion src/microphone/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where
/// ```no_run
/// # use rodio::microphone::{MicrophoneBuilder, available_inputs};
/// let input = available_inputs()?.remove(2);
/// let builder = MicrophoneBuilder::new().device(input)?;
/// let builder = MicrophoneBuilder::new().device(input.into_inner())?;
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
pub fn device(
Expand Down
3 changes: 1 addition & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ impl OutputStream {
I64, i64;
U8, u8;
U16, u16;
// TODO: uncomment when https://github.com/RustAudio/cpal/pull/1011 is merged
// U24, U24;
U24, cpal::U24;
U32, u32;
U64, u64
);
Expand Down