Remove StreamEvent in favour of StreamDataResult

This commit is contained in:
mitchmindtree 2019-06-24 20:43:27 +02:00
parent 26f7e99e9b
commit c05d2916b1
9 changed files with 47 additions and 98 deletions

View file

@ -17,14 +17,13 @@ fn main() -> Result<(), failure::Error> {
(sample_clock * 440.0 * 2.0 * 3.141592 / sample_rate).sin()
};
event_loop.run(move |id, event| {
let data = match event {
cpal::StreamEvent::Data(data) => data,
cpal::StreamEvent::Close(cpal::StreamCloseCause::Error(err)) => {
event_loop.run(move |id, result| {
let data = match result {
Ok(data) => data,
Err(err) => {
eprintln!("stream {:?} closed due to an error: {}", id, err);
return;
}
_ => return,
};
match data {