mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
leave iodevice alone after calling .stop()
Docs say it should not be accessed, and it fails on Linux.
This commit is contained in:
parent
dc5ce3b9a2
commit
93eccd183f
1 changed files with 2 additions and 4 deletions
|
@ -604,16 +604,14 @@ class QtAudioInputRecorder(Recorder):
|
|||
self._buffer += self._iodevice.readAll()
|
||||
|
||||
def stop(self, on_done: Callable[[str], None]):
|
||||
# read anything remaining in buffer & stop
|
||||
self._on_read_ready()
|
||||
self._audio_input.stop()
|
||||
|
||||
if err := self._audio_input.error():
|
||||
showWarning(f"recording failed: {err}")
|
||||
return
|
||||
|
||||
# read anything remaining in buffer & close
|
||||
self._on_read_ready()
|
||||
self._iodevice.close()
|
||||
|
||||
# swallow the first 300ms to allow audio device to quiesce
|
||||
wait = int(44100 * self.STARTUP_DELAY)
|
||||
if len(self._buffer) <= wait:
|
||||
|
|
Loading…
Reference in a new issue