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

WaveStream that can mix together multiple 32 bit input streams (Normally used with stereo input channels) All channels must have the same number of inputs. More...

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

Public Member Functions

 WaveMixerStream32 ()
 Creates a new 32 bit WaveMixerStream.
 
 WaveMixerStream32 (IEnumerable< WaveStream > inputStreams, bool autoStop)
 Creates a new 32 bit WaveMixerStream.
 
void AddInputStream (WaveStream waveStream)
 Adds an input audio stream to the mixer.
 
void RemoveInputStream (WaveStream waveStream)
 Removes the specified WaveStream from the list of input streams and recalculates the total length of all input streams.
 
override int Read (byte[] buffer, int offset, int count)
 Reads a specified number of bytes from the current stream into a byte array and advances the position within the stream by the number of bytes read.
 
- Public Member Functions inherited from NAudio.Wave.WaveStream
override void Flush ()
 Flushes the buffer of the current stream and causes any buffered data to be written to the underlying device.
 
override long Seek (long offset, SeekOrigin origin)
 Sets the position within the current stream.
 
override void SetLength (long length)
 Throws a NotSupportedException with the message "Can't set length of a WaveFormatString".
 
override void Write (byte[] buffer, int offset, int count)
 Throws a NotSupportedException with the message "Can't write to a WaveFormatString".
 
void Skip (int seconds)
 Skips the playback to a new position in the audio file based on the specified number of seconds.
 
virtual bool HasData (int count)
 Checks if there is data available at the current position.
 

Protected Member Functions

override void Dispose (bool disposing)
 Releases the unmanaged resources used by the WaveMixerStream32 and optionally releases the managed resources.
 

Properties

int InputCount [get]
 The number of inputs to this mixer.
 
bool AutoStop [get, set]
 Automatically stop when all inputs have been read.
 
override int BlockAlign [get]
 WaveStream.BlockAlign
 
override long Length [get]
 Length of this Wave Stream (in bytes) System.IO.Stream.Length
 
override long Position [get, set]
 Position within this Wave Stream (in bytes) System.IO.Stream.Position
 
override WaveFormat WaveFormat [get]
 WaveStream.WaveFormat
 
- Properties inherited from NAudio.Wave.WaveStream
WaveFormat WaveFormat [get]
 Retrieves the WaveFormat for this stream.
 
override bool CanRead [get]
 We can read from this stream.
 
override bool CanSeek [get]
 We can seek within this stream.
 
override bool CanWrite [get]
 We can't write to this stream.
 
virtual int BlockAlign [get]
 The block alignment for this wavestream. Do not modify the Position to anything that is not a whole multiple of this value.
 
virtual TimeSpan CurrentTime [get, set]
 The current position in the stream in Time format.
 
virtual TimeSpan TotalTime [get]
 Total length in real-time of the stream (may be an estimate for compressed files)
 
- 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

readonly List< WaveStreaminputStreams
 
readonly object inputsLock
 
WaveFormat waveFormat
 
long length
 
long position
 
readonly int bytesPerSample
 

Detailed Description

WaveStream that can mix together multiple 32 bit input streams (Normally used with stereo input channels) All channels must have the same number of inputs.

Constructor & Destructor Documentation

◆ WaveMixerStream32() [1/2]

NAudio.Wave.WaveMixerStream32.WaveMixerStream32 ( )
inline

Creates a new 32 bit WaveMixerStream.

Here is the call graph for this function:

◆ WaveMixerStream32() [2/2]

NAudio.Wave.WaveMixerStream32.WaveMixerStream32 ( IEnumerable< WaveStream > inputStreams,
bool autoStop )
inline

Creates a new 32 bit WaveMixerStream.

Parameters
inputStreamsAn Array of WaveStreams - must all have the same format. Use WaveChannel is designed for this purpose.
autoStopAutomatically stop when all inputs have been read
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.WaveMixerStream32.AddInputStream ( WaveStream waveStream)
inline

