diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-20 22:51:59 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-20 22:51:59 +0200 |
commit | 0cb786e3c003745a3bde2b7f6ab06871147ce6f4 (patch) | |
tree | 1cb0ee6b259a742a050f1fbb77c6835e6f81f5aa /helpers | |
parent | 1e44fe7e6c1464b49582a163615e8cb3ed279d3e (diff) | |
download | MusicSampler-0cb786e3c003745a3bde2b7f6ab06871147ce6f4.tar.gz MusicSampler-0cb786e3c003745a3bde2b7f6ab06871147ce6f4.tar.zst MusicSampler-0cb786e3c003745a3bde2b7f6ab06871147ce6f4.zip |
Change loop process
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/music_file.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/helpers/music_file.py b/helpers/music_file.py index a37a708..cff897a 100644 --- a/helpers/music_file.py +++ b/helpers/music_file.py | |||
@@ -128,7 +128,10 @@ class MusicFile(Machine): | |||
128 | self.set_gain(gain(volume) + self.mapping.master_gain, absolute=True) | 128 | self.set_gain(gain(volume) + self.mapping.master_gain, absolute=True) |
129 | self.volume = volume | 129 | self.volume = volume |
130 | self.current_loop = 0 | 130 | self.current_loop = 0 |
131 | self.loop_left = loop | 131 | if loop < 0: |
132 | self.last_loop = float('inf') | ||
133 | else: | ||
134 | self.last_loop = loop | ||
132 | 135 | ||
133 | with self.music_lock: | 136 | with self.music_lock: |
134 | self.current_audio_segment = self.audio_segment | 137 | self.current_audio_segment = self.audio_segment |
@@ -166,8 +169,8 @@ class MusicFile(Machine): | |||
166 | with self.music_lock: | 169 | with self.music_lock: |
167 | [data, nb_frames] = self.get_next_sample(frame_count) | 170 | [data, nb_frames] = self.get_next_sample(frame_count) |
168 | if nb_frames < frame_count: | 171 | if nb_frames < frame_count: |
169 | if self.is_loaded_playing() and self.loop_left != 0: | 172 | if self.is_loaded_playing() and\ |
170 | self.loop_left -= 1 | 173 | self.current_loop < self.last_loop: |
171 | self.current_loop += 1 | 174 | self.current_loop += 1 |
172 | self.current_frame = 0 | 175 | self.current_frame = 0 |
173 | [new_data, new_nb_frames] = self.get_next_sample( | 176 | [new_data, new_nb_frames] = self.get_next_sample( |