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

Represents Channel for the WaveMixerStream 32 bit output and 16 bit input It's output is always stereo The input stream can be panned. More...

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

Public Member Functions

 WaveChannel32 (WaveStream sourceStream, float volume, float pan)
 Creates a new WaveChannel32.
 
 WaveChannel32 (WaveStream sourceStream)
 Creates a WaveChannel32 with default settings.
 
override int Read (byte[] destBuffer, int offset, int numBytes)
 Reads audio data from the source stream and writes it to the destination buffer.
 
override bool HasData (int count)
 Checks if the source stream has data available based on the specified count.
 
- 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.
 

Protected Member Functions

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

Properties

override int BlockAlign [get]
 Gets the block alignment for this WaveStream.
 
override long Length [get]
 Returns the stream length.
 
override long Position [get, set]
 Gets or sets the current position in the stream.
 
bool PadWithZeroes [get, set]
 If true, Read always returns the number of bytes requested.
 
override WaveFormat WaveFormat [get]
 WaveStream.WaveFormat
 
float Volume [get, set]
 Volume of this channel. 1.0 = full scale.
 
float Pan [get, set]
 Pan of this channel (from -1 to 1)
 
- 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

Events

EventHandler< SampleEventArgsSample
 Sample.
 
- Events inherited from NAudio.Wave.ISampleNotifier
EventHandler< SampleEventArgsSample
 A sample has been detected.
 

Private Member Functions

long SourceToDest (long sourceBytes)
 Converts the size of the source bytes to the size of the destination bytes based on the sample sizes and returns the result.
 
long DestToSource (long destBytes)
 Converts the destination bytes to source bytes based on the sample sizes and returns the result.
 
void RaiseSample (float left, float right)
 Raises the Sample event with the specified left and right values.
 

Private Attributes

WaveStream sourceStream
 
readonly WaveFormat waveFormat
 
readonly long length
 
readonly int destBytesPerSample
 
readonly int sourceBytesPerSample
 
volatile float volume
 
volatile float pan
 
long position
 
readonly ISampleChunkConverter sampleProvider
 
readonly object lockObject = new object()
 
SampleEventArgs sampleEventArgs = new SampleEventArgs(0,0)
 

Detailed Description

Represents Channel for the WaveMixerStream 32 bit output and 16 bit input It's output is always stereo The input stream can be panned.

Constructor & Destructor Documentation

◆ WaveChannel32() [1/2]

NAudio.Wave.WaveChannel32.WaveChannel32 ( WaveStream sourceStream,
float volume,
float pan )
inline

Creates a new WaveChannel32.

Parameters
sourceStreamthe source stream
volumestream volume (1 is 0dB)
panpan control (-1 to 1)
Here is the call graph for this function:

◆ WaveChannel32() [2/2]

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

Creates a WaveChannel32 with default settings.

Parameters
sourceStreamThe source stream

Member Function Documentation

◆ DestToSource()

long NAudio.Wave.WaveChannel32.DestToSource ( long destBytes)
inlineprivate

Converts the destination bytes to source bytes based on the sample sizes and returns the result.

Parameters
destBytesThe number of destination bytes to be converted.
Returns
The equivalent number of source bytes calculated based on the sample sizes.

◆ Dispose()

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

Releases the unmanaged resources used by the WaveChannel32 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 WaveChannel32 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, this method asserts that the WaveChannel32 was not disposed.

◆ HasData()

override bool NAudio.Wave.WaveChannel32.HasData ( int count)
inlinevirtual

Checks if the source stream has data available based on the specified count.

Parameters
countThe number of bytes to check for availability.
Returns
True if the source stream has data available for the specified count; otherwise, false.

This method checks whether the source stream has data available based on the specified count. It first checks if the source stream has data, and then verifies if the position plus count is not less than 0. If both conditions are met, it returns true if the position is less than the length and the volume is not equal to 0; otherwise, it returns false.

