问题
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