From: Ismaƫl Bouya Date: Thu, 21 Jul 2016 21:25:09 +0000 (+0200) Subject: Fix master volume fade X-Git-Tag: 1.0.0~32 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=513226699e5cb5776bd71ee6bb2ada87a43c4dee;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git Fix master volume fade --- diff --git a/helpers/action.py b/helpers/action.py index 247e0a9..eaa419b 100644 --- a/helpers/action.py +++ b/helpers/action.py @@ -95,6 +95,8 @@ class Action: if previous is not None: previous.stop(fade_out=fade_out) previous = music + else: + music.stop(fade_out=fade_out) if previous is not None: previous.stop(fade_out=fade_out, wait=wait) diff --git a/helpers/mapping.py b/helpers/mapping.py index 3622f9d..43cacf2 100644 --- a/helpers/mapping.py +++ b/helpers/mapping.py @@ -39,6 +39,9 @@ class Mapping(RelativeLayout): self.master_volume) for music in self.open_files.values(): + if not (music.is_loaded_playing() or music.is_loaded_paused()): + continue + if fade > 0: music.gain_effects.append(GainEffect( "fade", diff --git a/helpers/music_file.py b/helpers/music_file.py index aef0adc..b26a1be 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py @@ -70,7 +70,8 @@ class MusicFile(Machine): ] Machine.__init__(self, states=states, - transitions=transitions, initial='initial') + transitions=transitions, initial='initial', + ignore_invalid_triggers=True) self.volume = 100 self.mapping = mapping