Table of Contents

Class BufferedWaveProvider

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll

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 WaveFormat

WaveFormat

Properties

BufferDuration

Buffer duration

public TimeSpan BufferDuration { get; set; }

Property Value

TimeSpan

BufferLength

Buffer length in bytes

public int BufferLength { get; set; }

Property Value

int

BufferedBytes

The number of buffered bytes

public int BufferedBytes { get; }

Property Value

int

BufferedDuration

Buffered Duration

public TimeSpan BufferedDuration { get; }

Property Value

TimeSpan

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

bool

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

bool

WaveFormat

Gets the WaveFormat

public WaveFormat WaveFormat { get; }

Property Value

WaveFormat

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

buffer byte[]
offset int
count int

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)

Parameters

buffer byte[]
offset int
count int

Returns

int