コード例 #1
0
        public void Refresh()
        {
            // Retain previously active sources
            var lastMicNames = RecordingSources
                               .Where(M => M.IsActive)
                               .Select(M => M.Item)
                               .Where(M => !M.IsLoopback)
                               .Select(M => M.Name)
                               .ToArray();

            var lastSpeakerNames = RecordingSources
                                   .Where(M => M.IsActive)
                                   .Select(M => M.Item)
                                   .Where(M => M.IsLoopback)
                                   .Select(M => M.Name)
                                   .ToArray();

            RecordingSources.Clear();

            var sources = _audioSource.GetSources();

            foreach (var source in sources.Select(M => M.ToIsActive()))
            {
                RecordingSources.Add(source);

                source.IsActive = source.Item.IsLoopback
                    ? lastSpeakerNames.Contains(source.Item.Name)
                    : lastMicNames.Contains(source.Item.Name);
            }
        }
コード例 #2
0
        void Audio()
        {
            WriteLine($"Audio Source: {_audioSource.Name}");

            WriteLine();

            var sources = _audioSource.GetSources();

            var mics = sources
                       .Where(M => !M.IsLoopback)
                       .ToArray();

            var speakers = sources
                           .Where(M => M.IsLoopback)
                           .ToArray();

            // Microphones
            if (mics.Length > 0)
            {
                WriteLine("AVAILABLE MICROPHONES" + Underline);

                for (var i = 0; i < mics.Length; ++i)
                {
                    WriteLine($"{i.ToString().PadRight(2)}: {mics[i]}");
                }

                WriteLine();
            }

            // Speakers
            if (speakers.Length > 0)
            {
                WriteLine("AVAILABLE SPEAKER SOURCES" + Underline);

                for (var i = 0; i < speakers.Length; ++i)
                {
                    WriteLine($"{i.ToString().PadRight(2)}: {speakers[i]}");
                }

                WriteLine();
            }
        }
コード例 #3
0
        IEnumerable <IAudioItem> HandleAudioSource(StartCmdOptions StartOptions)
        {
            var sources = _audioSource.GetSources();

            var mics = sources
                       .Where(M => !M.IsLoopback)
                       .ToArray();

            var speakers = sources
                           .Where(M => M.IsLoopback)
                           .ToArray();

            if (StartOptions.Microphone != -1 && StartOptions.Microphone < mics.Length)
            {
                _settings.Audio.Enabled = true;
                yield return(mics[StartOptions.Microphone]);
            }

            if (StartOptions.Speaker != -1 && StartOptions.Speaker < speakers.Length)
            {
                _settings.Audio.Enabled = true;
                yield return(speakers[StartOptions.Speaker]);
            }
        }