I am very beginner with voice steaming
I try to build a Voice Chat application I conclude :
- I should use UPD as ProtocolType in socket
- I should use NAudio streaming
The send mechanism (pseudo code):
private void but_Click(object sender, EventArgs e)
{
if (sourceList.SelectedItems.Count == 0) return;
int deviceNumber = sourceList.SelectedItems[0].Index;
NAudio.Wave.WaveIn sourceStream = new NAudio.Wave.WaveIn();
sourceStream.DeviceNumber = deviceNumber;
sourceStream.WaveFormat = new NAudio.Wave.WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(deviceNumber).Channels);
sourceStream.DataAvailable += new EventHandler<NAudio.Wave.WaveInEventArgs>(sourceStream_DataAvailable);
sourceStream.StartRecording();
}
private void sourceStream_DataAvailable(object sender, NAudio.Wave.WaveInEventArgs e)
{
if (sourceStream== null) return;
send_UPD(e.Buffer, e.BytesRecorded);//sending data UPD
}
I think the send will successful and the receiver will revive array of byte
The send mechanism (pseudo code):
NAudio.Wave.DirectSoundOut waveOut = new NAudio.Wave.DirectSoundOut();
NAudio.Wave.WaveInProvider waveIn = new NAudio.Wave.WaveInProvider(/*my recived array of byte*/);
waveOut.Init(waveIn);
waveOut.Play();
My question
Is the above true and what can i do with a array of byte in receiver (how can I play it ) ???