public abstract class WaveToSampleBase : ISampleSource
Converts a ISampleSource to a IWaveSource.
Buffer
The buffer to use for reading from the Source.
protectedorinternal Byte[] Buffer
Source
The underlying source which provides the raw data.
protectedorinternal IWaveSource Source
WaveToSampleBase(IWaveSource source)
Initializes a new instance of the WaveToSampleBase class.
protected void WaveToSampleBase(IWaveSource source)
Parameters
source
IWaveSourceThe underlying IWaveSource instance which has to get converted to a ISampleSource.
Exceptions
ArgumentNullException
The source argument is null.
CreateConverter(IWaveSource source)
Returns an implementation of the ISampleSource interface which converts the specified source to a ISampleSource.
public static ISampleSource CreateConverter(IWaveSource source)
Parameters
source
IWaveSourceThe IWaveSource instance to convert.
Returns
Returns an implementation of the ISampleSource interface which converts the specified source to a ISampleSource.
Exceptions
ArgumentNullException
source is null.
NotSupportedException
The WaveFormat of the source is not supported.
Dispose()
Disposes the WaveToSampleBase.
public void Dispose()
Dispose(Boolean disposing)
Disposes the Source.
protected virtual void Dispose(Boolean disposing)
Parameters
disposing
BooleanNot used.
Finalize()
Finalizes an instance of the WaveToSampleBase class.
protected void Finalize()
Read(Single[] buffer, Int32 offset, Int32 count)
Reads a sequence of samples from the WaveToSampleBase and advances the position within the stream by the number of samples read.
public abstract Int32 Read(Single[] buffer, Int32 offset, Int32 count)
Parameters
buffer
Single[]An array of floats. When this method returns, the buffer contains the specified float array with the values between offset and (offset + count - 1) replaced by the floats read from the current source.
offset
Int32The zero-based offset in the buffer at which to begin storing the data read from the current stream.
count
Int32The maximum number of samples to read from the current source.
Returns
The total number of samples read into the buffer.
CanSeek
Gets a value indicating whether the IAudioSource supports seeking.
public Boolean CanSeek { get; }
Length
Gets the length of the waveform-audio data in samples.
public Int64 Length { get; }
Position
Gets or sets the current position in samples.
public Int64 Position { get; set; }
WaveFormat
Gets the WaveFormat of the waveform-audio data.
public WaveFormat WaveFormat { get; }