Beispiel #1
0
        public IDeviceManualTriggerContext ManualTrigger(DeviceManualTriggerContextOption Option = null)
        {
            if (Option != null)
            {
                DeviceAddedEventHandler threadSafeEventHandler = DeviceAdded;
                SixtyBeatAudioDevice    device = SixtyBeatAudioDevice.Create(Option.Tag as string);
                if (device != null)
                {
                    threadSafeEventHandler?.Invoke(this, device);
                }
                return(null);
            }

            SixtyBeatAudioDeviceManualTriggerContext ResponseData = new SixtyBeatAudioDeviceManualTriggerContext();

            ResponseData.Options = new List <DeviceManualTriggerContextOption>();

            var enumerator = new NAudio.CoreAudioApi.MMDeviceEnumerator();

            //cycle through all audio devices
            for (int i = 0; i < WaveIn.DeviceCount; i++)
            {
                // these happen to enumate the same order
                NAudio.CoreAudioApi.MMDevice dev = enumerator.EnumerateAudioEndPoints(NAudio.CoreAudioApi.DataFlow.Capture, NAudio.CoreAudioApi.DeviceState.Active)[i];

                string DeviceID = dev.Properties[new NAudio.CoreAudioApi.PropertyKey(DevPKey.Native.PnpDevicePropertyAPINative.DEVPKEY_Audio_InstanceId.fmtid, (int)DevPKey.Native.PnpDevicePropertyAPINative.DEVPKEY_Audio_InstanceId.pid)].Value.ToString();
                if (!SixtyBeatAudioDevice.DeviceKnown(DeviceID))
                {
                    ResponseData.Options.Add(new DeviceManualTriggerContextOption(dev.FriendlyName, DeviceID));
                }
            }
            enumerator.Dispose();

            return(ResponseData);
        }
Beispiel #2
0
 public IDeviceManualTriggerContext ManualTrigger(DeviceManualTriggerContextOption Option)
 {
     throw new NotImplementedException();
 }