diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2015-06-21 12:13:00 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2015-07-01 15:33:11 +0200 |
| commit | 4c16c864062dacf03914f3b87cdbc91f70cd7337 (patch) | |
| tree | d7ff6757de55d216b6fd9e4e25a0aa73c9ad9d00 | |
| parent | 0be83204bd91cd42a99d9647fb097aaa8623629b (diff) | |
Return callback status from wait()
| -rw-r--r-- | sounddevice.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sounddevice.py b/sounddevice.py index c3c6990..700e628 100644 --- a/sounddevice.py +++ b/sounddevice.py @@ -282,7 +282,9 @@ def play(data, samplerate=None, mapping=None, blocking=False, **kwargs): ctx.callback_exit() ctx.start_stream(OutputStream, samplerate, ctx.output_channels, - ctx.output_dtype, callback, blocking, **kwargs) + ctx.output_dtype, callback, blocking, + prime_output_buffers_using_stream_callback=False, + **kwargs) def rec(frames=None, samplerate=None, channels=None, dtype=None, @@ -432,10 +434,16 @@ def wait(): Playback/recording can be stopped with a :class:`KeyboardInterrupt`. + Returns + ------- + CallbackFlags or None + If at least one buffer over-/underrun happened during the last + playback/recording, a :class:`CallbackFlags` object is returned. + """ global _last_callback if _last_callback: - _last_callback.wait() + return _last_callback.wait() def stop(ignore_errors=True): @@ -2207,6 +2215,7 @@ class _CallbackContext(object): self.event.wait() finally: self.stream.close() + return self.status if self.status else None def _check_mapping(mapping, channels): |
