//Part1 语音通信 private void button1_Click_1(object sender, EventArgs e) { if (button1.Text == "语音通话") { //远端socket配置 ipeRemote1 = new IPEndPoint(IPAddress.Parse(label1.Text.ToString()), 8500); audioPlayer = PlayerFactory.CreateAudioPlayer(0, 16000, 1, 16, 2); microphoneCapturer = CapturerFactory.CreateMicrophoneCapturer(0); microphoneCapturer.AudioCaptured += new ESBasic.CbGeneric <byte[]>(microphoneCapturer_AudioCaptured); Listen_sound(); microphoneCapturer.Start(); button1.Text = "停止语音通话"; } else { microphoneCapturer.Stop(); ListenThread_sound.Suspend(); button1.Text = "语音通话"; } }
/// <summary> /// 打开麦克风,开始录音 /// </summary> public void OpenMircoPhone() { microphoneCapturer.Start(); }