diff options
Diffstat (limited to 'helpers/music_file.py')
-rw-r--r-- | helpers/music_file.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/helpers/music_file.py b/helpers/music_file.py index b926c64..32869b6 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py | |||
@@ -129,6 +129,13 @@ class MusicFile(Machine): | |||
129 | 129 | ||
130 | out_data[:] = audio_segment.ljust(len(out_data), b'\0') | 130 | out_data[:] = audio_segment.ljust(len(out_data), b'\0') |
131 | 131 | ||
132 | def seek(self, value = 0, delta = False): | ||
133 | # We don't want to do that while stopping | ||
134 | if not (self.is_loaded_playing() or self.is_loaded_paused()): | ||
135 | return | ||
136 | with self.music_lock: | ||
137 | self.current_frame = max(0, int(delta) * self.current_frame + int(value * self.audio_segment.frame_rate)) | ||
138 | |||
132 | def stop(self, fade_out = 0, wait = False): | 139 | def stop(self, fade_out = 0, wait = False): |
133 | if self.is_loaded_playing(): | 140 | if self.is_loaded_playing(): |
134 | ms = int(self.sound_position * 1000) | 141 | ms = int(self.sound_position * 1000) |