aboutsummaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-26 21:29:40 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-26 21:29:40 +0200
commit62bce32f6174f6a38f09b7203c0b72a6a174c51e (patch)
treee093944bad3fcf703e6fc371e0eea86dcd0ed416 /helpers
parente4917bcc6c5355a82f05880a389d0a1fd868561d (diff)
downloadMusicSampler-62bce32f6174f6a38f09b7203c0b72a6a174c51e.tar.gz
MusicSampler-62bce32f6174f6a38f09b7203c0b72a6a174c51e.tar.zst
MusicSampler-62bce32f6174f6a38f09b7203c0b72a6a174c51e.zip
Add cleanup when stopping music
Diffstat (limited to 'helpers')
-rw-r--r--helpers/music_file.py4
1 files changed, 4 insertions, 0 deletions
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:
115 debug_print("Loaded « {} »".format(self.name)) 115 debug_print("Loaded « {} »".format(self.name))
116 116
117 def on_enter_loaded(self): 117 def on_enter_loaded(self):
118 self.cleanup()
119
120 def cleanup(self):
118 self.gain_effects = [] 121 self.gain_effects = []
119 self.set_gain(0, absolute=True) 122 self.set_gain(0, absolute=True)
120 self.current_audio_segment = None 123 self.current_audio_segment = None
@@ -136,6 +139,7 @@ class MusicFile:
136 def trigger_stopped_events(self): 139 def trigger_stopped_events(self):
137 self.mixer.remove_file(self) 140 self.mixer.remove_file(self)
138 self.wait_event.set() 141 self.wait_event.set()
142 self.cleanup()
139 143
140 # Actions and properties called externally 144 # Actions and properties called externally
141 @property 145 @property