public WindowsMultimediaDevice(ILogger <WindowsMultimediaDevice> logger, IOptionsMonitor <AppSettings.Capture> appSettings,
                                       IPluginCallbacks callbacks)
        {
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
            _appSettings      = appSettings ?? throw new ArgumentNullException(nameof(appSettings));
            _callbacks        = callbacks ?? throw new ArgumentNullException(nameof(callbacks));
            _deviceEnumerator = new MMDeviceEnumerator();
            _deviceEnumerator.RegisterEndpointNotificationCallback(this);

            _monitoringThread = new Thread(Monitoring)
            {
                IsBackground = true
            };
            _monitoringThread.Start();

            //Seems to be using a FileSystemWatcher, better to use a boolean because of concurrency and double events.
            _appSettings.OnChange(settings => _dirtySources = true);
        }
 public WindowsMultimediaDevice Create(IPluginCallbacks callbacks)
 {
     return(ActivatorUtilities.CreateInstance <WindowsMultimediaDevice>(_serviceProvider, callbacks));
 }