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

WaveBuffer class use to store wave datas. Data can be manipulated with arrays (ByteBuffer,FloatBuffer,ShortBuffer,IntBuffer ) that are pointing to the same memory buffer. Use the associated Count property based on the type of buffer to get the number of data in the buffer. Implicit casting is now supported to float[], byte[], int[], short[]. You must not use Length on returned arrays. More...

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

Public Member Functions

 WaveBuffer (int sizeToAllocateInBytes)
 Initializes a new instance of the WaveBuffer class.
 
 WaveBuffer (byte[] bufferToBoundTo)
 Initializes a new instance of the WaveBuffer class binded to a specific byte buffer.
 
void BindTo (byte[] bufferToBoundTo)
 Binds the provided byte array to the WaveBuffer instance.
 
void Clear ()
 Clears the byte buffer by setting all elements to zero.
 
void Copy (Array destinationArray)
 Copies the elements of the current one-dimensional array to another one-dimensional array.
 

Static Public Member Functions

static implicit operator byte[] (WaveBuffer waveBuffer)
 Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Byte.
 
static implicit operator float[] (WaveBuffer waveBuffer)
 Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Single.
 
static implicit operator int[] (WaveBuffer waveBuffer)
 Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Int32.
 
static implicit operator short[] (WaveBuffer waveBuffer)
 Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Int16.
 

Public Attributes

int numberOfBytes
 Number of Bytes.
 

Properties

byte[] ByteBuffer [get]
 Gets the byte buffer.
 
float[] FloatBuffer [get]
 Gets the float buffer.
 
short[] ShortBuffer [get]
 Gets the short buffer.
 
int[] IntBuffer [get]
 Gets the int buffer.
 
int MaxSize [get]
 Gets the max size in bytes of the byte buffer..
 
int ByteBufferCount [get, set]
 Gets or sets the byte buffer count.
 
int FloatBufferCount [get, set]
 Gets or sets the float buffer count.
 
int ShortBufferCount [get, set]
 Gets or sets the short buffer count.
 
int IntBufferCount [get, set]
 Gets or sets the int buffer count.
 
- Properties inherited from NAudio.Wave.IWaveBuffer

Private Member Functions

int CheckValidityCount (string argName, int value, int sizeOfValue)
 Checks the validity of the count and returns the new number of bytes.
 

Private Attributes

byte[] byteBuffer
 
float[] floatBuffer
 
short[] shortBuffer
 
int[] intBuffer
 

Detailed Description

WaveBuffer class use to store wave datas. Data can be manipulated with arrays (ByteBuffer,FloatBuffer,ShortBuffer,IntBuffer ) that are pointing to the same memory buffer. Use the associated Count property based on the type of buffer to get the number of data in the buffer. Implicit casting is now supported to float[], byte[], int[], short[]. You must not use Length on returned arrays.

n.b. FieldOffset is 8 now to allow it to work natively on 64 bit

Constructor & Destructor Documentation

◆ WaveBuffer() [1/2]

NAudio.Wave.WaveBuffer.WaveBuffer ( int sizeToAllocateInBytes)
inline

Initializes a new instance of the WaveBuffer class.

Parameters
sizeToAllocateInBytesThe number of bytes. The size of the final buffer will be aligned on 4 Bytes (upper bound)

◆ WaveBuffer() [2/2]

NAudio.Wave.WaveBuffer.WaveBuffer ( byte[] bufferToBoundTo)
inline

Initializes a new instance of the WaveBuffer class binded to a specific byte buffer.

Parameters
bufferToBoundToA byte buffer to bound the WaveBuffer to.
Here is the call graph for this function:

Member Function Documentation

◆ BindTo()

void NAudio.Wave.WaveBuffer.BindTo ( byte[] bufferToBoundTo)
inline

Binds the provided byte array to the WaveBuffer instance.

Parameters
bufferToBoundToThe byte array to be bound to the WaveBuffer.

This method binds the provided byte array bufferToBoundTo to the WaveBuffer instance. If the length of the byte array is not a multiple of 4, an ArgumentException is thrown.

Here is the caller graph for this function:

◆ CheckValidityCount()

int NAudio.Wave.WaveBuffer.CheckValidityCount ( string argName,
int value,
int sizeOfValue )
inlineprivate

Checks the validity of the count and returns the new number of bytes.

Parameters
argNameThe name of the argument being checked.
valueThe value to be checked.
sizeOfValueThe size of the value.
Exceptions
ArgumentOutOfRangeExceptionThrown when the count is not 4 bytes aligned or exceeds the maximum count.
Returns
The new number of bytes calculated based on the input value and sizeOfValue .

