Check what programs are playing audio?

强颜欢笑 提交于 2021-02-07 03:55:48

问题


I am making a program and I want to find and mute programs that are playing audio so all you hear is mine.

(This is an option for the program, nothing malicious about it)

I have looked it up and I cannot seem to find a way to check what programs are playing audio (Much like windows does)

I don't have any code examples of attempting this because id has no idea.

In case someone misses reads or I don't word the above sentences correct I would like to find EVERY process with audio playing and either KILL or MUTE the process


回答1:


If you can get Peak meters for individual programs on Windows 7, you can identify sessions and applications. IAudioSessionControl interface offers you muting options similar to what user can do via standard Volume Mixer application (session muting in particular).




回答2:


There was a pretty similar question, maybe the same approach I posted in my answer would fit your scenario: https://stackoverflow.com/a/14828598/674700. What you'd need to change are the types of files (into .mp3, .wav and so on) and kill the processes found, with the exception of your application's.

The drawbacks: you'll need to run your application as administrator and it also requires a third party console app.



来源:https://stackoverflow.com/questions/14850951/check-what-programs-are-playing-audio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!