Inheritance: MumbleSharp.BasicMumbleProtocol
コード例 #1
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();

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

            for (int i = 0; i < deviceCount; i++)
            {
                NAudio.Wave.WaveInCapabilities deviceInfo = NAudio.Wave.WaveIn.GetCapabilities(i);
                string deviceText = string.Format("{0}, {1} channels", deviceInfo.ProductName, deviceInfo.Channels);
                comboBox1.Items.Add(deviceText);
            }
            if (deviceCount > 0)
            {
                MicrophoneRecorder.SelectedDevice = 0;
                comboBox1.SelectedIndex           = 0;
            }
        }
コード例 #2
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;
        }