Skip to content

Commit 57b2f0c

Browse files
committed
chore: update cpal to latest Git, replace From<Input> for cpal::Device with into_inner
1 parent d89514d commit 57b2f0c

File tree

5 files changed

+133
-24
lines changed

5 files changed

+133
-24
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ all-features = true
103103
rustdoc-args = ["--cfg", "docsrs"]
104104

105105
[dependencies]
106-
cpal = { version = "0.16", optional = true }
106+
cpal = { git = "https://github.com/RustAudio/cpal", rev = "c9d8e2e18789e305e2d087d65888f06db08bd2ba", optional = true }
107107
dasp_sample = "0.11.0"
108108
claxon = { version = "0.4.2", optional = true }
109109
hound = { version = "3.5", optional = true }

examples/microphone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() -> Result<(), Box<dyn Error>> {
1313
.prompt()?;
1414

1515
let input = MicrophoneBuilder::new()
16-
.device(input)?
16+
.device(input.into_inner())?
1717
.default_config()?
1818
.open_stream()?;
1919

src/microphone.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
//!
9292
//! // Use a specific device (e.g., the second one)
9393
//! let mic = MicrophoneBuilder::new()
94-
//! .device(inputs[1].clone())?
94+
//! .device(inputs[1].clone().into_inner())?
9595
//! .default_config()?
9696
//! .open_stream()?;
9797
//! # Ok(())
@@ -130,9 +130,10 @@ pub struct Input {
130130
inner: cpal::Device,
131131
}
132132

133-
impl From<Input> for cpal::Device {
134-
fn from(val: Input) -> Self {
135-
val.inner
133+
impl Input {
134+
/// Consumes the input and returns the inner device.
135+
pub fn into_inner(self) -> cpal::Device {
136+
self.inner
136137
}
137138
}
138139

src/microphone/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ where
128128
/// ```no_run
129129
/// # use rodio::microphone::{MicrophoneBuilder, available_inputs};
130130
/// let input = available_inputs()?.remove(2);
131-
/// let builder = MicrophoneBuilder::new().device(input)?;
131+
/// let builder = MicrophoneBuilder::new().device(input.into_inner())?;
132132
/// # Ok::<(), Box<dyn std::error::Error>>(())
133133
/// ```
134134
pub fn device(

0 commit comments

Comments
 (0)