Table of Contents

Class MultiplexingSampleProvider

Namespace
NAudio.Wave.SampleProviders
Assembly
NAudio.Core.dll

Allows any number of inputs to be patched to outputs Uses could include swapping left and right channels, turning mono into stereo, feeding different input sources to different soundcard outputs etc

public class MultiplexingSampleProvider : ISampleProvider
Inheritance
MultiplexingSampleProvider
Implements
Inherited Members
Extension Methods

Constructors

MultiplexingSampleProvider(IEnumerable<ISampleProvider>, int)

Creates a multiplexing sample provider, allowing re-patching of input channels to different output channels

public MultiplexingSampleProvider(IEnumerable<ISampleProvider> inputs, int numberOfOutputChannels)

Parameters

inputs IEnumerable<ISampleProvider>

Input sample providers. Must all be of the same sample rate, but can have any number of channels

numberOfOutputChannels int

Desired number of output channels.

Properties

InputChannelCount

The number of input channels. Note that this is not the same as the number of input wave providers. If you pass in one stereo and one mono input provider, the number of input channels is three.

public int InputChannelCount { get; }

Property Value

int

OutputChannelCount

The number of output channels, as specified in the constructor.

public int OutputChannelCount { get; }

Property Value

int

WaveFormat

The output WaveFormat for this SampleProvider

public WaveFormat WaveFormat { get; }

Property Value

WaveFormat

Methods

ConnectInputToOutput(int, int)

Connects a specified input channel to an output channel

public void ConnectInputToOutput(int inputChannel, int outputChannel)

Parameters

inputChannel int

Input Channel index (zero based). Must be less than InputChannelCount

outputChannel int

Output Channel index (zero based). Must be less than OutputChannelCount

Read(Span<float>)

Reads samples from this sample provider

public int Read(Span<float> buffer)

Parameters

buffer Span<float>

Buffer to be filled with sample data

Returns

int

Number of samples read