This method calculates the new number of bytes based on the input value and sizeOfValue . It checks if the new number of bytes is 4 bytes aligned and within the valid range, throwing an exception if not.

◆ Clear()

void NAudio.Wave.WaveBuffer.Clear ( )
inline

Clears the byte buffer by setting all elements to zero.

This method clears the byte buffer by setting all elements to zero using the Array.Clear method.

◆ Copy()

void NAudio.Wave.WaveBuffer.Copy ( Array destinationArray)
inline

Copies the elements of the current one-dimensional array to another one-dimensional array.

Parameters
destinationArrayThe one-dimensional array that is the destination of the elements copied from the current array.
Exceptions
ArgumentNullExceptionThrown when the destinationArray is null.
RankExceptionThrown when the number of dimensions in the source Array is not equal to the number of dimensions in the destination array.

◆ operator byte[]()

static implicit NAudio.Wave.WaveBuffer.operator byte[] ( WaveBuffer waveBuffer)
inlinestatic

Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Byte.

Parameters
waveBufferThe wave buffer.
Returns
The result of the conversion.

◆ operator float[]()

static implicit NAudio.Wave.WaveBuffer.operator float[] ( WaveBuffer waveBuffer)
inlinestatic

Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Single.

Parameters
waveBufferThe wave buffer.
Returns
The result of the conversion.

◆ operator int[]()

static implicit NAudio.Wave.WaveBuffer.operator int[] ( WaveBuffer waveBuffer)
inlinestatic

Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Int32.

Parameters
waveBufferThe wave buffer.
Returns
The result of the conversion.

◆ operator short[]()

static implicit NAudio.Wave.WaveBuffer.operator short[] ( WaveBuffer waveBuffer)
inlinestatic

Performs an implicit conversion from NAudio.Wave.WaveBuffer to System.Int16.

Parameters
waveBufferThe wave buffer.
Returns
The result of the conversion.

Member Data Documentation

◆ byteBuffer

byte [] NAudio.Wave.WaveBuffer.byteBuffer
private

◆ floatBuffer

float [] NAudio.Wave.WaveBuffer.floatBuffer
private

◆ intBuffer

int [] NAudio.Wave.WaveBuffer.intBuffer
private

◆ numberOfBytes

int NAudio.Wave.WaveBuffer.numberOfBytes

Number of Bytes.

◆ shortBuffer

short [] NAudio.Wave.WaveBuffer.shortBuffer
private

Property Documentation

◆ ByteBuffer

byte [] NAudio.Wave.WaveBuffer.ByteBuffer
get

Gets the byte buffer.

The byte buffer.

Implements NAudio.Wave.IWaveBuffer.

◆ ByteBufferCount

int NAudio.Wave.WaveBuffer.ByteBufferCount
getset

Gets or sets the byte buffer count.

The byte buffer count.

Implements NAudio.Wave.IWaveBuffer.

◆ FloatBuffer

float [] NAudio.Wave.WaveBuffer.FloatBuffer
get

Gets the float buffer.

The float buffer.

Implements NAudio.Wave.IWaveBuffer.

◆ FloatBufferCount

int NAudio.Wave.WaveBuffer.FloatBufferCount
getset

Gets or sets the float buffer count.

The float buffer count.

Implements NAudio.Wave.IWaveBuffer.

◆ IntBuffer

int [] NAudio.Wave.WaveBuffer.IntBuffer
get

Gets the int buffer.

The int buffer.

Implements NAudio.Wave.IWaveBuffer.

◆ IntBufferCount

int NAudio.Wave.WaveBuffer.IntBufferCount
getset

Gets or sets the int buffer count.

The int buffer count.

Implements NAudio.Wave.IWaveBuffer.

◆ MaxSize

int NAudio.Wave.WaveBuffer.MaxSize
get

Gets the max size in bytes of the byte buffer..

Maximum number of bytes in the buffer.

Implements NAudio.Wave.IWaveBuffer.

◆ ShortBuffer

short [] NAudio.Wave.WaveBuffer.ShortBuffer
get

Gets the short buffer.

The short buffer.

Implements NAudio.Wave.IWaveBuffer.

◆ ShortBufferCount

int NAudio.Wave.WaveBuffer.ShortBufferCount
getset

Gets or sets the short buffer count.

The short buffer count.

Implements NAudio.Wave.IWaveBuffer.


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