Merge pull request #606 from Tom94/fix-audio-crash

Fix crash caused by multiple identical audio device names
This commit is contained in:
Dean Herbert 2017-04-08 01:31:54 +09:00 committed by GitHub
commit b6ece111a4
1 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,13 @@ private void updateItems()
if (deviceItems.All(kv => kv.Value != preferredDeviceName))
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
dropdown.Items = deviceItems;
// The option dropdown for audio device selection lists all audio
// device names. Dropdowns, however, may not have multiple identical
// keys. Thus, we remove duplicate audio device names from
// the dropdown. BASS does not give us a simple mechanism to select
// specific audio devices in such a case anyways.This functionality would
// require OS-specific and involved code.
dropdown.Items = deviceItems.Distinct().ToList();
}
private void onDeviceChanged(string name) => updateItems();