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...
|
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.
|
|
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.
◆ MixingWaveProvider32() [1/2]
NAudio.Wave.MixingWaveProvider32.MixingWaveProvider32 |
( |
| ) |
|
|
inline |
Creates a new MixingWaveProvider32.
◆ MixingWaveProvider32() [2/2]
Creates a new 32 bit MixingWaveProvider32.
- Parameters
-
inputs | inputs - must all have the same format. |
- Exceptions
-
ArgumentException | Thrown if the input streams are not 32 bit floating point, or if they have different formats to each other |
◆ AddInputStream()
void NAudio.Wave.MixingWaveProvider32.AddInputStream |
( |
IWaveProvider | waveProvider | ) |
|
|
inline |
Adds an input audio stream to the mixer.
- Parameters
-
waveProvider | The input audio stream to be added. |
- Exceptions
-
ArgumentException | Thrown 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.
◆ 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
-
buffer | The buffer to store the summed audio data. |
offset | The zero-based byte offset in buffer at which to begin storing the data. |
count | The number of bytes to read from the input streams. |
- Exceptions
-
ArgumentException | Thrown 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.
◆ RemoveInputStream()
void NAudio.Wave.MixingWaveProvider32.RemoveInputStream |
( |
IWaveProvider | waveProvider | ) |
|
|
inline |
Removes the specified input stream from the list of input streams.
- Parameters
-
waveProvider | The 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
-
destBuffer | The destination buffer to which the audio samples will be added. |
offset | The offset within the destination buffer to start adding the samples. |
sourceBuffer | The source buffer containing the audio samples to be added. |
bytesRead | The 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.
◆ bytesPerSample
int NAudio.Wave.MixingWaveProvider32.bytesPerSample |
|
private |
◆ inputs
◆ waveFormat
WaveFormat NAudio.Wave.MixingWaveProvider32.waveFormat |
|
private |
◆ InputCount
int NAudio.Wave.MixingWaveProvider32.InputCount |
|
get |
The number of inputs to this mixer.
◆ WaveFormat
WaveFormat NAudio.Wave.MixingWaveProvider32.WaveFormat |
|
get |
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Core/Wave/WaveProviders/MixingWaveProvider32.cs