From: Ismaël Bouya Date: Tue, 26 Jul 2016 19:29:40 +0000 (+0200) Subject: Add cleanup when stopping music X-Git-Tag: 1.0.0~22 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git;a=commitdiff_plain;h=62bce32f6174f6a38f09b7203c0b72a6a174c51e Add cleanup when stopping music --- diff --git a/helpers/music_file.py b/helpers/music_file.py index a972bc5..9976306 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py @@ -115,6 +115,9 @@ class MusicFile: debug_print("Loaded « {} »".format(self.name)) def on_enter_loaded(self): + self.cleanup() + + def cleanup(self): self.gain_effects = [] self.set_gain(0, absolute=True) self.current_audio_segment = None @@ -136,6 +139,7 @@ class MusicFile: def trigger_stopped_events(self): self.mixer.remove_file(self) self.wait_event.set() + self.cleanup() # Actions and properties called externally @property