fix: audio in verify_sync
This commit is contained in:
1 parent
b72616fb7f
commit
ccceacdbe4
1 file changed
+3
-1
+3
-1
@@ -140,6 +140,7 @@ def apply_dark_theme(app: QtWidgets.QApplication):
|
||||
class AudioPlayer:
|
||||
def __init__(self):
|
||||
self.playing = False
|
||||
self._stream = None
|
||||
self._lock = threading.Lock()
|
||||
|
||||
def play(self, data: np.ndarray, sr: int):
|
||||
@@ -149,7 +150,7 @@ class AudioPlayer:
|
||||
sd.stop()
|
||||
self.playing = True
|
||||
try:
|
||||
sd.play(data, samplerate=sr, blocking=False)
|
||||
self._stream = sd.play(data, samplerate=sr, blocking=False)
|
||||
except Exception as e:
|
||||
print(f"audio play error: {e}", file=sys.stderr)
|
||||
self.playing = False
|
||||
@@ -158,6 +159,7 @@ class AudioPlayer:
|
||||
if HAS_SD:
|
||||
with self._lock:
|
||||
sd.stop()
|
||||
self._stream = None
|
||||
self.playing = False
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user