コード例 #1
0
        private void LoadDeviceLists()
        {
            _waveOutList.Clear();
            _waveOutList.Add(new SourceListHolder()
            {
                DeviceListNum = -1, DeviceName = "Default"
            });

            int iTotalCnt = NAudio.Wave.WaveOut.DeviceCount;

            for (int i = 0; i < iTotalCnt; i++)
            {
                NAudio.Wave.WaveOutCapabilities caps = NAudio.Wave.WaveOut.GetCapabilities(i);
                _waveOutList.Add(new SourceListHolder()
                {
                    DeviceListNum = i, DeviceName = caps.ProductName
                });
            }

            _channelList.Clear();
            iTotalCnt = NAudio.Wave.WaveIn.DeviceCount;
            for (int i = 0; i < iTotalCnt; i++)
            {
                NAudio.Wave.WaveInCapabilities caps = NAudio.Wave.WaveIn.GetCapabilities(i);
                if (caps.Channels > 0)
                {
                    _channelList.Add(new SourceListHolder()
                    {
                        DeviceListNum = i, DeviceName = caps.ProductName, ChannelCount = caps.Channels
                    });
                }
            }

            _noiseFloorList.Clear();
            _noiseFloorList.Add(new NoiseFloorHolder()
            {
                NoiseFloorName = "Low", NoiseFloorValue = Common.NoiseFloor.Low
            });
            _noiseFloorList.Add(new NoiseFloorHolder()
            {
                NoiseFloorName = "Normal", NoiseFloorValue = Common.NoiseFloor.Normal
            });
            _noiseFloorList.Add(new NoiseFloorHolder()
            {
                NoiseFloorName = "High", NoiseFloorValue = Common.NoiseFloor.High
            });
            _noiseFloorList.Add(new NoiseFloorHolder()
            {
                NoiseFloorName = "Extra High", NoiseFloorValue = Common.NoiseFloor.ExtraHigh
            });
            _noiseFloorList.Add(new NoiseFloorHolder()
            {
                NoiseFloorName = "Custom", NoiseFloorValue = Common.NoiseFloor.Custom
            });
        }
コード例 #2
0
                public static List <String> Get_Output_Devices()
                {
                    List <String> OutputSelection = new List <string>();
                    int           DC = NAudio.Wave.WaveOut.DeviceCount;

                    for (int i = 0; i < DC; i++)
                    {
                        NAudio.Wave.WaveOutCapabilities DCap = NAudio.Wave.WaveOut.GetCapabilities(i);
                        OutputSelection.Add(String.Format("{0}, {1} Channels", DCap.ProductName, DCap.Channels));
                    }
                    return(OutputSelection);
                }
コード例 #3
0
        public Form1()
        {
            InitializeComponent();

            protocol = new ConnectionMumbleProtocol();
            protocol.channelMessageReceivedDelegate  = ChannelMessageReceivedDelegate;
            protocol.personalMessageReceivedDelegate = PersonalMessageReceivedDelegate;
            protocol.encodedVoice          = EncodedVoiceDelegate;
            protocol.userJoinedDelegate    = UserJoinedDelegate;
            protocol.userLeftDelegate      = UserLeftDelegate;
            protocol.channelJoinedDelegate = ChannelJoinedDelegate;
            protocol.channelLeftDelegate   = ChannelLeftDelegate;
            protocol.serverConfigDelegate  = ServerConfigDelegate;

            tvUsers.ExpandAll();
            tvUsers.StartUpdating();

            playback = new SpeakerPlayback();
            int playbackDeviceCount = NAudio.Wave.WaveOut.DeviceCount;

            cbPlaybackDevices.Items.Add("Default Playback Device");
            for (int i = 0; i < playbackDeviceCount; i++)
            {
                NAudio.Wave.WaveOutCapabilities deviceInfo = NAudio.Wave.WaveOut.GetCapabilities(i);
                string deviceText = string.Format("{0}, {1} channels", deviceInfo.ProductName, deviceInfo.Channels);
                cbPlaybackDevices.Items.Add(deviceText);
            }
            cbPlaybackDevices.SelectedIndex = 0;
            SpeakerPlayback.SelectedDevice  = cbPlaybackDevices.SelectedIndex - 1;

            recorder = new MicrophoneRecorder(protocol);
            int recorderDeviceCount = NAudio.Wave.WaveIn.DeviceCount;

            for (int i = 0; i < recorderDeviceCount; i++)
            {
                NAudio.Wave.WaveInCapabilities deviceInfo = NAudio.Wave.WaveIn.GetCapabilities(i);
                string deviceText = string.Format("{0}, {1} channels", deviceInfo.ProductName, deviceInfo.Channels);
                cbRecordingDevices.Items.Add(deviceText);
            }
            if (recorderDeviceCount > 0)
            {
                MicrophoneRecorder.SelectedDevice = 0;
                cbRecordingDevices.SelectedIndex  = 0;
            }

            numVoiceDetectorThreshold.Value = Convert.ToDecimal(recorder.VoiceDetectionThreshold) * 100;
        }