diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-17 16:32:03 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-17 16:37:43 +0200 |
commit | c80ff6dc4579ab28c4064576db5a4859e639c504 (patch) | |
tree | 50d9e2cf294dc12eb7c79f075d30ea96755e76f5 /helpers | |
parent | 176642649ad18f056675f7d89ea84482084234bc (diff) | |
download | MusicSampler-c80ff6dc4579ab28c4064576db5a4859e639c504.tar.gz MusicSampler-c80ff6dc4579ab28c4064576db5a4859e639c504.tar.zst MusicSampler-c80ff6dc4579ab28c4064576db5a4859e639c504.zip |
Small fixes
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/action.py | 14 | ||||
-rw-r--r-- | helpers/music_file.py | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/helpers/action.py b/helpers/action.py index 792b123..1b8fc5f 100644 --- a/helpers/action.py +++ b/helpers/action.py | |||
@@ -42,17 +42,17 @@ class Action: | |||
42 | if getattr(self, self.action + "_interrupt", None): | 42 | if getattr(self, self.action + "_interrupt", None): |
43 | return getattr(self, self.action + "_interrupt")(**self.arguments) | 43 | return getattr(self, self.action + "_interrupt")(**self.arguments) |
44 | 44 | ||
45 | # Actions | ||
46 | def command(self, command = "", **kwargs): | ||
47 | # FIXME: todo | ||
48 | pass | ||
49 | |||
50 | def music_list(self, music): | 45 | def music_list(self, music): |
51 | if music is not None: | 46 | if music is not None: |
52 | return [music] | 47 | return [music] |
53 | else: | 48 | else: |
54 | return self.mapping.open_files.values() | 49 | return self.mapping.open_files.values() |
55 | 50 | ||
51 | # Actions | ||
52 | def command(self, command = "", **kwargs): | ||
53 | # FIXME: todo | ||
54 | pass | ||
55 | |||
56 | def pause(self, music = None, **kwargs): | 56 | def pause(self, music = None, **kwargs): |
57 | for music in self.music_list(music): | 57 | for music in self.music_list(music): |
58 | if music.is_loaded_playing(): | 58 | if music.is_loaded_playing(): |
@@ -67,7 +67,7 @@ class Action: | |||
67 | restart_if_running = False, volume = 100, | 67 | restart_if_running = False, volume = 100, |
68 | loop = 0, | 68 | loop = 0, |
69 | **kwargs): | 69 | **kwargs): |
70 | if music is not None: | 70 | for music in self.music_list(music): |
71 | if restart_if_running: | 71 | if restart_if_running: |
72 | if music.is_not_stopped(): | 72 | if music.is_not_stopped(): |
73 | music.stop() | 73 | music.stop() |
@@ -131,7 +131,7 @@ class Action: | |||
131 | if music is not None: | 131 | if music is not None: |
132 | message += "« {} »".format(music.name) | 132 | message += "« {} »".format(music.name) |
133 | else: | 133 | else: |
134 | message += "music" | 134 | message += "all musics" |
135 | 135 | ||
136 | if start_at != 0: | 136 | if start_at != 0: |
137 | message += " at {}s".format(start_at) | 137 | message += " at {}s".format(start_at) |
diff --git a/helpers/music_file.py b/helpers/music_file.py index 5baab7e..7e5f978 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py | |||
@@ -177,8 +177,6 @@ class MusicFile(Machine): | |||
177 | ms = int(self.sound_position * 1000) | 177 | ms = int(self.sound_position * 1000) |
178 | ms_fo = max(1, int(fade_out * 1000)) | 178 | ms_fo = max(1, int(fade_out * 1000)) |
179 | 179 | ||
180 | # FIXME: stop fade_out puis seek -5 -> on abandonne le fade ? (cf | ||
181 | # commentaire dans fonction seek | ||
182 | new_audio_segment = self.current_audio_segment[:ms + ms_fo].fade_out(ms_fo) | 180 | new_audio_segment = self.current_audio_segment[:ms + ms_fo].fade_out(ms_fo) |
183 | with self.music_lock: | 181 | with self.music_lock: |
184 | self.current_audio_segment = new_audio_segment | 182 | self.current_audio_segment = new_audio_segment |