/// <summary> /// Construct a new voice loopback session. /// </summary> /// <param name="codec">An audio codec to encode and decode with.</param> /// <param name="quality">The encoding quality (usually the sample rate).</param> public VoiceLoopback(VoiceCodec codec, int quality) { var info = new CodecInfo(codec, quality); _waveIn = new WaveIn(this, info.DecodedFormat, info.DecodedBufferSize); _waveOut = new WaveOut(this, info.EncodedFormat, info.EncodedBufferSize); _encoder = new AudioConverter(info.DecodedBufferSize, info.DecodedFormat, info.EncodedFormat); }
public VoicePeer(VoiceCodec codec, int quality, VoicePacketPool pool) { _codec = new CodecInfo(codec, quality); _buffer = new JitterBuffer(_codec); _pool = pool; this.InitAudio(); }
public VoiceIn(CodecInfo codec, RtpClient client, TransmitPredicate predicate) { _codec = codec; _client = client; _predicate = predicate; this.InitAudio(); }
public JitterBuffer(CodecInfo codec) { _span = codec.SamplesPerPacket; _decoder = codec.GetDecoder(); _incoming = new ConcurrentQueue<VoicePacket>(); _buffer = new LinkedList<VoicePacket>(); this.Reset(); }
/// <summary> /// Construct a new voice session. /// </summary> /// <param name="codec">The transmit codec.</param> /// <param name="quality">The transmit quality (usually the sample rate).</param> /// <param name="client">An optional already-bound UDP client to use. If this is null, then a new client will be constructed.</param> /// <param name="transmitCallback">An optional callback to determine whether to transmit each packet. An application may /// use logic such as PTT (push-to-talk) or an automatic peak level-based approach. By default, all packets are transmitted.</param> public VoiceClient(CodecInfo codec, UdpClient client = null, TransmitPredicate transmitPredicate = null, ReceivePredicate receivePredicate = null) : base((byte)codec.PayloadType, codec.EncodedBufferSize, new IPEndPoint(new IPAddress(DummyIPAddress), DummyPort), client) { _peers = new Dictionary<IPEndPoint, VoicePeer>(); _pool = new VoicePacketPool(); _receivePredicate = receivePredicate; _voiceIn = new VoiceIn(codec, this, transmitPredicate); }