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
142 changes: 125 additions & 17 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
cpal = { version = "0.16", optional = true }
cpal = { git = "https://github.com/RustAudio/cpal", rev = "c9d8e2e18789e305e2d087d65888f06db08bd2ba", 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
9 changes: 5 additions & 4 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
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