public void Play()
{
if (this.buffers == null || this.waveStream == null)
{
throw new InvalidOperationException("Must call Init first");
}
if (playbackState == PlaybackState.Stopped)
{
playbackState = PlaybackState.Playing;
ThreadPool.QueueUserWorkItem((state) => PlaybackThread(), null);
}
else if (playbackState == PlaybackState.Paused)
{
Resume();
callbackEvent.Set(); // give the thread a kick
}
}
public Call(IPEndPoint Address) { UdpSender = new UdpClient(); UdpSender.Connect(Address); this.Address = Address; _encoder = new SpeexEncoder(BandMode.Wide); SpeexProvider = new JitterBufferWaveProvider(); SoundOut = new WaveOutEvent(); SoundOut.Init(SpeexProvider); SoundOut.Play(); }