Skip to content

Commit c582378

Browse files
committed
bump rodio to 0.21.1
1 parent ab84bed commit c582378

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ categories = [ "game-development", "multimedia::audio" ]
1111
license = "MIT OR Apache-2.0"
1212

1313
[dependencies]
14-
rodio = "0.20.1"
14+
rodio = "0.21.1"

src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
use rodio::{
1616
source::{Buffered, Source},
17-
Decoder, OutputStream, OutputStreamHandle, Sink,
17+
Decoder, OutputStream, OutputStreamBuilder, Sink,
1818
};
1919
use std::collections::HashMap;
2020
use std::io::{Cursor, Read};
@@ -31,19 +31,18 @@ pub struct Audio {
3131
clips: HashMap<String, Buffered<Decoder<Cursor<Vec<u8>>>>>,
3232
channels: Vec<Sink>,
3333
current_channel: usize,
34-
output: Option<(OutputStream, OutputStreamHandle)>,
34+
output: Option<OutputStream>,
3535
}
3636

3737
impl Audio {
3838
/// Create a new sound subsystem. You only need one of these -- you can use it to load and play
3939
/// any number of audio clips.
4040
pub fn new() -> Self {
41-
if let Ok(output) = OutputStream::try_default() {
41+
if let Ok(output) = OutputStreamBuilder::open_default_stream() {
4242
let clips = HashMap::new();
4343
let mut channels: Vec<Sink> = Vec::new();
44-
for i in 0..4 {
45-
let sink = Sink::try_new(&output.1)
46-
.unwrap_or_else(|_| panic!("Failed to create sound channel {}", i));
44+
for _ in 0..4 {
45+
let sink = Sink::connect_new(output.mixer());
4746
channels.push(sink);
4847
}
4948
Self {

0 commit comments

Comments
 (0)