Check if an application emits sound

让人想犯罪 __ 提交于 2019-12-23 05:29:29

问题


today I am here to ask you how you can "understand" if a given application is emitting sound. On windows 7 and 8 I use the following code (library CSCore Audio )

[...]
        AudioSessionManager2 sessionManager = GetDefaultAudioSessionManager2(DataFlow.Render);
        AudioSessionEnumerator sessionEnumerator = sessionManager.GetSessionEnumerator();

                AudioSessionControl2 sessionControl;
                foreach (AudioSessionControl session in sessionEnumerator)
                {
                    sessionControl = session.QueryInterface<AudioSessionControl2>();
                    if (sessionControl.Process.MainWindowTitle.StartsWith("my_test"))
                    {
                        sessione = sessionControl;
                        audio = session.QueryInterface<AudioMeterInformation>();
                        break;
                    }
                }

        control.Text = sessione.Process.MainWindowTitle + "[" + audio.PeakValue + "]";
    [...]

It works well, but not on Windows XP. Is there a way "universal" to do it? If there would be a way to do this in Java would be even better, so work on Linux (which for the moment I do not need, but maybe in the future)


回答1:


I am sorry, but Windows XP does not querying the audio peak of a process. You can also take a look at the Windows XP Audio Mixer. There is no peak displayed.



来源:https://stackoverflow.com/questions/23182880/check-if-an-application-emits-sound

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