Adds an input audio stream to the mixer.

Parameters
waveStreamThe WaveStream to be added to the mixer.
Exceptions
ArgumentExceptionThrown when the input WaveStream does not meet the required format specifications.

This method adds the input audio stream waveStream to the mixer. It performs format checks to ensure that the input stream meets the required specifications, such as being in IEEE floating point format and having 32-bit audio. If this is the first input stream being added, it sets the format for the mixer based on the input stream's properties. Subsequent input streams are checked to ensure that they match the format of the existing streams. The input stream is then added to the mixer, and its length is compared with the current length of the mixer, updating it if necessary. Finally, the position of the input stream is set to match the current position of the mixer.

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

◆ Dispose()

override void NAudio.Wave.WaveMixerStream32.Dispose ( bool disposing)
inlineprotected

Releases the unmanaged resources used by the WaveMixerStream32 and optionally releases the managed resources.

Parameters
disposingTrue to release both managed and unmanaged resources; false to release only unmanaged resources.

This method disposes the input streams if disposing is true, and asserts if disposing is false.

◆ Read()

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

Reads a specified number of bytes from the current stream into a byte array and advances the position within the stream by the number of bytes read.

Parameters
bufferAn array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
offsetThe zero-based byte offset in buffer at which to begin storing the data read from the current stream.
countThe maximum number of bytes to be read from the current stream.
Returns
The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream is reached before any data is read.
Exceptions
ArgumentExceptionThrown when count is not a whole number of samples.

Implements NAudio.Wave.IWaveProvider.

Here is the call graph for this function:

◆ RemoveInputStream()

void NAudio.Wave.WaveMixerStream32.RemoveInputStream ( WaveStream waveStream)
inline

Removes the specified WaveStream from the list of input streams and recalculates the total length of all input streams.

Parameters
waveStreamThe WaveStream to be removed from the list of input streams.

This method removes the specified waveStream from the list of input streams and recalculates the total length of all input streams. If the specified waveStream is successfully removed, the total length of all input streams is recalculated by finding the maximum length among all remaining input streams. The total length is then updated to the new calculated length.

◆ Sum32BitAudio()

static unsafe void NAudio.Wave.WaveMixerStream32.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 where the addition will start.
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 for performance reasons. The method calculates the number of samples to be read based on the number of bytes read and performs the addition for each sample.

Here is the caller graph for this function:

Member Data Documentation

◆ bytesPerSample

readonly int NAudio.Wave.WaveMixerStream32.bytesPerSample
private

◆ inputsLock

readonly object NAudio.Wave.WaveMixerStream32.inputsLock
private

◆ inputStreams

readonly List<WaveStream> NAudio.Wave.WaveMixerStream32.inputStreams
private

◆ length

long NAudio.Wave.WaveMixerStream32.length
private

◆ position

long NAudio.Wave.WaveMixerStream32.position
private

◆ waveFormat

WaveFormat NAudio.Wave.WaveMixerStream32.waveFormat
private

Property Documentation

◆ AutoStop

bool NAudio.Wave.WaveMixerStream32.AutoStop
getset

Automatically stop when all inputs have been read.

◆ BlockAlign

override int NAudio.Wave.WaveMixerStream32.BlockAlign
get

WaveStream.BlockAlign

◆ InputCount

int NAudio.Wave.WaveMixerStream32.InputCount
get

The number of inputs to this mixer.

◆ Length

override long NAudio.Wave.WaveMixerStream32.Length
get

Length of this Wave Stream (in bytes) System.IO.Stream.Length

◆ Position

override long NAudio.Wave.WaveMixerStream32.Position
getset

Position within this Wave Stream (in bytes) System.IO.Stream.Position

◆ WaveFormat

override WaveFormat NAudio.Wave.WaveMixerStream32.WaveFormat
get

WaveStream.WaveFormat

Implements NAudio.Wave.IWaveProvider.


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