mirror of
https://github.com/RustAudio/rodio
synced 2025-01-19 06:53:53 +00:00
18 lines
546 B
Rust
18 lines
546 B
Rust
use rodio::Source;
|
|
use std::error::Error;
|
|
use std::io::BufReader;
|
|
use std::time::Duration;
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
let stream_handle = rodio::OutputStreamBuilder::try_default_stream()?;
|
|
let sink = rodio::Sink::connect_new(&stream_handle.mixer());
|
|
|
|
let file = std::fs::File::open("assets/music.ogg")?;
|
|
let source = rodio::Decoder::new(BufReader::new(file))?;
|
|
let with_reverb = source.buffered().reverb(Duration::from_millis(40), 0.7);
|
|
sink.append(with_reverb);
|
|
|
|
sink.sleep_until_end();
|
|
|
|
Ok(())
|
|
}
|