Esempio n. 1
0
        public Task StartAudioCapture(CancellationToken cancellation)
        {
            if (_aStream == null)
            {
                LogUtil.Write("No Audio devices, no stream.");
                return(Task.CompletedTask);
            }
            if (cancellation != CancellationToken.None)
            {
                LogUtil.Write("Starting audio capture service.");
                _aStream.StartStream(cancellation);
                return(Task.Run(() => {
                    while (!cancellation.IsCancellationRequested)
                    {
                        if (_sendAudioColors)
                        {
                            var cols = _aStream.GetColors();
                            SendColors(cols, cols);
                        }
                    }
                }));
            }

            LogUtil.Write("Cancellation token is null??");
            return(Task.CompletedTask);
        }