WaveStream that converts 32 bit audio back down to 16 bit, clipping if necessary.
More...
|
| Wave32To16Stream (WaveStream sourceStream) |
| Creates a new Wave32To16Stream.
|
|
override int | Read (byte[] destBuffer, int offset, int numBytes) |
| Reads data from the source stream, converts it to 16-bit and writes it to the destination buffer.
|
|
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.
|
|
|
override void | Dispose (bool disposing) |
| Releases the unmanaged resources used by the ClassName and optionally releases the managed resources.
|
|
|
float | Volume [get, set] |
| Sets the volume for this stream. 1.0f is full scale.
|
|
override int | BlockAlign [get] |
| WaveStream.BlockAlign
|
|
override long | Length [get] |
| Returns the stream length.
|
|
override long | Position [get, set] |
| Gets or sets the current position in the stream.
|
|
override WaveFormat | WaveFormat [get] |
| WaveStream.WaveFormat
|
|
bool | Clip [get, set] |
| Clip indicator. Can be reset.
|
|
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)
|
|
|
unsafe void | Convert32To16 (byte[] destBuffer, int offset, byte[] source, int bytesRead) |
| Converts 32-bit audio samples to 16-bit audio samples and writes the result to the destination buffer.
|
|
WaveStream that converts 32 bit audio back down to 16 bit, clipping if necessary.
◆ Wave32To16Stream()
NAudio.Wave.Wave32To16Stream.Wave32To16Stream |
( |
WaveStream | sourceStream | ) |
|
|
inline |
Creates a new Wave32To16Stream.
- Parameters
-
sourceStream | the source stream |
◆ Convert32To16()
unsafe void NAudio.Wave.Wave32To16Stream.Convert32To16 |
( |
byte[] | destBuffer, |
|
|
int | offset, |
|
|
byte[] | source, |
|
|
int | bytesRead ) |
|
inlineprivate |
Converts 32-bit audio samples to 16-bit audio samples and writes the result to the destination buffer.
- Parameters
-
destBuffer | The destination buffer to write the 16-bit audio samples to. |
offset | The offset in the destination buffer to start writing the samples. |
source | The source buffer containing the 32-bit audio samples. |
bytesRead | The number of bytes read from the source buffer. |
This method converts the 32-bit audio samples in the source buffer to 16-bit audio samples and writes the result to the destination buffer. It also applies volume scaling and handles clipping if the sample value exceeds the range of a 16-bit integer. The method uses unsafe code to work with pointers for better performance.
◆ Dispose()
override void NAudio.Wave.Wave32To16Stream.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotected |
Releases the unmanaged resources used by the ClassName and optionally releases the managed resources.
- Parameters
-
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
This method releases the unmanaged resources used by the ClassName and optionally releases the managed resources. If disposing is true, this method releases all resources held by any managed objects that this ClassName references. This method is called by the public Dispose() method and the Finalize method.
◆ Read()
override int NAudio.Wave.Wave32To16Stream.Read |
( |
byte[] | destBuffer, |
|
|
int | offset, |
|
|
int | numBytes ) |
|
inline |
Reads data from the source stream, converts it to 16-bit and writes it to the destination buffer.
- Parameters
-
destBuffer | The destination buffer where the converted data will be written. |
offset | The zero-based byte offset in destBuffer at which to begin storing the data. |
numBytes | The maximum number of bytes to read from the source stream. |
- Returns
- The actual number of 16-bit words read into destBuffer .
- Exceptions
-
System.IO.IOException | An I/O error occurs while reading from the source stream. |
Implements NAudio.Wave.IWaveProvider.
◆ clip
bool NAudio.Wave.Wave32To16Stream.clip |
|
private |
◆ length
readonly long NAudio.Wave.Wave32To16Stream.length |
|
private |
◆ lockObject
readonly object NAudio.Wave.Wave32To16Stream.lockObject = new object() |
|
private |
◆ position
long NAudio.Wave.Wave32To16Stream.position |
|
private |
◆ sourceBuffer
byte [] NAudio.Wave.Wave32To16Stream.sourceBuffer |
|
private |
The Read method reuses the same buffer to prevent unnecessary allocations.
◆ sourceStream
WaveStream NAudio.Wave.Wave32To16Stream.sourceStream |
|
private |
◆ volume
float NAudio.Wave.Wave32To16Stream.volume |
|
private |
◆ waveFormat
readonly WaveFormat NAudio.Wave.Wave32To16Stream.waveFormat |
|
private |
◆ BlockAlign
override int NAudio.Wave.Wave32To16Stream.BlockAlign |
|
get |
◆ Clip
bool NAudio.Wave.Wave32To16Stream.Clip |
|
getset |
Clip indicator. Can be reset.
◆ Length
override long NAudio.Wave.Wave32To16Stream.Length |
|
get |
Returns the stream length.
◆ Position
override long NAudio.Wave.Wave32To16Stream.Position |
|
getset |
Gets or sets the current position in the stream.
◆ Volume
float NAudio.Wave.Wave32To16Stream.Volume |
|
getset |
Sets the volume for this stream. 1.0f is full scale.
◆ WaveFormat
override WaveFormat NAudio.Wave.Wave32To16Stream.WaveFormat |
|
get |
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Core/Wave/WaveStreams/Wave32To16Stream.cs