Table of Contents

Class CircularBuffer

Namespace
NAudio.Utils
Assembly
NAudio.Core.dll

A very basic circular buffer implementation

public class CircularBuffer
Inheritance
CircularBuffer
Inherited Members

Constructors

CircularBuffer(int)

Create a new circular buffer

public CircularBuffer(int size)

Parameters

size int

Max buffer size in bytes

Properties

Count

Number of bytes currently stored in the circular buffer

public int Count { get; }

Property Value

int

MaxLength

Maximum length of this circular buffer

public int MaxLength { get; }

Property Value

int

Methods

Advance(int)

Advances the buffer, discarding bytes

public void Advance(int count)

Parameters

count int

Bytes to advance

Read(Span<byte>)

Read from the buffer

public int Read(Span<byte> data)

Parameters

data Span<byte>

Span to read into

Returns

int

Number of bytes actually read

Reset()

Resets the buffer

public void Reset()

Write(ReadOnlySpan<byte>)

Write data to the buffer

public int Write(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

Data to write

Returns

int

number of bytes written