Class MixingSampleProvider
- Namespace
- NAudio.Wave.SampleProviders
- Assembly
- NAudio.Core.dll
A sample source mixer, allowing inputs to be added and removed
public class MixingSampleProvider : ISampleProvider
- Inheritance
-
MixingSampleProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
MixingSampleProvider(WaveFormat)
Creates a new MixingSampleProvider, with no inputs, but a specified WaveFormat
public MixingSampleProvider(WaveFormat waveFormat)
Parameters
waveFormatWaveFormatThe WaveFormat of this mixer. All inputs must be in this format
MixingSampleProvider(IEnumerable<ISampleProvider>)
Creates a new MixingSampleProvider, based on the given inputs
public MixingSampleProvider(IEnumerable<ISampleProvider> sources)
Parameters
sourcesIEnumerable<ISampleProvider>Mixer inputs - must all have the same waveformat, and must all be of the same WaveFormat. There must be at least one input
Properties
MixerInputs
Returns the mixer inputs (read-only - use AddMixerInput to add an input
public IEnumerable<ISampleProvider> MixerInputs { get; }
Property Value
ReadFully
When set to true, the Read method always returns the number of samples requested, even if there are no inputs, or if the current inputs reach their end. Setting this to true effectively makes this a never-ending sample provider, so take care if you plan to write it out to a file.
public bool ReadFully { get; set; }
Property Value
WaveFormat
The output WaveFormat of this sample provider
public WaveFormat WaveFormat { get; }
Property Value
Methods
AddMixerInput(ISampleProvider)
Adds a new mixer input
public void AddMixerInput(ISampleProvider mixerInput)
Parameters
mixerInputISampleProviderMixer input
Read(Span<float>)
Reads samples from this sample provider into a span
public int Read(Span<float> buffer)
Parameters
Returns
RemoveAllMixerInputs()
Removes all mixer inputs
public void RemoveAllMixerInputs()
RemoveMixerInput(ISampleProvider)
Removes a mixer input
public void RemoveMixerInput(ISampleProvider mixerInput)
Parameters
mixerInputISampleProviderMixer input to remove
Events
MixerInputEnded
Raised when a mixer input has been removed because it has ended
public event EventHandler<SampleProviderEventArgs> MixerInputEnded