From 570fb519ccd762b661fa770e6c8f9cfcb3964363 Mon Sep 17 00:00:00 2001 From: NoahDMoore <70867820+NoahDMoore@users.noreply.github.com> Date: Tue, 12 Aug 2025 01:44:49 -0500 Subject: [PATCH] Update audio.py Fix error in line 188 where comparison operator was used in place of an assignment operator. Add line at 201 to fix error with looping WAV files; looping failed because the total_bytes_read was never reset to 0. --- examples/galactic_unicorn/audio/audio.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/galactic_unicorn/audio/audio.py b/examples/galactic_unicorn/audio/audio.py index 10ce585..bc241b4 100644 --- a/examples/galactic_unicorn/audio/audio.py +++ b/examples/galactic_unicorn/audio/audio.py @@ -185,7 +185,7 @@ def __stop_i2s(self): if self.__audio_out is not None: self.__audio_out.deinit() # Deinit any active I2S comms - self.__state == WavPlayer.NONE # Return to the none state + self.__state = WavPlayer.NONE # Return to the none state def __i2s_callback(self, arg): # PLAY @@ -198,6 +198,7 @@ def __i2s_callback(self, arg): # Do we want to loop the WAV playback? if self.__loop_wav: _ = self.__wav_file.seek(self.__first_sample_offset) # Play again, so advance to first byte of sample data + self.total_bytes_read = 0 # Reset for looping else: self.__wav_file.close() # Stop playing, so close the file self.__state = WavPlayer.FLUSH # and enter the flush state on the next callback