fix: audio in verify_sync

This commit is contained in:
Honney OC committed 2026-09-14 01:12:39 +00:00
1 parent 26cc2883d9
commit 02df187139
1 file changed
+3 -1
+3 -1
View File
@@ -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