Wave Stream for converting between sample rates.
More...
|
| ResamplerDmoStream (IWaveProvider inputProvider, WaveFormat outputFormat) |
| WaveStream to resample using the DMO Resampler.
|
|
override int | Read (byte[] buffer, int offset, int count) |
| Reads a specified number of bytes from the input stream and writes them to the 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 T:System.Media.DmoResampler and optionally releases the managed resources.
|
|
|
override WaveFormat | WaveFormat [get] |
| Stream Wave Format.
|
|
override long | Length [get] |
| Stream length in bytes.
|
|
override long | Position [get, set] |
| Stream position in bytes.
|
|
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)
|
|
|
long | InputToOutputPosition (long inputPosition) |
| Converts the input position to the corresponding output position based on the ratio of average bytes per second between input and output formats.
|
|
long | OutputToInputPosition (long outputPosition) |
| Converts the output position to the corresponding input position based on the audio format ratios.
|
|
Wave Stream for converting between sample rates.
◆ ResamplerDmoStream()
WaveStream to resample using the DMO Resampler.
- Parameters
-
inputProvider | Input Stream |
outputFormat | Desired Output Format |
◆ Dispose()
override void NAudio.Wave.ResamplerDmoStream.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotected |
Releases the unmanaged resources used by the T:System.Media.DmoResampler and optionally releases the managed resources.
- Parameters
-
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
This method disposes the input media buffer if it is not null and sets it to null. It disposes the output buffer. If the DMO resampler is not null, it sets it to null.
◆ InputToOutputPosition()
long NAudio.Wave.ResamplerDmoStream.InputToOutputPosition |
( |
long | inputPosition | ) |
|
|
inlineprivate |
Converts the input position to the corresponding output position based on the ratio of average bytes per second between input and output formats.
- Parameters
-
inputPosition | The input position to be converted. |
- Returns
- The corresponding output position calculated based on the ratio of average bytes per second between input and output formats.
This method calculates the output position by multiplying the input position with the ratio of average bytes per second between the output format and the input provider's wave format. If the calculated output position is not aligned with the output format's block align, it is adjusted to the nearest aligned position.
◆ OutputToInputPosition()
long NAudio.Wave.ResamplerDmoStream.OutputToInputPosition |
( |
long | outputPosition | ) |
|
|
inlineprivate |
Converts the output position to the corresponding input position based on the audio format ratios.
- Parameters
-
outputPosition | The output position for which the corresponding input position needs to be calculated. |
- Returns
- The input position corresponding to the given outputPosition based on the audio format ratios.
This method calculates the input position based on the ratio of average bytes per second between the output and input audio formats. It then adjusts the input position to align with the block size of the input audio format if necessary.
◆ Read()
override int NAudio.Wave.ResamplerDmoStream.Read |
( |
byte[] | buffer, |
|
|
int | offset, |
|
|
int | count ) |
|
inline |
Reads a specified number of bytes from the input stream and writes them to the buffer.
- Parameters
-
buffer | The buffer to write the data to. |
offset | The zero-based byte offset in buffer at which to begin storing the data read from the current stream. |
count | The maximum number of bytes to read. |
- Returns
- The total number of bytes read into the buffer. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached.
This method reads data from the input stream and writes it to the buffer provided. It uses a DMO (DirectX Media Object) resampler to process the input data and provide output data. The method loops until the specified number of bytes have been read or until the end of the stream is reached. It modifies the position of the stream accordingly and returns the total number of bytes read into the buffer.
Implements NAudio.Wave.IWaveProvider.
◆ dmoResampler
◆ inputMediaBuffer
MediaBuffer NAudio.Wave.ResamplerDmoStream.inputMediaBuffer |
|
private |
◆ inputProvider
readonly IWaveProvider NAudio.Wave.ResamplerDmoStream.inputProvider |
|
private |
◆ inputStream
readonly WaveStream NAudio.Wave.ResamplerDmoStream.inputStream |
|
private |
◆ outputBuffer
◆ outputFormat
readonly WaveFormat NAudio.Wave.ResamplerDmoStream.outputFormat |
|
private |
◆ position
long NAudio.Wave.ResamplerDmoStream.position |
|
private |
◆ Length
override long NAudio.Wave.ResamplerDmoStream.Length |
|
get |
◆ Position
override long NAudio.Wave.ResamplerDmoStream.Position |
|
getset |
Stream position in bytes.
◆ WaveFormat
override WaveFormat NAudio.Wave.ResamplerDmoStream.WaveFormat |
|
get |
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Wasapi/ResamplerDmoStream.cs