private static void FindApplication(string appName) { EDataFlow flow = new EDataFlow(); MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator(); devCol = deviceEnum.EnumerateAudioEndPoints(flow, DEVICE_STATE.DEVICE_STATE_ACTIVE); for (int devIdx = 0; devIdx < devCol.Count; devIdx++) { for (int sesIdx = 0; sesIdx < devCol[devIdx].AudioSessionManager2.Sessions.Count; sesIdx++) { if (devCol[devIdx].AudioSessionManager2.Sessions[sesIdx].GetSessionIdentifier.Contains(appName)) devicesAndSessions.Add(new KeyValuePair<int, int>(devIdx, sesIdx)); } } }
public static List<string> GetListOfApplicationsWithAudio() { List<string> results = new List<string>(); EDataFlow flow = new EDataFlow(); MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator(); devCol = deviceEnum.EnumerateAudioEndPoints(flow, DEVICE_STATE.DEVICE_STATE_ACTIVE); for (int devIdx = 0; devIdx < devCol.Count; devIdx++) { for (int sesIdx = 0; sesIdx < devCol[devIdx].AudioSessionManager2.Sessions.Count; sesIdx++) { results.Add(devCol[devIdx].AudioSessionManager2.Sessions[sesIdx].GetSessionIdentifier); } } return results; }
private static void FindApplication(string appName) { LogHelper.Debug(null, "Finding any mixers that contain the word '{0}'", appName); EDataFlow flow = new EDataFlow(); MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator(); devCol = deviceEnum.EnumerateAudioEndPoints(flow, DEVICE_STATE.DEVICE_STATE_ACTIVE); for (int devIdx = 0; devIdx < devCol.Count; devIdx++) { for (int sesIdx = 0; sesIdx < devCol[devIdx].AudioSessionManager2.Sessions.Count; sesIdx++) { if (devCol[devIdx].AudioSessionManager2.Sessions[sesIdx].GetSessionIdentifier.Contains(appName)) { LogHelper.Debug(null, "Found {0}", devCol[devIdx].AudioSessionManager2.Sessions[sesIdx].GetSessionIdentifier); devicesAndSessions.Add(new KeyValuePair<int, int>(devIdx, sesIdx)); } } } }