filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.14k stars 450 forks source link

Audio muted even after audio device restarts #453

Closed seanstardev closed 3 years ago

seanstardev commented 3 years ago

Hi. Thank you for this fascinating library!

I am using the SimpleAudioVolume object to mute some apps (simpleVolume.IsMuted = true).

It works really well, and unmute is generally ok. The problem I have is - I tend to mute apps as they are closing, and when I start the app up again, I want the app to start with sound. But the app stays in the same unmuted state as when it exited. I know I can put a timer in place and look for the app when it starts and then unmute when it is found, but this is not ideal for my scenario.

Is it possible to find the device's audio just after the app has stopped and unmute in anticipation of it starting again (I'm guessing this questioin is non-sequitur)?

Or is it possible to somehow set all devices audio to on, including those that haven't started yet?

Thank you for any help you can provide :)

filoe commented 3 years ago

You ve described the default behaviour of the windows os. You could search for any events instead of pulling the processes with a timer. But the behaviour itself is as it is.

seanstardev commented 3 years ago

Thank you for the reply, filoe. It is much appreciated.

OK. Certainly not a bug then. If this is standard behaviour, it is at most a feature request.

As an aside then - I am wondering if I could pull on your expertise with Audio: Is there a way of ensuring an audio device is un-muted next time it comes online? Or is there a way of telling Windows that all devices that WERE muted should be unmuted when they next come online?

Thank you again.