Class BufferedWaveProvider
Provides a buffered store of samples Read method will return queued samples or fill buffer with zeroes Now backed by a circular buffer
public class BufferedWaveProvider : IWaveProvider
- Inheritance
-
BufferedWaveProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
BufferedWaveProvider(WaveFormat)
Creates a new buffered WaveProvider
public BufferedWaveProvider(WaveFormat waveFormat)
Parameters
waveFormat
WaveFormatWaveFormat
Properties
BufferDuration
Buffer duration
public TimeSpan BufferDuration { get; set; }
Property Value
BufferLength
Buffer length in bytes
public int BufferLength { get; set; }
Property Value
BufferedBytes
The number of buffered bytes
public int BufferedBytes { get; }
Property Value
BufferedDuration
Buffered Duration
public TimeSpan BufferedDuration { get; }
Property Value
DiscardOnBufferOverflow
If true, when the buffer is full, start throwing away data if false, AddSamples will throw an exception when buffer is full
public bool DiscardOnBufferOverflow { get; set; }
Property Value
ReadFully
If true, always read the amount of data requested, padding with zeroes if necessary By default is set to true
public bool ReadFully { get; set; }
Property Value
WaveFormat
Gets the WaveFormat
public WaveFormat WaveFormat { get; }
Property Value
Methods
AddSamples(byte[], int, int)
Adds samples. Takes a copy of buffer, so that buffer can be reused if necessary
public void AddSamples(byte[] buffer, int offset, int count)
Parameters
ClearBuffer()
Discards all audio from the buffer
public void ClearBuffer()
Read(byte[], int, int)
Reads from this WaveProvider Will always return count bytes, since we will zero-fill the buffer if not enough available
public int Read(byte[] buffer, int offset, int count)