fix audio device selection

#96
This commit is contained in:
dj2ls 2021-12-27 15:28:58 +01:00
parent 3d7390c962
commit 66a39b5368
2 changed files with 26 additions and 6 deletions

View file

@ -305,8 +305,27 @@ advancedHamlibSettingsModal
var stop_bits = document.getElementById('hamlib_stopbits_advanced').value
var handshake = document.getElementById('hamlib_handshake_advanced').value
config.rx_audio = document.getElementById("audio_input_selectbox").options[rx_audio].text
config.tx_audio = document.getElementById("audio_output_selectbox").options[tx_audio].text
// loop through audio device list and select
for(i = 0; i < document.getElementById("audio_input_selectbox").length; i++) {
device = document.getElementById("audio_input_selectbox")[i];
if (device.value == rx_audio) {
console.log(device.text);
config.rx_audio = device.text
}
}
// loop through audio device list and select
for(i = 0; i < document.getElementById("audio_output_selectbox").length; i++) {
device = document.getElementById("audio_output_selectbox")[i];
if (device.value == tx_audio) {
console.log(device.text);
config.tx_audio = device.text
}
}
config.deviceid = deviceid
config.deviceport = deviceport
config.serialspeed = serialspeed
@ -981,6 +1000,7 @@ ipcRenderer.on('action-update-daemon-state', (event, arg) => {
option.text = arg.input_devices[i]['NAME'];
option.value = arg.input_devices[i]['ID'];
// set device from config if available
if(config.rx_audio == option.text){
option.setAttribute('selected', true);
}

View file

@ -256,10 +256,10 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
maxInputChannels = p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')
maxOutputChannels = p.get_device_info_by_host_api_device_index(0, i).get('maxOutputChannels')
name = p.get_device_info_by_host_api_device_index(0, i).get('name')
crc_name = crc_algorithm(bytes(name, encoding='utf-8'))
crc_name = crc_name.to_bytes(2, byteorder='big')
crc_name = crc_name.hex()
name = name + ' [' + crc_name + ']'
#crc_name = crc_algorithm(bytes(name, encoding='utf-8'))
#crc_name = crc_name.to_bytes(2, byteorder='big')
#crc_name = crc_name.hex()
#name = name + ' [' + crc_name + ']'
if maxInputChannels > 0:
data["INPUT_DEVICES"].append(