Reimplemented from NAudio.Wave.WaveStream.

Here is the call graph for this function:

◆ RaiseSample()

void NAudio.Wave.WaveChannel32.RaiseSample ( float left,
float right )
inlineprivate

Raises the Sample event with the specified left and right values.

Parameters
leftThe left value to be raised.
rightThe right value to be raised.

This method raises the Sample event with the specified left and right values by updating the SampleEventArgs instance and invoking the event.

Here is the caller graph for this function:

◆ Read()

override int NAudio.Wave.WaveChannel32.Read ( byte[] destBuffer,
int offset,
int numBytes )
inline

Reads audio data from the source stream and writes it to the destination buffer.

Parameters
destBufferThe destination buffer to write the audio data to.
offsetThe offset in the destination buffer at which to start writing the audio data.
numBytesThe number of bytes of audio data to read and write to the destination buffer.
Returns
The number of bytes written to the destination buffer.

This method reads audio data from the source stream and writes it to the destination buffer. It first fills with silence if the position is less than 0, then loads the next chunk of audio data from the source stream and writes it to the destination buffer. It implements panning laws and adjusts the volume of the audio data. If PadWithZeroes is true, it fills out the remaining space in the destination buffer with zeroes. The position is updated by the number of bytes written to the destination buffer.

Implements NAudio.Wave.IWaveProvider.

Here is the call graph for this function:

◆ SourceToDest()

long NAudio.Wave.WaveChannel32.SourceToDest ( long sourceBytes)
inlineprivate

Converts the size of the source bytes to the size of the destination bytes based on the sample sizes and returns the result.

Parameters
sourceBytesThe size of the source bytes to be converted.
Returns
The size of the destination bytes calculated based on the sample sizes.
Here is the caller graph for this function:

Member Data Documentation

◆ destBytesPerSample

readonly int NAudio.Wave.WaveChannel32.destBytesPerSample
private

◆ length

readonly long NAudio.Wave.WaveChannel32.length
private

◆ lockObject

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

◆ pan

volatile float NAudio.Wave.WaveChannel32.pan
private

◆ position

long NAudio.Wave.WaveChannel32.position
private

◆ sampleEventArgs

SampleEventArgs NAudio.Wave.WaveChannel32.sampleEventArgs = new SampleEventArgs(0,0)
private

◆ sampleProvider

readonly ISampleChunkConverter NAudio.Wave.WaveChannel32.sampleProvider
private

◆ sourceBytesPerSample

readonly int NAudio.Wave.WaveChannel32.sourceBytesPerSample
private

◆ sourceStream

WaveStream NAudio.Wave.WaveChannel32.sourceStream
private

◆ volume

volatile float NAudio.Wave.WaveChannel32.volume
private

◆ waveFormat

readonly WaveFormat NAudio.Wave.WaveChannel32.waveFormat
private

Property Documentation

◆ BlockAlign

override int NAudio.Wave.WaveChannel32.BlockAlign
get

Gets the block alignment for this WaveStream.

◆ Length

override long NAudio.Wave.WaveChannel32.Length
get

Returns the stream length.

◆ PadWithZeroes

bool NAudio.Wave.WaveChannel32.PadWithZeroes
getset

If true, Read always returns the number of bytes requested.

◆ Pan

float NAudio.Wave.WaveChannel32.Pan
getset

Pan of this channel (from -1 to 1)

◆ Position

override long NAudio.Wave.WaveChannel32.Position
getset

Gets or sets the current position in the stream.

◆ Volume

float NAudio.Wave.WaveChannel32.Volume
getset

Volume of this channel. 1.0 = full scale.

◆ WaveFormat

override WaveFormat NAudio.Wave.WaveChannel32.WaveFormat
get

WaveStream.WaveFormat

Implements NAudio.Wave.IWaveProvider.

Event Documentation

◆ Sample

EventHandler<SampleEventArgs> NAudio.Wave.WaveChannel32.Sample

Sample.


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