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, 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
WaveStreamThe source stream
WaveOffsetStream(WaveStream, TimeSpan, TimeSpan, TimeSpan)
Creates a new WaveOffsetStream
public WaveOffsetStream(WaveStream sourceStream, TimeSpan startTime, TimeSpan sourceOffset, TimeSpan sourceLength)
Parameters
sourceStream
WaveStreamthe source stream
startTime
TimeSpanthe time at which we should start reading from the source stream
sourceOffset
TimeSpanamount to trim off the front of the source stream
sourceLength
TimeSpanlength 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
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
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
intOffset into the destination buffer
numBytes
intNumber of bytes read
Returns
- int
Number of bytes read.