public static class FluentExtensions
Provides a basic fluent API for creating a source chain.
AppendSource
Appends a source to an already existing source.
public static TResult AppendSource<TInput, TResult>(TInput input, Func func)
Parameters
input
TInputAlready existing source.
func
FuncFunction which appends the new source to the already existing source.
Type Parameters
TInput
Input
TResult
Output
Returns
The return value of the func delegate.
AppendSource
Appends a source to an already existing source.
public static TResult AppendSource<TInput, TResult>(TInput input, Func func, TResult& outputSource)
Parameters
input
TInputAlready existing source.
func
FuncFunction which appends the new source to the already existing source.
outputSource
TResult&Receives the return value.
Type Parameters
TInput
Input
TResult
Output
Returns
The return value of the func delegate.
ChangeSampleRate(ISampleSource input, Int32 destinationSampleRate)
Changes the SampleRate of an already existing sample source. Note: This extension has to convert the input to a IWaveSource and back to a ISampleSource.
public static ISampleSource ChangeSampleRate(ISampleSource input, Int32 destinationSampleRate)
Parameters
input
ISampleSourceAlready existing sample source whose sample rate has to be changed.
destinationSampleRate
Int32Destination sample rate.
Returns
Sample source with the specified destinationSampleRate.
ChangeSampleRate(IWaveSource input, Int32 destinationSampleRate)
Changes the SampleRate of an already existing wave source.
public static IWaveSource ChangeSampleRate(IWaveSource input, Int32 destinationSampleRate)
Parameters
input
IWaveSourceAlready existing wave source whose sample rate has to be changed.
destinationSampleRate
Int32Destination sample rate.
Returns
Wave source with the specified destinationSampleRate.
Loop(IWaveSource input)
Appends a new instance of the LoopStream class to the audio chain.
public static IWaveSource Loop(IWaveSource input)
Parameters
input
IWaveSourceThe underlying IWaveSource which should be looped.
Returns
The new instance LoopStream instance.
Synchronized
Returns a thread-safe (synchronized) wrapper around the specified TAudioSource object.
public static SynchronizedWaveSource<T, TAudioSource> Synchronized<TAudioSource, T>(TAudioSource audioSource)
Parameters
audioSource
TAudioSourceThe TAudioSource object to synchronize.
Type Parameters
TAudioSource
Type of the audioSource argument.
T
The type of the data read by the Read method of the audioSource method.
Returns
A thread-safe wrapper around the specified TAudioSource object.
Exceptions
ArgumentNullException
The audioSource is null.
ToMono(ISampleSource input)
Converts the specified sample source with n channels to a wave source with one channel. Note: If the input has only one channel, the ToMono extension has to convert the input to a IWaveSource and back to a ISampleSource.
ToMono(IWaveSource input)
Converts the specified wave source with n channels to a wave source with one channel. Note: If the input has two channels, the ToMono extension has to convert the input to a ISampleSource and back to a IWaveSource.
ToSampleSource(IWaveSource waveSource)
Converts a IWaveSource to a ISampleSource.
ToStereo(ISampleSource input)
Converts the specified sample source with n channels to a wave source with two channels. Note: If the input has more than two channels, the ToStereo extension has to convert the input to a IWaveSource and back to a ISampleSource.
ToStereo(IWaveSource input)
Converts the specified wave source with n channels to a wave source with two channels. Note: If the input has only one channel, the ToStereo extension has to convert the input to a ISampleSource and back to a IWaveSource.
ToWaveSource(ISampleSource sampleSource)
Converts a IWaveSource to IeeeFloat (32bit) IWaveSource.
public static IWaveSource ToWaveSource(ISampleSource sampleSource)
Parameters
sampleSource
ISampleSourceThe ISampleSource to convert to a IWaveSource.
Returns
The IWaveSource wrapped around the specified sampleSource.
ToWaveSource(ISampleSource sampleSource, Int32 bits)
Converts a SampleSource to either a Pcm (8, 16, or 24 bit) or IeeeFloat (32 bit) WaveSource.
public static IWaveSource ToWaveSource(ISampleSource sampleSource, Int32 bits)
Parameters
sampleSource
ISampleSourceSample source to convert to a wave source.
bits
Int32Bits per sample.
Returns
Wave source