mirror of
https://github.com/RustAudio/rodio
synced 2025-01-07 09:18:44 +00:00
Update the examples to use the new API
This commit is contained in:
parent
c67362a999
commit
ddc5bec344
2 changed files with 5 additions and 3 deletions
|
@ -4,9 +4,10 @@ use std::io::BufReader;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let endpoint = rodio::get_default_endpoint().unwrap();
|
let endpoint = rodio::get_default_endpoint().unwrap();
|
||||||
|
let sink = rodio::Sink::new(&endpoint);
|
||||||
|
|
||||||
let file = std::fs::File::open("examples/music.ogg").unwrap();
|
let file = std::fs::File::open("examples/music.ogg").unwrap();
|
||||||
let _music = rodio::play_once(&endpoint, BufReader::new(file));
|
sink.append(rodio::Decoder::new(BufReader::new(file)));
|
||||||
|
|
||||||
std::thread::sleep_ms(60000);
|
std::thread::sleep_ms(60000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@ use std::io::BufReader;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let endpoint = rodio::get_default_endpoint().unwrap();
|
let endpoint = rodio::get_default_endpoint().unwrap();
|
||||||
|
let sink = rodio::Sink::new(&endpoint);
|
||||||
|
|
||||||
let file = std::fs::File::open("examples/music.wav").unwrap();
|
let file = std::fs::File::open("examples/music.wav").unwrap();
|
||||||
let music = rodio::play_once(&endpoint, BufReader::new(file));
|
sink.append(rodio::Decoder::new(BufReader::new(file)));
|
||||||
|
|
||||||
music.sleep_until_end();
|
sink.sleep_until_end();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue