Table of Contents

Class WaveOffsetStream

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll

Simply shifts the input stream in time, optionally clipping its start and end. (n.b. may include looping in the future)

public class WaveOffsetStream : WaveStream, IDisposable, IAsyncDisposable, IWaveProvider
Inheritance
WaveOffsetStream
Implements
Inherited Members
Extension Methods

Constructors

WaveOffsetStream(WaveStream)

Creates a WaveOffsetStream with default settings (no offset or pre-delay, and whole length of source stream)

public WaveOffsetStream(WaveStream sourceStream)

Parameters

sourceStream WaveStream

The source stream

WaveOffsetStream(WaveStream, TimeSpan, TimeSpan, TimeSpan)

Creates a new WaveOffsetStream

public WaveOffsetStream(WaveStream sourceStream, TimeSpan startTime, TimeSpan sourceOffset, TimeSpan sourceLength)

Parameters

sourceStream WaveStream

the source stream

startTime TimeSpan

the time at which we should start reading from the source stream

sourceOffset TimeSpan

amount to trim off the front of the source stream

sourceLength TimeSpan

length of time to play from source stream

Properties

BlockAlign

Gets the block alignment for this WaveStream

public override int BlockAlign { get; }

Property Value

int

Length

Returns the stream length

public override long Length { get; }

Property Value

long

Position

Gets or sets the current position in the stream

public override long Position { get; set; }

Property Value

long

SourceLength

Length of time to read from the source stream

public TimeSpan SourceLength { get; set; }

Property Value

TimeSpan

SourceOffset

An offset into the source stream from which to start playing

public TimeSpan SourceOffset { get; set; }

Property Value

TimeSpan

StartTime

The length of time before which no audio will be played

public TimeSpan StartTime { get; set; }

Property Value

TimeSpan

WaveFormat

public override WaveFormat WaveFormat { get; }

Property Value

WaveFormat

Methods

Dispose(bool)

Disposes this WaveStream

protected override void Dispose(bool disposing)

Parameters

disposing bool

HasData(int)

Determines whether this channel has any data to play to allow optimisation to not read, but bump position forward

public override bool HasData(int count)

Parameters

count int

Returns

bool

Read(byte[], int, int)

Reads bytes from this wave stream

public override int Read(byte[] destBuffer, int offset, int numBytes)

Parameters

destBuffer byte[]

The destination buffer

offset int

Offset into the destination buffer

numBytes int

Number of bytes read

Returns

int

Number of bytes read.