public MMDeviceCollection EnumerateAudioEndPoints(EDataFlow dataFlow, DEVICE_STATE dwStateMask) { IMMDeviceCollection result; Marshal.ThrowExceptionForHR(_realEnumerator.EnumAudioEndpoints(dataFlow, dwStateMask, out result)); return(new MMDeviceCollection(result)); }
public bool OpenDevice() { lock (singleton) { int v = Open2255Device(m_DeviceHandle, m_VideoStandard); if (v == 1) { State = S2255Device.DEVICE_STATE.OPEN; StartChannels(); return(true); } else { State = S2255Device.DEVICE_STATE.CLOSED; return(false); } } }
public void CloseDevice() { lock (singleton) { try { StopChannels(); int count = 10; while (!m_AllChannelsStopped && count-- > 0) { Thread.Sleep(1000); } Close2255Device(m_DeviceHandle); State = S2255Device.DEVICE_STATE.CLOSED; } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } } }
public void OnDeviceStateChanged([In, MarshalAs(UnmanagedType.LPWStr)] string pwstrDeviceId, DEVICE_STATE dwNewState) { InvokeOnSynchronizationContext(() => { var handler = DeviceStateChanged; if (handler != null) { MMDevice device = GetDevice(pwstrDeviceId); if (device == null) { return; // Device was already removed by the time we got here } handler(this, new MMDeviceStateEventArgs(device, dwNewState)); } }); }
public static IEnumerable <IMMDevice> CreateIMMDeviceCollection(IMMDeviceEnumerator deviceEnumerator, EDataFlow direction = EDataFlow.eAll, DEVICE_STATE stateMasks = DEVICE_STATE.DEVICE_STATEMASK_ALL) { using var deviceCollection = ComReleaserFactory.Create(deviceEnumerator.EnumAudioEndpoints(direction, stateMasks)); var deviceList = new List <IMMDevice>(); var cnt = deviceCollection.Item.GetCount(); if (cnt == 0) { Assert.Inconclusive("No devices were found."); } for (uint i = 0; i < cnt; i++) { deviceCollection.Item.Item(i, out var dev).ThrowIfFailed(); deviceList.Add(dev); } return(deviceList); }
public bool OpenDevice() { lock (singleton) { int v = Open2255Device(m_DeviceHandle, m_VideoStandard); if (v == 1) { State = S2255Device.DEVICE_STATE.OPEN; StartChannels(); return (true); } else { State = S2255Device.DEVICE_STATE.CLOSED; return (false); } } }
public void CloseDevice() { lock (singleton) { try { StopChannels(); int count = 10; while (!m_AllChannelsStopped && count-- > 0) Thread.Sleep(1000); Close2255Device(m_DeviceHandle); State = S2255Device.DEVICE_STATE.CLOSED; } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } } }
public MMDeviceStateEventArgs(MMDevice device, DEVICE_STATE newState) : base(device) { _newState = newState; }
public MMDeviceCollection EnumerateAudioEndPoints(EDataFlow dataFlow, DEVICE_STATE dwStateMask) { IMMDeviceCollection result; Marshal.ThrowExceptionForHR(_realEnumerator.EnumAudioEndpoints(dataFlow,dwStateMask,out result)); return new MMDeviceCollection(result); }
//konštruktor pre device /// <summary> /// Vytvorenie zariadenia s jeho atributmi /// </summary> /// <param name="ID">Jeznoznačne ID zariadenie pridavané automaticky, možno nastaviť na 0</param> /// <param name="ClusterID">Cislo clustra, ktora sa vypočitava automaticky</param> /// <param name="DeviceName">Meno</param> /// <param name="DeviceAddress">Adresa zariadenia</param> /// <param name="DeviceState"></param> /// <param name="DeviceParamValues"></param> public DeviceDataTemplate(int ID, int ClusterID, string DeviceName, string DeviceAddress, DEVICE_STATE DeviceState, double[] DeviceParamValues, double xPosition, double yPosition) { this.ID = ID; this.ClusterID = ClusterID; this.DeviceName = DeviceName; this.DeviceAddress = DeviceAddress; this.DeviceState = DeviceState; this.DeviceParamValues = DeviceParamValues; this.position = new System.Windows.Point(xPosition, yPosition); }