private void Start() { Stop(); try { WaveFormat fmt = new WaveFormat(44100, 16, 2); m_Player = new WaveOutPlayer(-1, fmt, 16384, 3, new BufferFillEventHandler(Filler)); m_Recorder = new WaveInRecorder(-1, fmt, 16384, 3, new BufferDoneEventHandler(Voice_Out)); } catch { Stop(); throw; } }
private void Stop() { if (m_Player != null) try { m_Player.Dispose(); } finally { m_Player = null; } if (m_Recorder != null) try { m_Recorder.Dispose(); } finally { m_Recorder = null; } m_Fifo.Flush(); // clear all pending data }
private void BufferClear() { if (wavePlayer != null) try { wavePlayer.Dispose(); } finally { wavePlayer = null; } if (waveRecorder != null) try { waveRecorder.Dispose(); } finally { waveRecorder = null; } m_Fifo.Flush(); }
public VideoChatClientViewModel() { try { UDP_VIDEO_Server = new UDP_Server() { ServerIP = "224.0.0.1", ServerPort = 5000 }; UDP_VIDEO_Server.evRecBuf += (CurUDP_Server_evRecBuf); UDP_VIDEO_Server.Start(); UDP_AUDIO_Server = new UDP_Server() { ServerIP = "224.0.0.1", ServerPort = 6000 }; UDP_AUDIO_Server.evRecBuf += (UDP_AUDIO_Server_evRecBuf); UDP_AUDIO_Server.Start(); /* UDP_VIDEO_Conference_Client = new UDP_Client() { ServerIP = "224.0.0.1", ServerPort = 7000 }; UDP_VIDEO_Conference_Client.Start(); UDP_VIDEO_Conference_Server = new UDP_Server() { ServerIP = "224.0.0.1", ServerPort = 7000 }; UDP_VIDEO_Conference_Server.evRecBuf += (UDP_VIDEO_Conference_Server_evRecBuf); UDP_VIDEO_Conference_Server.Start(); UDP_AUDIO_Conference_Client = new UDP_Client() { ServerIP = "224.0.0.1", ServerPort = 8000 }; UDP_AUDIO_Conference_Client.Start(); UDP_AUDIO_Conference_Server = new UDP_Server() { ServerIP = "224.0.0.1", ServerPort = 8000 }; UDP_AUDIO_Conference_Server.evRecBuf += (UDP_AUDIO_Conference_Server_evRecBuf); UDP_AUDIO_Conference_Server.Start();*/ } catch (Exception ex) { MessageBox.Show("Ошибка создания UDP серверов\n" + ex.ToString()); } ConferenceRoom = new ObservableCollection<ConferenceClass>(); for(int i=0;i<4;i++) { string sRoom = MachineSettings.ButtonNumberToRoom(31 + i); var cc = new ConferenceClass() { SName = sRoom }; cc.PropertyChanged += VideoChatClientViewModel_PropertyChanged; ConferenceRoom.Add(cc); } WebCamDevices = MultimediaUtil.VideoInputDevices; RunConferencService(); if (waveOut == null) waveOut = new WaveOutPlayer(-1, waveFormat, 4096, 2, Filler); if (WaveIn == null) WaveIn = new WaveInRecorder(-1, waveFormat, 4096, 2); tmrSendVideo.Interval = SendVideoInerval; tmrSendVideo.Tick += (_1,_2) => { if (Participant == null || MyVideoFrame == null || SelectedConferenceRoom.Count == 0) return; tmrSendVideo.Stop(); if (IsUDPConference==false) { participant.VideoSample( new SendBytes { From = Room, Data = MyVideoFrame.Clone() as byte[], To = SelectedConferenceRoom }); } else { var um = new UPD_Message() { From = Room, Data = MyVideoFrame.Clone() as byte[], To = SelectedConferenceRoom }; UDP_VIDEO_Conference_Client.SendBigBuffer(um.ToByte()); } tmrSendVideo.Start(); }; tmrSendVideo.Start(); InitControlDevice(); CheckAutoStart(); }
private void InitCall() { ShowStatus("연결 완료"); SetBtn(1); //원격 연결점 생성 targetDataIP = tempIP; targetVoiceIP = new IPEndPoint(tempIP.Address, 2000); WaveFormat fmt = new WaveFormat(44100, 16, 2); wavePlayer = new WaveOutPlayer(-1, fmt, 16384, 3, new BufferFillEventHandler(Filler)); waveRecorder = new WaveInRecorder(-1, fmt, 16384, 3, new BufferDoneEventHandler(Voice_Out)); //음성 비동기 수신 대기 udpVoice.BeginReceive(new AsyncCallback(ReceiveVoiceCallback), udpVoice); }