Skip to content

Commit

Permalink
Merge pull request stakira#1232 from krn1pnc/master
Browse files Browse the repository at this point in the history
use the first available audio device
  • Loading branch information
stakira authored Aug 14, 2024
2 parents 74e46c7 + eaba693 commit cd88f37
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion OpenUtau.Core/Audio/MiniAudioOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ public MiniAudioOutput() {
if (Guid.TryParse(Preferences.Default.PlaybackDevice, out var guid)) {
SelectDevice(guid, Preferences.Default.PlaybackDeviceNumber);
} else {
SelectDevice(devices[0].guid, devices[0].deviceNumber);
bool foundDevice = false;
foreach (AudioOutputDevice dev in devices) {
try {
SelectDevice(dev.guid, dev.deviceNumber);
foundDevice = true;
break;
} catch (Exception e) {
Log.Warning(e, $"Failed to init audio device {dev}");
}
}
if (!foundDevice) {
throw new Exception("Failed to init any audio device");
}
}
}

Expand Down

0 comments on commit cd88f37

Please sign in to comment.