Class ChannelMixerSampleProvider
- Namespace
- NAudio.Wave.SampleProviders
- Assembly
- NAudio.Core.dll
Produces an output stream by mixing together the channels of a single source using an arbitrary mixing matrix, where the number of output channels is determined by the number of columns in the matrix.
public class ChannelMixerSampleProvider : ISampleProvider
- Inheritance
-
ChannelMixerSampleProvider
- Implements
- Inherited Members
- Extension Methods
Remarks
See ChannelMixMatrix for some pre-defined matrices.
Constructors
ChannelMixerSampleProvider(ISampleProvider, float[,])
Initializes a new instance of the ChannelMixerSampleProvider class. The number of output channels from the mixer depends on the structure of the provided matrix.
public ChannelMixerSampleProvider(ISampleProvider source, float[,] matrix)
Parameters
sourceISampleProviderThe provider to read from.
matrixfloat[,]Specifies the matrix that converts input samples to output samples. The number of rows in the matrix must match the number of input channels from
source. The number of columns in the matrix determines the number of output channels.
Exceptions
- ArgumentNullException
Occurs if any argument is null.
- ArgumentException
Occurs if the matrix has no output columns, or if the number of rows in the matrix does not match the number of channels in
source.
Properties
WaveFormat
Gets the WaveFormat of the output from the mixer. The encoding is always IeeeFloat. The number of channels present in the WaveFormat depends on the channel mixing matrix in use.
public WaveFormat WaveFormat { get; }
Property Value
Methods
Read(Span<float>)
Reads samples from the mixer into the provided buffer.
public int Read(Span<float> buffer)
Parameters
Returns
- int
The total number of samples that were obtained.