Kill task when channel closed
This commit is contained in:
parent
85751864c0
commit
a5e8a554b5
@ -3,7 +3,7 @@ use std::{
|
|||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use async_channel::{Receiver, TryRecvError};
|
use async_channel::{Receiver, SendError, TryRecvError, TrySendError};
|
||||||
use bevy::{
|
use bevy::{
|
||||||
asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext},
|
asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext},
|
||||||
audio::Source,
|
audio::Source,
|
||||||
@ -77,8 +77,8 @@ impl MidiDecoder {
|
|||||||
while !sequencer.end_of_sequence() {
|
while !sequencer.end_of_sequence() {
|
||||||
sequencer.render(&mut left, &mut right);
|
sequencer.render(&mut left, &mut right);
|
||||||
for value in left.iter().interleave(right.iter()) {
|
for value in left.iter().interleave(right.iter()) {
|
||||||
if let Err(e) = tx.send(*value).await {
|
if let Err(_) = tx.send(*value).await {
|
||||||
error!("{e}");
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user