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

WaveStream that passes through an ACM Codec. More...

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

Public Member Functions

 WaveFormatConversionStream (WaveFormat targetFormat, WaveStream sourceStream)
 Create a new WaveFormat conversion stream.
 
int SourceToDest (int source)
 Estimates the destination value from the given source value.
 
int DestToSource (int dest)
 Converts the destination value to the source value using the EstimateDestToSource method and returns the result.
 
override int Read (byte[] buffer, int offset, int count)
 Reads a sequence of bytes from the current stream 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.
 

Static Public Member Functions

static WaveStream CreatePcmStream (WaveStream sourceStream)
 Creates a PCM stream from the given source stream.
 

Protected Member Functions

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

Properties

override long Position [get, set]
 Gets or sets the current position in the stream.
 
override long Length [get]
 Returns the stream length.
 
override WaveFormat WaveFormat [get]
 Gets the WaveFormat of this stream.
 
- 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

long EstimateSourceToDest (long source)
 Estimates the destination position based on the source position.
 
long EstimateDestToSource (long dest)
 Estimates the source position corresponding to the given destination position.
 

Private Attributes

readonly WaveFormatConversionProvider conversionProvider
 
readonly WaveFormat targetFormat
 
readonly long length
 
long position
 
readonly WaveStream sourceStream
 
bool isDisposed
 

Detailed Description

WaveStream that passes through an ACM Codec.

Constructor & Destructor Documentation

◆ WaveFormatConversionStream()

NAudio.Wave.WaveFormatConversionStream.WaveFormatConversionStream ( WaveFormat targetFormat,
WaveStream sourceStream )
inline

Create a new WaveFormat conversion stream.

Parameters
targetFormatDesired output format
sourceStreamSource stream
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ CreatePcmStream()

static WaveStream NAudio.Wave.WaveFormatConversionStream.CreatePcmStream ( WaveStream sourceStream)
inlinestatic

Creates a PCM stream from the given source stream.

Parameters
sourceStreamThe input wave stream.
Returns
A PCM stream converted from the sourceStream .
Exceptions
InvalidOperationExceptionThrown when the suggested output format is invalid and no target format is explicitly provided.
Here is the call graph for this function:

◆ DestToSource()

int NAudio.Wave.WaveFormatConversionStream.DestToSource ( int dest)
inline

Converts the destination value to the source value using the EstimateDestToSource method and returns the result.

Parameters
destThe destination value to be converted to the source value.
Returns
The converted source value from the given dest .
Exceptions
ObsoleteExceptionThis method is obsolete and can be unreliable. Use of this method is not encouraged.
Here is the call graph for this function:

◆ Dispose()

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

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

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Exceptions
ObjectDisposedExceptionThrown if the WaveFormatConversionStream has already been disposed.

This method releases the unmanaged resources used by the WaveFormatConversionStream and optionally releases the managed resources. If disposing is true, this method disposes the sourceStream and conversionProvider. If disposing is false, this method checks if the WaveFormatConversionStream has already been disposed and asserts if not.

Here is the call graph for this function:

◆ EstimateDestToSource()

long NAudio.Wave.WaveFormatConversionStream.EstimateDestToSource ( long dest)
inlineprivate

Estimates the source position corresponding to the given destination position.

Parameters
destThe destination position for which the corresponding source position needs to be estimated.
Returns
The estimated source position corresponding to the given destination position.
Here is the caller graph for this function:

◆ EstimateSourceToDest()

long NAudio.Wave.WaveFormatConversionStream.EstimateSourceToDest ( long source)
inlineprivate

Estimates the destination position based on the source position.

Parameters
sourceThe source position for estimation.
Returns
The estimated destination position based on the source position.
Here is the caller graph for this function:

◆ Read()

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

Reads a sequence of bytes from the current stream 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 bytes are read.

Implements NAudio.Wave.IWaveProvider.

Here is the call graph for this function:

◆ SourceToDest()

int NAudio.Wave.WaveFormatConversionStream.SourceToDest ( int source)
inline

Estimates the destination value from the given source value.

Parameters
sourceThe source value for estimation.
Returns
The estimated destination value based on the given source .

This method is marked as obsolete and can be unreliable. It is not encouraged to use this method.

Here is the call graph for this function:

Member Data Documentation

◆ conversionProvider

readonly WaveFormatConversionProvider NAudio.Wave.WaveFormatConversionStream.conversionProvider
private

◆ isDisposed

bool NAudio.Wave.WaveFormatConversionStream.isDisposed
private

◆ length

readonly long NAudio.Wave.WaveFormatConversionStream.length
private

◆ position

long NAudio.Wave.WaveFormatConversionStream.position
private

◆ sourceStream

readonly WaveStream NAudio.Wave.WaveFormatConversionStream.sourceStream
private

◆ targetFormat

readonly WaveFormat NAudio.Wave.WaveFormatConversionStream.targetFormat
private

Property Documentation

◆ Length

override long NAudio.Wave.WaveFormatConversionStream.Length
get

Returns the stream length.

◆ Position

override long NAudio.Wave.WaveFormatConversionStream.Position
getset

Gets or sets the current position in the stream.

◆ WaveFormat

override WaveFormat NAudio.Wave.WaveFormatConversionStream.WaveFormat
get

Gets the WaveFormat of this stream.

Implements NAudio.Wave.IWaveProvider.


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