public RtpWriter(int clockRate) { ClockRate = clockRate; _Client = CreateClient(); _Buffer = DataBuffer.Allocate(2048); }
private void AllocateBuffer(int sampleRate, int numSamples, int numChannels) { _Log.Debug($"Creating audio buffer - sample rate: {sampleRate}, samples: {numSamples}, channels: {numChannels}"); if (_BufferAllocated) { _Buffer.Free(); } _BufferSize = numChannels * numSamples * sizeof(short); DataBuffer dataBuffer = DataBuffer.Allocate(_BufferSize, true); // PCM requires little endian? _Buffer = new AudioBuffer(dataBuffer, new Pcm.Format(sampleRate, numChannels)); _BufferAllocated = true; }