Exemplo n.º 1
0
        private void UpdateMinBufferDurationForDevice(InputDeviceModel model)
        {
            int min = 50;

            if (model != null)
            {
                switch (model.Provider)
                {
                case DeviceProvider.Wasapi:
                {
                    var mmdevice = model.MMDevice;
                    min            = mmdevice.MinBufferDurationMs;
                    BufferTargetMs = min * wasapiBufferPaddingMultiplier;
                    break;
                }

                default:
                {
                    BufferTargetMs = Math.Max(model.LastLatency.HasValue ? model.LastLatency.Value : 0, min);
                    break;
                }
                }
            }
            else
            {
                BufferTargetMs = min;
            }

            BufferMinMs = min;
        }
Exemplo n.º 2
0
        private void AddInput(Guid guid)
        {
            var existing = InputList.ToList();

            if (!existing.Any(m => m.Guid == guid))
            {
                if (!IsRecording)
                {
                    RefreshInputDevices(guid);
                }
                else
                {
                    MMDevice found = MMDevices.FindDeviceByGuid(guid);

                    if (found != null)
                    {
                        var added = new InputDeviceModel(found);
                        InputList.Add(added);
                        if (SelectedInputSource == null)
                        {
                            SelectedInputSource = added;
                        }
                    }
                }

                SelectActiveInputGroup();
            }
        }
 public HttpResponseMessage RegisterDevice([FromBody] InputDeviceModel model)
 {
     if (!_notificationService.RegisterDevice(model))
     {
         throw new HttpResponseException(ErrorMessage("الجهاز مسجل مسبقاً"));
     }
     return(OkMessage("تم تسجيل الجهاز بنجاح"));
 }