1
Vote

System crash when battledfield 4 is running

description

I am using CSCore 1.0.2 to get the peak volume of Skype 50 times per second. This is the code that I am using to get the peak volume:
private int GetPeak(int procID)
        {
            var sessionManager = GetDefaultAudioSessionManager2(DataFlow.Render);
            var sessionEnumerator = sessionManager.GetSessionEnumerator();
            foreach (var session in sessionEnumerator)
            {
                var session2 = session.QueryInterface<AudioSessionControl2>();
                var audioMeterInformation = session.QueryInterface<AudioMeterInformation>();
                if (session2.Process != null && session2.ProcessID == procID) { return (int)  (audioMeterInformation.PeakValue * 100); }
            }
            return 0;
        }

private AudioSessionManager2 GetDefaultAudioSessionManager2(DataFlow dataFlow)
        {
            using (var enumerator = new MMDeviceEnumerator())
            {
                using (var device = enumerator.GetDefaultAudioEndpoint(dataFlow, Role.Multimedia))
                {
                    var sessionManager = AudioSessionManager2.FromMMDevice(device);
                    return sessionManager;
                }
            }
        }
Every time it crashes it seems to be from a diffrent reason with a diffrent compiler code and a diffrent effect on my computer.

comments

filoe wrote Nov 9, 2015 at 6:11 PM

I'm sorry, but cscore moved to the https://github.com/filoe/cscore please, post your issue on github. Codeplex is not longer in use.
Also please provide some more details regarding the exception/crash (message, type, stacktrace,...).