Xeno-rat
Loading...
Searching...
No Matches
NAudio.Wave.MixingWaveProvider32 Class Reference

WaveProvider that can mix together multiple 32 bit floating point input provider All channels must have the same number of inputs and same sample rate n.b. Work in Progress - not tested yet. More...

Inheritance diagram for NAudio.Wave.MixingWaveProvider32:
Collaboration diagram for NAudio.Wave.MixingWaveProvider32:

Public Member Functions

 MixingWaveProvider32 ()
 Creates a new MixingWaveProvider32.
 
 MixingWaveProvider32 (IEnumerable< IWaveProvider > inputs)
 Creates a new 32 bit MixingWaveProvider32.
 
void AddInputStream (IWaveProvider waveProvider)
 Adds an input audio stream to the mixer.
 
void RemoveInputStream (IWaveProvider waveProvider)
 Removes the specified input stream from the list of input streams.
 
int Read (byte[] buffer, int offset, int count)
 Reads audio data from the input streams, sums the channels, and stores the result in the provided buffer.
 

Properties

int InputCount [get]
 The number of inputs to this mixer.
 
WaveFormat WaveFormat [get]
 WaveStream.WaveFormat
 
- Properties inherited from NAudio.Wave.IWaveProvider

Static Private Member Functions

static unsafe void Sum32BitAudio (byte[] destBuffer, int offset, byte[] sourceBuffer, int bytesRead)
 Sums 32-bit audio samples from the source buffer to the destination buffer.
 

Private Attributes

List< IWaveProviderinputs
 
WaveFormat waveFormat
 
int bytesPerSample
 

Detailed Description

WaveProvider that can mix together multiple 32 bit floating point input provider All channels must have the same number of inputs and same sample rate n.b. Work in Progress - not tested yet.

Constructor & Destructor Documentation

◆ MixingWaveProvider32() [1/2]

NAudio.Wave.MixingWaveProvider32.MixingWaveProvider32 ( )
inline

Creates a new MixingWaveProvider32.

Here is the call graph for this function:

◆ MixingWaveProvider32() [2/2]

NAudio.Wave.MixingWaveProvider32.MixingWaveProvider32 ( IEnumerable< IWaveProvider > inputs)
inline

Creates a new 32 bit MixingWaveProvider32.

Parameters
inputsinputs - must all have the same format.
Exceptions
ArgumentExceptionThrown if the input streams are not 32 bit floating point, or if they have different formats to each other
Here is the call graph for this function:

Member Function Documentation

◆ AddInputStream()

void NAudio.Wave.MixingWaveProvider32.AddInputStream ( IWaveProvider waveProvider)
inline

Adds an input audio stream to the mixer.

Parameters
waveProviderThe input audio stream to be added.
Exceptions
ArgumentExceptionThrown when the input audio stream does not match the required format.

This method adds the input audio stream waveProvider to the mixer. It checks if the format of the input stream matches the required format (IEEE floating point with 32 bits per sample). If it is the first input, it sets the format of the mixer to match the input stream. If it is not the first input, it checks if the format of the input stream matches the format of the other inputs already added to the mixer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

int NAudio.Wave.MixingWaveProvider32.Read ( byte[] buffer,
int offset,
int count )
inline

Reads audio data from the input streams, sums the channels, and stores the result in the provided buffer.

Parameters
bufferThe buffer to store the summed audio data.
offsetThe zero-based byte offset in buffer at which to begin storing the data.
countThe number of bytes to read from the input streams.
Exceptions
ArgumentExceptionThrown when count is not a whole number of samples.
Returns
The number of bytes read from the input streams, which may be less than the requested count .

This method first checks if count is a whole number of samples and throws an ArgumentException if not. It then clears the specified portion of the buffer, reads data from the input streams, sums the channels, and stores the result in the buffer. The method returns the actual number of bytes read from the input streams, which may be less than the requested count.

Implements NAudio.Wave.IWaveProvider.

Here is the call graph for this function:

◆ RemoveInputStream()

void NAudio.Wave.MixingWaveProvider32.RemoveInputStream ( IWaveProvider waveProvider)
inline

Removes the specified input stream from the list of input streams.

Parameters
waveProviderThe input stream to be removed.

This method removes the specified waveProvider from the list of input streams. It locks the inputs list to ensure thread safety while removing the stream.

◆ Sum32BitAudio()

static unsafe void NAudio.Wave.MixingWaveProvider32.Sum32BitAudio ( byte[] destBuffer,
int offset,
byte[] sourceBuffer,
int bytesRead )
inlinestaticprivate

Sums 32-bit audio samples from the source buffer to the destination buffer.

Parameters
destBufferThe destination buffer to which the audio samples will be added.
offsetThe offset within the destination buffer to start adding the samples.
sourceBufferThe source buffer containing the audio samples to be added.
bytesReadThe number of bytes read from the source buffer.

This method sums 32-bit audio samples from the source buffer to the destination buffer. It uses unsafe code to work with pointers and perform the addition operation directly on the memory. The method calculates the number of samples read based on the number of bytes read, assuming each sample is 4 bytes (32 bits). It then iterates through the samples and adds each sample from the source buffer to the corresponding sample in the destination buffer.

Here is the caller graph for this function:

Member Data Documentation

◆ bytesPerSample

int NAudio.Wave.MixingWaveProvider32.bytesPerSample
private

◆ inputs

List<IWaveProvider> NAudio.Wave.MixingWaveProvider32.inputs
private

◆ waveFormat

WaveFormat NAudio.Wave.MixingWaveProvider32.waveFormat
private

Property Documentation

◆ InputCount

int NAudio.Wave.MixingWaveProvider32.InputCount
get

The number of inputs to this mixer.

◆ WaveFormat

WaveFormat NAudio.Wave.MixingWaveProvider32.WaveFormat
get

WaveStream.WaveFormat

Implements NAudio.Wave.IWaveProvider.


The documentation for this class was generated from the following file: