private void btnSend_Click(object sender, EventArgs e) { if (m_AudRecorder != null && false == String.IsNullOrEmpty(sWavToSend)) { CReadWavFile wf = new CReadWavFile(sWavToSend); ZelloPTTLib.IContacts cnts = ptt.Contacts; ZelloPTTLib.IMessage msg = null; List <string> lst = new List <string>(); try { foreach (object chk in cbSendAudioFile.CheckedItems) { ContactInfo ci = chk as ContactInfo; if (ci != null) { lst.Add(ci.id); } } } catch (System.Exception) {} if (lst.Count > 0) { ZelloPTTLib.IAudioStream strm = m_AudRecorder.MessageOutBeginEx(lst.ToArray(), string.Empty, out msg); if (strm != null && msg != null) { pbSendProgress.Visible = true; AudioMessageRecording rec = new AudioMessageRecording(wf); rec.AllDataWritten += new EventHandler(SendFile_AllDataWritten); lstOutMessages.Add(rec); rec.SetStream(strm); } } } }
void startAudioForwarding(WavBuffer wb) { BeginInvoke((MethodInvoker) delegate { if (m_AudRecorder != null && wb != null && contactsMesh != null) { ZelloPTTLib.IMessage msg = null; List <string> lst = new List <string>(); foreach (string id in lstForwardContactIds) { lst.Add(id); } if (lst.Count > 0) { ZelloPTTLib.IAudioStream strm = m_AudRecorder.MessageOutBeginEx(lst.ToArray(), string.Empty, out msg); if (strm != null && msg != null) { pbForwardAudio.Visible = true; AudioMessageRecording rec = new AudioMessageRecording(wb as MultiClientSample.IReadWav); rec.AllDataWritten += new EventHandler(ForwardAudio_AllDataWritten); lstOutMessages.Add(rec); rec.SetStream(strm); } } } }); }
public void SetStream(ZelloPTTLib.IAudioStream _stream) { if (null != trdFeed) { return; } m_stream = _stream; m_stream.Start(Convert.ToInt32(wavDataProvider.SampleRate)); trdFeed = new Thread(new ThreadStart(this.ThreadRun)); trdFeed.SetApartmentState(ApartmentState.MTA); trdFeed.Start(); }