Exemplo n.º 1
0
        public void UpdateProcessList()
        {
            IMMDeviceEnumerator deviceEnumerator = (IMMDeviceEnumerator)(new MMDeviceEnumerator());
            IMMDeviceCollection outputDevices    = null;
            IMMDeviceCollection inputDevices     = null;

            deviceEnumerator.EnumAudioEndpoints(EDataFlow.eRender, STATE.ACTIVE, out outputDevices);
            deviceEnumerator.EnumAudioEndpoints(EDataFlow.eCapture, STATE.ACTIVE, out inputDevices);

            uint inputDeviceCount  = 0;
            uint outputDeviceCount = 0;

            inputDevices.GetCount(out inputDeviceCount);
            outputDevices.GetCount(out outputDeviceCount);

            // Loop over every output device
            for (uint i = 0; i < outputDeviceCount; i++)
            {
                IMMDevice device;
                outputDevices.Item(i, out device);

                AudioDevice audioDevice = new AudioDevice(device);
                Mapper.Mapper.DevicesAndProcesses[audioDevice] = audioDevice.GetAllSessions();
            }
        }
Exemplo n.º 2
0
 public void UpdateDevice(AudioDevice audioDevice)
 {
     Mapper.Mapper.DevicesAndProcesses[audioDevice] = audioDevice.GetAllSessions();
 }