mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
Catch self.sd.PortAudioError gracefully #849
This commit is contained in:
parent
88749a8acb
commit
c598cdd576
1 changed files with 6 additions and 2 deletions
|
@ -85,8 +85,12 @@ class Voice:
|
|||
|
||||
self.start_time = time.time()
|
||||
|
||||
with self.sd.InputStream(samplerate=sample_rate, channels=1, callback=self.callback):
|
||||
prompt(self.get_prompt, refresh_interval=0.1)
|
||||
try:
|
||||
with self.sd.InputStream(samplerate=sample_rate, channels=1, callback=self.callback):
|
||||
prompt(self.get_prompt, refresh_interval=0.1)
|
||||
except self.sd.PortAudioError as err:
|
||||
print(err)
|
||||
return
|
||||
|
||||
with sf.SoundFile(filename, mode="x", samplerate=sample_rate, channels=1) as file:
|
||||
while not self.q.empty():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue