How to play sound on all audio devices

I have a program that alerts the user. But now it just sounds on the default audio device. This is a problem if the user plugs in the headset but does not wear it. So my question is: " Is it possible to set allert sound for all audio devices instead of the default device?"

I am programming in C #, wpf and .net 4.0

I am now using this code to play an audio signal:

private MMDeviceEnumerator devEnum = new MMDeviceEnumerator(); private MMDevice defaultDevice; 

....

 defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); 

....

 defaultDevice.AudioEndpointVolume.MasterVolumeLevel = 1; 

....

 alarm.Play(); 

I hope you help me :)

+4
source share
2 answers

you may need to use EnumAudioEndpoints . Please visit this link then you can get an idea about it.

0
source

What I have found so far is not possible in Windows Vista and later.

0
source

Source: https://habr.com/ru/post/1379469/


All Articles