]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Add cleanup when stopping music
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 26 Jul 2016 19:29:40 +0000 (21:29 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 26 Jul 2016 19:29:40 +0000 (21:29 +0200)
helpers/music_file.py

index a972bc5bc965b9a59634897587e807640d24725b..9976306bcd254436f4dc030c5c51408de377b0ae 100644 (file)
@@ -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