Class WaveOffsetStream
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, IAsyncDisposable, IDisposable, 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
sourceStreamWaveStreamThe source stream
WaveOffsetStream(WaveStream, TimeSpan, TimeSpan, TimeSpan)
Creates a new WaveOffsetStream
public WaveOffsetStream(WaveStream sourceStream, TimeSpan startTime, TimeSpan sourceOffset, TimeSpan sourceLength)
Parameters
sourceStreamWaveStreamthe source stream
startTimeTimeSpanthe time at which we should start reading from the source stream
sourceOffsetTimeSpanamount to trim off the front of the source stream
sourceLengthTimeSpanlength of time to play from source stream
Properties
BlockAlign
Gets the block alignment for this WaveStream
public override int BlockAlign { get; }
Property Value
Length
Returns the stream length
public override long Length { get; }
Property Value
Position
Gets or sets the current position in the stream
public override long Position { get; set; }
Property Value
SourceLength
Length of time to read from the source stream
public TimeSpan SourceLength { get; set; }
Property Value
SourceOffset
An offset into the source stream from which to start playing
public TimeSpan SourceOffset { get; set; }
Property Value
StartTime
The length of time before which no audio will be played
public TimeSpan StartTime { get; set; }
Property Value
WaveFormat
public override WaveFormat WaveFormat { get; }
Property Value
Methods
Dispose(bool)
Disposes this WaveStream
protected override void Dispose(bool disposing)
Parameters
disposingbool
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
countint
Returns
Read(byte[], int, int)
Reads bytes from this wave stream
public override int Read(byte[] destBuffer, int offset, int numBytes)
Parameters
Returns
Read(Span<byte>)
Reads bytes from this wave stream
public override int Read(Span<byte> destBuffer)