def readinto(self, buf):
with self.lock:
assert(len(buf) % self.frame_nbyte == 0)
nframe = len(buf) // self.frame_nbyte
# Note: This allows buf to be a buffer/memoryview object
# E.g., numpy.ndarray.data
buf_view = (ctypes.c_byte * len(buf)).from_buffer(buf)
# TODO: This returns PaInputOverflowed if input data were dropped
# by PortAudio since the last call (equivalent to dropping
# packets).
_check(_lib.Pa_ReadStream(self.stream, buf_view, nframe))
return buf
评论列表
文章目录