Table of Contents

Class MultiplexingWaveProvider

Namespace
NAudio.Wave
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 MultiplexingWaveProvider : IWaveProvider
Inheritance
MultiplexingWaveProvider
Implements
Inherited Members
Extension Methods

Constructors

MultiplexingWaveProvider(IEnumerable<IWaveProvider>)

Creates a multiplexing wave provider, allowing re-patching of input channels to different output channels. Number of outputs is equal to total number of channels in inputs

public MultiplexingWaveProvider(IEnumerable<IWaveProvider> inputs)

Parameters

inputs IEnumerable<IWaveProvider>

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

MultiplexingWaveProvider(IEnumerable<IWaveProvider>, int)

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

public MultiplexingWaveProvider(IEnumerable<IWaveProvider> inputs, int numberOfOutputChannels)

Parameters

inputs IEnumerable<IWaveProvider>

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

numberOfOutputChannels int

Desired number of output channels. (-1 means use total number of input 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 WaveFormat of this WaveProvider

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(byte[], int, int)

Reads data from this WaveProvider

public int Read(byte[] buffer, int offset, int count)

Parameters

buffer byte[]

Buffer to be filled with sample data

offset int

Offset to write to within buffer, usually 0

count int

Number of bytes required

Returns

int

Number of bytes read