Skip to content

Commit 6a8fe13

Browse files
committed
Minor cosmetic change in error handling
1 parent 4babf25 commit 6a8fe13

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

sounddevice.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -993,9 +993,8 @@ def start(self):
993993
994994
"""
995995
err = _lib.Pa_StartStream(self._ptr)
996-
if err == _lib.paStreamIsNotStopped:
997-
return
998-
_check(err, "Error starting stream")
996+
if err != _lib.paStreamIsNotStopped:
997+
_check(err, "Error starting stream")
999998

1000999
def stop(self):
10011000
"""Terminate audio processing.
@@ -1009,9 +1008,8 @@ def stop(self):
10091008
10101009
"""
10111010
err = _lib.Pa_StopStream(self._ptr)
1012-
if err == _lib.paStreamIsStopped:
1013-
return
1014-
_check(err, "Error stopping stream")
1011+
if err != _lib.paStreamIsStopped:
1012+
_check(err, "Error stopping stream")
10151013

10161014
def abort(self):
10171015
"""Terminate audio processing immediately.
@@ -1024,9 +1022,8 @@ def abort(self):
10241022
10251023
"""
10261024
err = _lib.Pa_AbortStream(self._ptr)
1027-
if err == _lib.paStreamIsStopped:
1028-
return
1029-
_check(err, "Error aborting stream")
1025+
if err != _lib.paStreamIsStopped:
1026+
_check(err, "Error aborting stream")
10301027

10311028
def close(self, ignore_errors=True):
10321029
"""Close the stream.

0 commit comments

Comments
 (0)