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

A buffer of Wave samples for streaming to a Wave Output device. More...

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

Public Member Functions

 WaveOutBuffer (IntPtr hWaveOut, Int32 bufferSize, IWaveProvider bufferFillStream, object waveOutLock)
 creates a new wavebuffer
 
void Dispose ()
 Disposes of the managed and unmanaged resources used by the WaveOut device.
 
bool OnDone ()
 Reads data from the wave stream, writes it to the output, and returns a boolean value indicating whether the operation is successful.
 

Protected Member Functions

void Dispose (bool disposing)
 Releases resources held by this WaveBuffer.
 

Properties

bool InQueue [get]
 Whether the header's in queue flag is set.
 
int BufferSize [get]
 The buffer size in bytes.
 

Private Member Functions

 ~WaveOutBuffer ()
 Finalizer for this wave buffer.
 
void WriteToWaveOut ()
 Writes the audio data to the WaveOut device for playback.
 

Private Attributes

readonly WaveHeader header
 
readonly Int32 bufferSize
 
readonly byte[] buffer
 
readonly IWaveProvider waveStream
 
readonly object waveOutLock
 
GCHandle hBuffer
 
IntPtr hWaveOut
 
GCHandle hHeader
 
GCHandle hThis
 

Detailed Description

A buffer of Wave samples for streaming to a Wave Output device.

Constructor & Destructor Documentation

◆ WaveOutBuffer()

NAudio.Wave.WaveOutBuffer.WaveOutBuffer ( IntPtr hWaveOut,
Int32 bufferSize,
IWaveProvider bufferFillStream,
object waveOutLock )
inline

creates a new wavebuffer

Parameters
hWaveOutWaveOut device to write to
bufferSizeBuffer size in bytes
bufferFillStreamStream to provide more data
waveOutLockLock to protect WaveOut API's from being called on >1 thread
Here is the call graph for this function:

◆ ~WaveOutBuffer()

NAudio.Wave.WaveOutBuffer.~WaveOutBuffer ( )
inlineprivate

Finalizer for this wave buffer.

Here is the call graph for this function:

Member Function Documentation

◆ Dispose() [1/2]

void NAudio.Wave.WaveOutBuffer.Dispose ( )
inline

Disposes of the managed and unmanaged resources used by the WaveOut device.

Parameters
disposingA boolean value indicating whether to dispose of managed resources.

This method releases the managed resources if disposing is true. It also releases the unmanaged resources including the allocated headers and buffers used by the WaveOut device.

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

◆ Dispose() [2/2]

void NAudio.Wave.WaveOutBuffer.Dispose ( bool disposing)
inlineprotected

Releases resources held by this WaveBuffer.

Here is the call graph for this function:

◆ OnDone()

bool NAudio.Wave.WaveOutBuffer.OnDone ( )
inline

Reads data from the wave stream, writes it to the output, and returns a boolean value indicating whether the operation is successful.

Returns
True if data is successfully read and written to the output; otherwise, false.

This method locks the wave stream to read data into the buffer and then writes the data to the output. If no data is read from the wave stream, it returns false. The method also ensures that any remaining buffer space is filled with zeros before writing to the output.

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

◆ WriteToWaveOut()

void NAudio.Wave.WaveOutBuffer.WriteToWaveOut ( )
inlineprivate

Writes the audio data to the WaveOut device for playback.

This method writes the audio data to the WaveOut device for playback. It locks the waveOutLock to ensure thread safety and then calls the WaveInterop.waveOutWrite method to write the audio data to the device using the specified header . If an error occurs during the write operation, a MmException is thrown with details about the specific error. After writing the data, this method ensures that the current object is kept alive by calling GC.KeepAlive to prevent premature garbage collection.

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

Member Data Documentation

◆ buffer

readonly byte [] NAudio.Wave.WaveOutBuffer.buffer
private

◆ bufferSize

readonly Int32 NAudio.Wave.WaveOutBuffer.bufferSize
private

◆ hBuffer

GCHandle NAudio.Wave.WaveOutBuffer.hBuffer
private

◆ header

readonly WaveHeader NAudio.Wave.WaveOutBuffer.header
private

◆ hHeader

GCHandle NAudio.Wave.WaveOutBuffer.hHeader
private

◆ hThis

GCHandle NAudio.Wave.WaveOutBuffer.hThis
private

◆ hWaveOut

IntPtr NAudio.Wave.WaveOutBuffer.hWaveOut
private

◆ waveOutLock

readonly object NAudio.Wave.WaveOutBuffer.waveOutLock
private

◆ waveStream

readonly IWaveProvider NAudio.Wave.WaveOutBuffer.waveStream
private

Property Documentation

◆ BufferSize

int NAudio.Wave.WaveOutBuffer.BufferSize
get

The buffer size in bytes.

◆ InQueue

bool NAudio.Wave.WaveOutBuffer.InQueue
get

Whether the header's in queue flag is set.


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