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

Helper stream that lets us read from compressed audio files with large block alignment as though we could read any amount and reposition anywhere. More...

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

Public Member Functions

 BlockAlignReductionStream (WaveStream sourceStream)
 Creates a new BlockAlignReductionStream.
 
override int Read (byte[] buffer, int offset, int count)
 Reads a specified number of bytes from the circular buffer into the provided byte array, starting at the specified offset.
 
- 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 BlockAlignReductionStream and optionally releases the managed resources.
 

Properties

override int BlockAlign [get]
 Block alignment of this stream.
 
override WaveFormat WaveFormat [get]
 Wave Format.
 
override long Length [get]
 Length of this Stream.
 
override long Position [get, set]
 Current position within stream.
 
long BufferEndPosition [get]
 
- 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

Private Member Functions

byte[] GetSourceBuffer (int size)
 Returns the source buffer of the specified size, creating a new buffer if necessary.
 

Private Attributes

WaveStream sourceStream
 
long position
 
readonly CircularBuffer circularBuffer
 
long bufferStartPosition
 
byte[] sourceBuffer
 
readonly object lockObject = new object()
 

Detailed Description

Helper stream that lets us read from compressed audio files with large block alignment as though we could read any amount and reposition anywhere.

Constructor & Destructor Documentation

◆ BlockAlignReductionStream()

NAudio.Wave.BlockAlignReductionStream.BlockAlignReductionStream ( WaveStream sourceStream)
inline

Creates a new BlockAlignReductionStream.

Parameters
sourceStreamthe input stream

Member Function Documentation

◆ Dispose()

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

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

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

This method releases the unmanaged resources used by the BlockAlignReductionStream and optionally releases the managed resources. If disposing is true, this method disposes of the sourceStream if it is not null. If disposing is false, it asserts that the BlockAlignReductionStream was not disposed.

◆ GetSourceBuffer()

byte[] NAudio.Wave.BlockAlignReductionStream.GetSourceBuffer ( int size)
inlineprivate

Returns the source buffer of the specified size, creating a new buffer if necessary.

Parameters
sizeThe size of the buffer to be retrieved.
Returns
The source buffer of at least the specified size .

If the existing source buffer is null or smaller than the specified size, a new buffer of double the size is created to accommodate the request.

Here is the caller graph for this function:

◆ Read()

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

Reads a specified number of bytes from the circular buffer into the provided byte array, starting at the specified offset.

Parameters
bufferThe byte array to which the data will be read.
offsetThe zero-based byte offset in buffer at which to begin storing the data read from the circular buffer.
countThe maximum number of bytes to read from the circular buffer.
Returns
The total number of bytes read into the buffer.

This method attempts to fill the circular buffer with enough data to meet the request. It then discards any unnecessary data from the start of the buffer and returns the specified number of bytes into the provided array.

Implements NAudio.Wave.IWaveProvider.

Here is the call graph for this function:

Member Data Documentation

◆ bufferStartPosition

long NAudio.Wave.BlockAlignReductionStream.bufferStartPosition
private

◆ circularBuffer

readonly CircularBuffer NAudio.Wave.BlockAlignReductionStream.circularBuffer
private

◆ lockObject

readonly object NAudio.Wave.BlockAlignReductionStream.lockObject = new object()
private

◆ position

long NAudio.Wave.BlockAlignReductionStream.position
private

◆ sourceBuffer

byte [] NAudio.Wave.BlockAlignReductionStream.sourceBuffer
private

◆ sourceStream

WaveStream NAudio.Wave.BlockAlignReductionStream.sourceStream
private

Property Documentation

◆ BlockAlign

override int NAudio.Wave.BlockAlignReductionStream.BlockAlign
get

Block alignment of this stream.

◆ BufferEndPosition

long NAudio.Wave.BlockAlignReductionStream.BufferEndPosition
getprivate

◆ Length

override long NAudio.Wave.BlockAlignReductionStream.Length
get

Length of this Stream.

◆ Position

override long NAudio.Wave.BlockAlignReductionStream.Position
getset

Current position within stream.

◆ WaveFormat

override WaveFormat NAudio.Wave.BlockAlignReductionStream.WaveFormat
get

Wave Format.

Implements NAudio.Wave.IWaveProvider.


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