Exemplo n.º 1
0
        public void Start()
        {
            _logger.Info("Starting audio engine");

            Stop();

            _deviceEnumerator.DefaultDeviceChanged += DefaultDeviceChanged;
            _endpointVolumeCallback.NotifyRecived  += VolumeNotifyReceived;

            SetupDefaultEndpoint();

            foreach (var module in _moduleService.GetAll())
            {
                try
                {
                    AddModule(module.Id);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, "Could not load module. ID: {0}", module.Id);
                    _moduleService.Delete(module.Id);
                }
            }

            foreach (var connection in _moduleConnectionService.GetAll())
            {
                var source = _modules.FirstOrDefault(m => m.Id == connection.SourceId);
                var target = _modules.FirstOrDefault(m => m.Id == connection.TargetId);

                if (source == null)
                {
                    _logger.Warn($"Source module for connection not found. ID: {connection.SourceId}");
                    continue;
                }

                if (target == null)
                {
                    _logger.Warn($"Target module for connection not found. ID: {connection.TargetId}");
                    continue;
                }

                source.AddOutput(target);
            }

            IsRunning = true;
            _logger.Info("Audio engine started");
        }
Exemplo n.º 2
0
 private object GetAll()
 {
     return(_moduleConnectionService.GetAll().ToArray());
 }