private static void ListAllAudioSessions() { foreach (AudioSession session in AudioUtilities.GetAllSessions()) { if (session.Process != null) { Console.WriteLine(session.Process.ProcessName); } } }
private static AudioSession GetSession(string name) { foreach (AudioSession session in AudioUtilities.GetAllSessions()) { if (session.Process != null && session.Process.ProcessName == name) { return(session); } } Console.WriteLine("No such app"); return(null); }