#4687 Fix audio device selection showing a bunch of zeros

master
Andrey Kleshchev 2025-09-17 21:48:09 +03:00
parent 42b09b236b
commit 1cda0a1a45
2 changed files with 31 additions and 2 deletions

View File

@ -240,13 +240,38 @@ void LLPanelVoiceDeviceSettings::refresh()
if(mCtrlInputDevices)
{
mCtrlInputDevices->removeall();
mCtrlInputDevices->add(getLocalizedDeviceName(mInputDevice), mInputDevice, ADD_BOTTOM);
auto it = mLocalizedDeviceNames.find(mInputDevice);
if (it != mLocalizedDeviceNames.end())
{
mCtrlInputDevices->add(getLocalizedDeviceName(mInputDevice), mInputDevice, ADD_BOTTOM);
}
else
{
// Display name generaly doesn't match value.
// Value is an id so it's not nessesary readable,
// might not even be valid (disconnected usb).
// Until we get the data, don't change the device,
// otherwise box might override the control.
// But show a readable placeholder.
// Combo is disabled so it's safe to show
// a placeholder.
mCtrlInputDevices->add(getString("device_not_loaded"), mInputDevice, ADD_BOTTOM);
}
mCtrlInputDevices->setValue(mInputDevice);
}
if(mCtrlOutputDevices)
{
mCtrlOutputDevices->removeall();
mCtrlOutputDevices->add(getLocalizedDeviceName(mOutputDevice), mOutputDevice, ADD_BOTTOM);
auto it = mLocalizedDeviceNames.find(mOutputDevice);
if (it != mLocalizedDeviceNames.end())
{
mCtrlOutputDevices->add(getLocalizedDeviceName(mOutputDevice), mOutputDevice, ADD_BOTTOM);
}
else
{
// Don't change the device, only the label
mCtrlOutputDevices->add(getString("device_not_loaded"), mOutputDevice, ADD_BOTTOM);
}
mCtrlOutputDevices->setValue(mOutputDevice);
}
}

View File

@ -20,6 +20,10 @@
name="name_default_system_device">
Default System Device
</string>
<string
name="device_not_loaded">
Device not loaded
</string>
<icon
follows="left|top"
height="18"