private void m_pUdpServer_PacketReceived(UdpPacket_eArgs e) { // Decompress data. byte[] decodedData = null; // Elegir el codec decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length); // We just play received packet. m_pWaveOut.Play(decodedData, 0, decodedData.Length); }
public void udpServer_packet_received_method(UdpPacket_eArgs e) { // byte[] decodedData = null; byte[] receiveData = null; //decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length); receiveData = G711.Decode_aLaw(e.Data, 0, e.Data.Length); ASCIIEncoding aEncoding = new ASCIIEncoding(); string receivedMessage = aEncoding.GetString(receiveData); listMessage.Items.Add("Friend: " + receivedMessage); //waveOut.Play(decodedData, 0, decodedData.Length); }
private void AudioServer_PacketReceived(UdpPacket_eArgs e) { // Decompress data. byte[] decodedData = null; if (m_Codec == 0) { decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length); } else if (m_Codec == 1) { decodedData = G711.Decode_uLaw(e.Data, 0, e.Data.Length); } // just play received packet audioWaveOut.Play(decodedData, 0, decodedData.Length); }
private void audio_BufferFull(byte[] buffer) { // Compress data. byte[] encodedData = null; if (m_Codec == 0) { encodedData = G711.Encode_aLaw(buffer, 0, buffer.Length); } else if (m_Codec == 1) { encodedData = G711.Encode_uLaw(buffer, 0, buffer.Length); } // We just sent buffer to target end point. if (m_IsSendingTest) { byte[] decodedData = null; if (m_Codec == 0) { decodedData = G711.Decode_aLaw(encodedData, 0, encodedData.Length); } else if (m_Codec == 1) { decodedData = G711.Decode_uLaw(encodedData, 0, encodedData.Length); } // We just play received packet. VWaveOut.Play(decodedData, 0, decodedData.Length); /* * VWaveOut.Play(buffer, 0, buffer.Length); */ } else //sending to server { // We just sent buffer to target end point. VUdpServer.SendPacket(encodedData, 0, encodedData.Length, VTargetEP); } }
/// <summary> /// This method is called when we got UDP packet. /// </summary> /// <param name="e">Event data.</param> private void m_pUdpServer_PacketReceived(UdpPacket_eArgs e) { // Decompress data. byte[] decodedData = null; if (m_Codec == 0) { decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length); } else if (m_Codec == 1) { decodedData = G711.Decode_uLaw(e.Data, 0, e.Data.Length); } // We just play received packet. m_pWaveOut.Play(decodedData, 0, decodedData.Length); // Record if recoring enabled. if (m_pRecordStream != null) { m_pRecordStream.Write(decodedData, 0, decodedData.Length); } }
private void PacketRecieved(UdpPacket_eArgs e) { byte[] decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length); _waveOut.Play(decodedData, 0, decodedData.Length); }