mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Fix modem not starting
This commit is contained in:
parent
e95c9f1ff7
commit
92c4831761
1 changed files with 8 additions and 8 deletions
|
@ -125,7 +125,7 @@ def get_device_index_from_crc(crc, isInput: bool):
|
||||||
|
|
||||||
for i, dev in enumerate(detected_devices):
|
for i, dev in enumerate(detected_devices):
|
||||||
if dev['id'] == crc:
|
if dev['id'] == crc:
|
||||||
return (dev["native_index"], dev['name'])
|
return (dev['native_index'], dev['name'])
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning(f"Audio device {crc} not detected ", devices=detected_devices, isInput=isInput)
|
log.warning(f"Audio device {crc} not detected ", devices=detected_devices, isInput=isInput)
|
||||||
|
@ -134,10 +134,10 @@ def get_device_index_from_crc(crc, isInput: bool):
|
||||||
def test_audio_devices(input_id: str, output_id: str) -> list:
|
def test_audio_devices(input_id: str, output_id: str) -> list:
|
||||||
test_result = [False, False]
|
test_result = [False, False]
|
||||||
try:
|
try:
|
||||||
result = get_device_index_from_crc(output_id, True)
|
result = get_device_index_from_crc(input_id, True)
|
||||||
if result is None:
|
if result is None:
|
||||||
# in_dev_index, in_dev_name = None, None
|
# in_dev_index, in_dev_name = None, None
|
||||||
raise ValueError("Invalid input device index.")
|
raise ValueError(f"[Audio-Test] Invalid input device index {output_id}.")
|
||||||
else:
|
else:
|
||||||
in_dev_index, in_dev_name = result
|
in_dev_index, in_dev_name = result
|
||||||
sd.check_input_settings(
|
sd.check_input_settings(
|
||||||
|
@ -148,16 +148,16 @@ def test_audio_devices(input_id: str, output_id: str) -> list:
|
||||||
)
|
)
|
||||||
test_result[0] = True
|
test_result[0] = True
|
||||||
except (sd.PortAudioError, ValueError) as e:
|
except (sd.PortAudioError, ValueError) as e:
|
||||||
log.warning("Input device error:", e=e)
|
log.warning(f"[Audio-Test] Input device error ({input_id}) [{str(in_dev_index)}] [{in_dev_name}]:", e=e)
|
||||||
test_result[0] = False
|
test_result[0] = False
|
||||||
try:
|
try:
|
||||||
result = get_device_index_from_crc(input_id, False)
|
result = get_device_index_from_crc(output_id, False)
|
||||||
if result is None:
|
if result is None:
|
||||||
# out_dev_index, out_dev_name = None, None
|
# out_dev_index, out_dev_name = None, None
|
||||||
raise ValueError("Invalid output device index.")
|
raise ValueError(f"[Audio-Test] Invalid output device index {output_id}.")
|
||||||
else:
|
else:
|
||||||
out_dev_index, out_dev_name = result
|
out_dev_index, out_dev_name = result
|
||||||
sd.check_input_settings(
|
sd.check_output_settings(
|
||||||
device=out_dev_index,
|
device=out_dev_index,
|
||||||
channels=1,
|
channels=1,
|
||||||
dtype="int16",
|
dtype="int16",
|
||||||
|
@ -167,7 +167,7 @@ def test_audio_devices(input_id: str, output_id: str) -> list:
|
||||||
|
|
||||||
|
|
||||||
except (sd.PortAudioError, ValueError) as e:
|
except (sd.PortAudioError, ValueError) as e:
|
||||||
log.warning("Output device error:", e=e)
|
log.warning(f"[Audio-Test] Output device error ({output_id}) [{str(out_dev_index)}] [{out_dev_name}]:", e=e)
|
||||||
test_result[1] = False
|
test_result[1] = False
|
||||||
|
|
||||||
sd._terminate()
|
sd._terminate()
|
||||||
|
|
Loading…
Reference in a new issue