Esempio 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;
        }
Esempio 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();
            }
        }