From 9fa40f858473579fc92323ad754aeb8dfb702c8d Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Wed, 18 Aug 2021 22:39:55 -0500 Subject: [PATCH] fix(main): do not drop output stream --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 360a589..4a32bc0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 = 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);