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

Broadcast WAVE File Writer. More...

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

Public Member Functions

 BwfWriter (string filename, WaveFormat format, BextChunkInfo bextChunkInfo)
 Createa a new BwfWriter.
 
void Write (byte[] buffer, int offset, int count)
 Writes a specified number of bytes from a byte array to the current stream at the specified position.
 
void Flush ()
 Flushes the underlying writer and ensures the WAV file is always playable after the flush operation.
 
void Dispose ()
 Disposes of the current object and releases any resources it is using.
 

Private Member Functions

void FixUpChunkSizes (bool restorePosition)
 Fixes up the chunk sizes in the WAV file.
 

Static Private Member Functions

static byte[] GetAsBytes (string message, int byteSize)
 Converts the input string to a byte array of the specified size and returns the result.
 

Private Attributes

readonly WaveFormat format
 
readonly BinaryWriter writer
 
readonly long dataChunkSizePosition
 
long dataLength
 
bool isDisposed
 

Detailed Description

Broadcast WAVE File Writer.

Constructor & Destructor Documentation

◆ BwfWriter()

NAudio.Wave.BwfWriter.BwfWriter ( string filename,
WaveFormat format,
BextChunkInfo bextChunkInfo )
inline

Createa a new BwfWriter.

Parameters
filenameRarget filename
formatWaveFormat
bextChunkInfoChunk information
Here is the call graph for this function:

Member Function Documentation

◆ Dispose()

void NAudio.Wave.BwfWriter.Dispose ( )
inline

Disposes of the current object and releases any resources it is using.

This method checks if the object has already been disposed. If not, it calls the FixUpChunkSizes method with the parameter false to perform any necessary cleanup. It then disposes of the internal writer and sets the isDisposed flag to true.

Here is the call graph for this function:

◆ FixUpChunkSizes()

void NAudio.Wave.BwfWriter.FixUpChunkSizes ( bool restorePosition)
inlineprivate

Fixes up the chunk sizes in the WAV file.

Parameters
restorePositionA boolean value indicating whether to restore the position of the writer after fixing up the chunk sizes.

This method adjusts the chunk sizes in the WAV file based on the data length and format. If the data length exceeds Int32.MaxValue, it updates the RIFF and data chunk sizes for RF64 format. Otherwise, it updates the RIFF and data chunk sizes for standard WAV format. The method also handles restoring the position of the writer if specified.

Here is the caller graph for this function:

◆ Flush()

void NAudio.Wave.BwfWriter.Flush ( )
inline

Flushes the underlying writer and ensures the WAV file is always playable after the flush operation.

Exceptions
ObjectDisposedExceptionThrown if the BWF Writer has already been disposed.
Here is the call graph for this function:

◆ GetAsBytes()

static byte[] NAudio.Wave.BwfWriter.GetAsBytes ( string message,
int byteSize )
inlinestaticprivate

Converts the input string to a byte array of the specified size and returns the result.

Parameters
messageThe input string to be converted to a byte array.
byteSizeThe size of the byte array to be generated.
Returns
A byte array representing the input string, with a length of byteSize . If the input string is shorter than byteSize , the remaining bytes are filled with zeros.

This method creates a new byte array of size byteSize and then encodes the input string using ASCII encoding. The encoded bytes are then copied to the output buffer, and if the length of the encoded bytes is less than byteSize , the remaining bytes in the output buffer are filled with zeros.

Here is the caller graph for this function:

◆ Write()

void NAudio.Wave.BwfWriter.Write ( byte[] buffer,
int offset,
int count )
inline

Writes a specified number of bytes from a byte array to the current stream at the specified position.

Parameters
bufferThe byte array containing the data to write.
offsetThe zero-based byte offset in buffer at which to begin copying bytes to the current stream.
countThe number of bytes to be written to the current stream.
Exceptions
ObjectDisposedExceptionThrown if the BWF Writer has already been disposed.

This method writes the specified number of bytes from the given byte array to the current stream at the specified position. It also updates the data length by adding the count of bytes written to the current stream.

Member Data Documentation

◆ dataChunkSizePosition

readonly long NAudio.Wave.BwfWriter.dataChunkSizePosition
private

◆ dataLength

long NAudio.Wave.BwfWriter.dataLength
private

◆ format

readonly WaveFormat NAudio.Wave.BwfWriter.format
private

◆ isDisposed

bool NAudio.Wave.BwfWriter.isDisposed
private

◆ writer

readonly BinaryWriter NAudio.Wave.BwfWriter.writer
private

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