extern crate rodio;
use std::io::BufReader;
fn main() {
let device = rodio::default_output_device().unwrap();
let sink = rodio::Sink::new(&device);
let file = std::fs::File::open("D:\\dev\\test\\xrust\\src\\1.wav").unwrap();
let decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
sink.append(decoder);
sink.sleep_until_end();
}
来源:oschina
链接:https://my.oschina.net/zhupengdaniu/blog/4263521