Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
User-supplied function to consume audio data in response to
requests from an active stream.
The callback must have this signature::
callback(indata: buffer, frames: int,
time: CData, status: CallbackFlags) -> None
The arguments are the same as in the *callback* parameter of
`RawStream`, except that *outdata* is missing.
See Also
--------
RawStream, Stream
"""
_StreamBase.__init__(self, kind='input', wrap_callback='buffer',
**_remove_self(locals()))
def __init__(self, kind, qsize=16, **kwargs):
callback = _ffi.addressof(_lib, 'callback')
self._action_q = RingBuffer(_ffi.sizeof('struct action*'), qsize)
self._result_q = RingBuffer(_ffi.sizeof('struct action*'), qsize)
self._state = _ffi.new('struct state*', dict(
input_channels=0,
output_channels=0,
samplerate=0,
action_q=self._action_q._ptr,
result_q=self._result_q._ptr,
actions=_ffi.NULL,
))
_sd._StreamBase.__init__(
self, kind=kind, dtype='float32',
callback=callback, userdata=self._state, **kwargs)
self._state.samplerate = self.samplerate
self._actions = set()
self._temp_action_ptr = _ffi.new('struct action**')
User-supplied function to generate audio data in response to
requests from an active stream.
The callback must have this signature::
callback(outdata: buffer, frames: int,
time: CData, status: CallbackFlags) -> None
The arguments are the same as in the *callback* parameter of
`RawStream`, except that *indata* is missing.
See Also
--------
RawStream, Stream
"""
_StreamBase.__init__(self, kind='output', wrap_callback='buffer',
**_remove_self(locals()))
data in response to requests from an active stream.
The callback must have this signature::
callback(indata: buffer, outdata: buffer, frames: int,
time: CData, status: CallbackFlags) -> None
The arguments are the same as in the *callback* parameter of
`Stream`, except that *indata* and *outdata* are plain
Python buffer objects instead of NumPy arrays.
See Also
--------
RawInputStream, RawOutputStream, Stream
"""
_StreamBase.__init__(self, kind='duplex', wrap_callback='buffer',
**_remove_self(locals()))
sample data has been played. The callback must have this
signature::
finished_callback() -> None
clip_off : bool, optional
See `default.clip_off`.
dither_off : bool, optional
See `default.dither_off`.
never_drop_input : bool, optional
See `default.never_drop_input`.
prime_output_buffers_using_stream_callback : bool, optional
See `default.prime_output_buffers_using_stream_callback`.
"""
_StreamBase.__init__(self, kind='duplex', wrap_callback='array',
**_remove_self(locals()))
User-supplied function to generate audio data in response to
requests from an active stream.
The callback must have this signature::
callback(outdata: numpy.ndarray, frames: int,
time: CData, status: CallbackFlags) -> None
The arguments are the same as in the *callback* parameter of
`Stream`, except that *indata* is missing.
See Also
--------
Stream, RawOutputStream
"""
_StreamBase.__init__(self, kind='output', wrap_callback='array',
**_remove_self(locals()))
User-supplied function to consume audio in response to
requests from an active stream.
The callback must have this signature::
callback(indata: numpy.ndarray, frames: int,
time: CData, status: CallbackFlags) -> None
The arguments are the same as in the *callback* parameter of
`Stream`, except that *outdata* is missing.
See Also
--------
Stream, RawInputStream
"""
_StreamBase.__init__(self, kind='input', wrap_callback='array',
**_remove_self(locals()))