@@ -563,7 +563,7 @@ def callback(indata, outdata, frames, time, status):
563563 return ctx .out
564564
565565
566- def wait ():
566+ def wait (ignore_errors = True ):
567567 """Wait for `play()`/`rec()`/`playrec()` to be finished.
568568
569569 Playback/recording can be stopped with a `KeyboardInterrupt`.
@@ -580,7 +580,7 @@ def wait():
580580
581581 """
582582 if _last_callback :
583- return _last_callback .wait ()
583+ return _last_callback .wait (ignore_errors )
584584
585585
586586def stop (ignore_errors = True ):
@@ -1246,7 +1246,7 @@ def start(self):
12461246 if err != _lib .paStreamIsNotStopped :
12471247 _check (err , 'Error starting stream' )
12481248
1249- def stop (self ):
1249+ def stop (self , ignore_errors = True ):
12501250 """Terminate audio processing.
12511251
12521252 This waits until all pending audio buffers have been played
@@ -1258,10 +1258,10 @@ def stop(self):
12581258
12591259 """
12601260 err = _lib .Pa_StopStream (self ._ptr )
1261- if err != _lib . paStreamIsStopped :
1261+ if not ignore_errors :
12621262 _check (err , 'Error stopping stream' )
12631263
1264- def abort (self ):
1264+ def abort (self , ignore_errors = True ):
12651265 """Terminate audio processing immediately.
12661266
12671267 This does not wait for pending buffers to complete.
@@ -1272,7 +1272,7 @@ def abort(self):
12721272
12731273 """
12741274 err = _lib .Pa_AbortStream (self ._ptr )
1275- if err != _lib . paStreamIsStopped :
1275+ if not ignore_errors :
12761276 _check (err , 'Error aborting stream' )
12771277
12781278 def close (self , ignore_errors = True ):
@@ -2675,7 +2675,7 @@ def start_stream(self, StreamClass, samplerate, channels, dtype, callback,
26752675 if blocking :
26762676 self .wait ()
26772677
2678- def wait (self ):
2678+ def wait (self , ignore_errors = True ):
26792679 """Wait for finished_callback.
26802680
26812681 Can be interrupted with a KeyboardInterrupt.
@@ -2684,7 +2684,7 @@ def wait(self):
26842684 try :
26852685 self .event .wait ()
26862686 finally :
2687- self .stream .close ()
2687+ self .stream .close (ignore_errors )
26882688 return self .status if self .status else None
26892689
26902690
0 commit comments