[异步播报打断]:完成播放中麦克风监听和音色隔离,包含后台监听、助手回放抑制和用户音色打断测试
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user