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)