comparison pytouhou/ui/music.py @ 324:c412df42aa15

Fix music looping
author Thibaut Girka <thib@sitedethib.com>
date Mon, 18 Jun 2012 21:16:40 +0200
parents 61adb5453e46
children cddfd3cb4797
comparison
equal deleted inserted replaced
323:2fcdb8966957 324:c412df42aa15
29 29
30 self._duration = None 30 self._duration = None
31 31
32 32
33 def _get_audio_data(self, bytes): 33 def _get_audio_data(self, bytes):
34 if bytes % self.audio_format.bytes_per_sample != 0: 34 bytes -= bytes % self.audio_format.bytes_per_sample
35 bytes -= bytes % self.audio_format.bytes_per_sample
36 35
36 data = b''
37 length = bytes 37 length = bytes
38 while True: 38 while True:
39 size = min(length, self._end - self._offset) 39 size = min(length, self._end - self._offset)
40 data = self._file.read(size) 40 data += self._file.read(size)
41 if size == length: 41 if size == length:
42 break 42 break
43 43
44 self._offset = self._start 44 self._offset = self._start
45 self._file.seek(self._offset + self._start_offset) 45 self._file.seek(self._offset + self._start_offset)