fix(main): do not drop output stream

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-08-18 22:39:55 -05:00
parent b10bc7b4fd
commit 9fa40f8584
1 changed files with 2 additions and 1 deletions

View File

@ -64,10 +64,11 @@ fn main() -> Result<()> {
};
// Initialize Audio
let (_stream, stream_handle) = OutputStream::try_default().expect("Initialized Audio");
if AUDIO_ENABLED {
let spsc: AudioSPSC<f32> = Default::default();
let (prod, cons) = spsc.init();
let (_stream, stream_handle) = OutputStream::try_default().expect("Initialized Audio");
let sink = Sink::try_new(&stream_handle)?;
sink.append(cons);
game_boy.apu_mut().attach_producer(prod);