From 2b0347743653fb7151b60d057e7a3b5700628e95 Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com> Date: Sat, 19 Oct 2024 15:24:56 +0800 Subject: [PATCH] Fix small bug in the TUI library Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com> --- plastic_tui/src/ui.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plastic_tui/src/ui.rs b/plastic_tui/src/ui.rs index 45ee28a..37a3b2e 100644 --- a/plastic_tui/src/ui.rs +++ b/plastic_tui/src/ui.rs @@ -253,8 +253,10 @@ impl Ui { self.nes.clock_for_frame(); self.display(&mut terminal, &fps); + // take the buffer in all cases, otherwise the audio will keep accumulating in memory + let audio_buffer = self.nes.audio_buffer(); if let Some(ref mut player) = self.audio_player { - let audio_buffer = process_audio(&self.nes.audio_buffer(), 1.0); + let audio_buffer = process_audio(&audio_buffer, 1.0); player.queue(&audio_buffer); }