Detect OS audio device changes #18
|
Hey, does OwnAudioSharp provide a way to detect when the OS changes what device is used for audio output? I'm currently playing back audio using IAudioEngine.Send() and I'd like to either switch the audio device that the AudioEngine is using, or restart it entirely with a new device is necessary, whenever the user switches audio output devices. I've tried Thanks! |
Replies: 1 comment 1 reply
|
Hi! Sorry for the late reply! // The engine must be stopped
await Task.Run(() => engine.Stop());
int result = engine.SetOutputDeviceByName("Headphones");
// -2 = still running, -3 = not found
engine.Start(); |
Hi!
Sorry for the late reply!
The OutputDeviceChanged event only responds to changes in the number of output devices (when the device is disconnected or reconnected).
Device switching is not monitored by the audio engine at the OS level.
Device switching must be done in code.