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...
|
| 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.
|
|
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 BlockAlignReductionStream and optionally releases the managed resources.
|
|
|
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] |
|
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)
|
|
|
byte[] | GetSourceBuffer (int size) |
| Returns the source buffer of the specified size, creating a new buffer if necessary.
|
|
Helper stream that lets us read from compressed audio files with large block alignment as though we could read any amount and reposition anywhere.
◆ BlockAlignReductionStream()
NAudio.Wave.BlockAlignReductionStream.BlockAlignReductionStream |
( |
WaveStream | sourceStream | ) |
|
|
inline |
Creates a new BlockAlignReductionStream.
- Parameters
-
sourceStream | the input stream |
◆ 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
-
disposing | true 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
-
size | The 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.
◆ 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
-
buffer | The byte array to which the data will be read. |
offset | The zero-based byte offset in buffer at which to begin storing the data read from the circular buffer. |
count | The 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.
◆ 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 |
◆ 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 |
◆ Position
override long NAudio.Wave.BlockAlignReductionStream.Position |
|
getset |
Current position within stream.
◆ WaveFormat
override WaveFormat NAudio.Wave.BlockAlignReductionStream.WaveFormat |
|
get |
The documentation for this class was generated from the following file: