rodio/examples/reverb.rs

16 lines
485 B
Rust
Raw Normal View History

2017-02-01 10:05:24 +00:00
use rodio::Source;
use std::io::BufReader;
use std::time::Duration;
fn main() {
2020-02-25 10:09:17 +00:00
let (_stream, handle) = rodio::OutputStream::try_default().unwrap();
let sink = rodio::Sink::try_new(&handle).unwrap();
2017-02-01 10:05:24 +00:00
let file = std::fs::File::open("assets/music.ogg").unwrap();
2017-02-01 10:05:24 +00:00
let source = rodio::Decoder::new(BufReader::new(file)).unwrap();
let with_reverb = source.buffered().reverb(Duration::from_millis(40), 0.7);
sink.append(with_reverb);
sink.sleep_until_end();
}