Fixed some errors with my dectalk protocol implementation. Thanks Codex. :)
This commit is contained in:
@@ -23,7 +23,7 @@ class driver(hardware_serial_driver):
|
||||
return self._setting_command("dv ap", self._scale(pitch, 50, 350))
|
||||
|
||||
def _volume_command(self, volume):
|
||||
return self._setting_command("vo", self._scale(volume, 0, 100))
|
||||
return self._setting_command("dv g5", self._scale(volume, 60, 86))
|
||||
|
||||
def _setting_command(self, command, value):
|
||||
return f"[:{command} {value}]".encode("ascii")
|
||||
|
||||
@@ -141,7 +141,7 @@ def test_dectalk_usb_driver_writes_commands_and_speech(monkeypatch):
|
||||
assert device.writes == [
|
||||
(0x02, b"[:ra 650]", 1000),
|
||||
(0x02, b"[:dv ap 350]", 1000),
|
||||
(0x02, b"[:vo 50]", 1000),
|
||||
(0x02, b"[:dv g5 73]", 1000),
|
||||
(0x02, b"Hello world\x0b", 1000),
|
||||
]
|
||||
finally:
|
||||
|
||||
@@ -77,7 +77,7 @@ def test_dectalk_driver_writes_settings_and_cancel(serial_pair):
|
||||
speech_driver.set_pitch(1.0)
|
||||
speech_driver.set_volume(0.5)
|
||||
speech_driver.cancel()
|
||||
expected = b"[:ra 650][:dv ap 350][:vo 50]\x03"
|
||||
expected = b"[:ra 650][:dv ap 350][:dv g5 73]\x03"
|
||||
assert read_available(master_fd, len(expected)) == expected
|
||||
finally:
|
||||
speech_driver.shutdown()
|
||||
|
||||
Reference in New Issue
Block a user