[异步播报打断]:完成播放中麦克风监听和音色隔离,包含后台监听、助手回放抑制和用户音色打断测试

This commit is contained in:
mkbk
2026-06-18 16:19:30 +08:00
parent d83f5a19cb
commit 6153cd2826
16 changed files with 584 additions and 71 deletions
+15
View File
@@ -133,6 +133,21 @@ class TransportTests(unittest.TestCase):
self.assertGreater(len(fake.output_writes), 1)
self.assertEqual(callbacks[-1], result.duration_ms)
def test_sounddevice_chunk_playback_stops_on_signal(self) -> None:
fake = FakeSoundDevice()
transport = SoundDeviceAudioTransport(sounddevice_module=fake)
segment = AudioSegment(b"\x00\x00" * 1600, 16000, 1, 0, 100)
result = transport.play_pcm_chunks(
segment,
chunk_ms=20,
should_stop=lambda: len(fake.output_writes) >= 2,
)
self.assertTrue(result.played)
self.assertEqual(len(fake.output_writes), 2)
self.assertEqual(result.duration_ms, 40)
def test_sounddevice_device_report_uses_query_devices(self) -> None:
fake = FakeSoundDevice()
report = SoundDeviceAudioTransport(sounddevice_module=fake).device_report()