sync pyglet update

This commit is contained in:
shenjack 2023-06-23 00:21:59 +08:00
parent f1abeb430e
commit 43966ec573

View File

@ -135,17 +135,6 @@ class AudioData:
self.duration -= num_bytes / audio_format.bytes_per_second self.duration -= num_bytes / audio_format.bytes_per_second
self.timestamp += num_bytes / audio_format.bytes_per_second self.timestamp += num_bytes / audio_format.bytes_per_second
def get_string_data(self):
"""Return data as a bytestring.
Returns:
bytes: Data as a (byte)string.
"""
if self.data is None:
return b''
return memoryview(self.data).tobytes()[:self.length]
class SourceInfo: class SourceInfo:
"""Source metadata information. """Source metadata information.
@ -409,7 +398,7 @@ class StaticSource(Source):
audio_data = source.get_audio_data(buffer_size) audio_data = source.get_audio_data(buffer_size)
if not audio_data: if not audio_data:
break break
data.write(audio_data.get_string_data()) data.write(audio_data.data)
self._data = data.getvalue() self._data = data.getvalue()
self._duration = len(self._data) / self.audio_format.bytes_per_second self._duration = len(self._data) / self.audio_format.bytes_per_second