A read-only stream of AIFF data based on an aiff file with an associated WaveFormat originally contributed to NAudio by Giawa.
More...
|
| AiffFileReader (String aiffFile) |
| Supports opening a AIF file.
|
|
| AiffFileReader (Stream inputStream) |
| Creates an Aiff File Reader based on an input stream.
|
|
override int | Read (byte[] array, 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.
|
|
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 void | ReadAiffHeader (Stream stream, out WaveFormat format, out long dataChunkPosition, out int dataChunkLength, List< AiffChunk > chunks) |
| Reads the AIFF header from the provided stream and extracts the wave format, data chunk position, data chunk length, and optional additional chunks.
|
|
|
override void | Dispose (bool disposing) |
| Releases the unmanaged resources used by the AiffFileReader and optionally releases the managed resources.
|
|
|
override WaveFormat | WaveFormat [get] |
| WaveStream.WaveFormat
|
|
override long | Length [get] |
| WaveStream.WaveFormat
|
|
long | SampleCount [get] |
| Number of Samples (if possible to calculate)
|
|
override long | Position [get, set] |
| Position in the AIFF file Stream.Position
|
|
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)
|
|
|
static uint | ConvertInt (byte[] buffer) |
| Converts a byte array to an unsigned integer.
|
|
static short | ConvertShort (byte[] buffer) |
| Converts a byte array to a short integer and returns the result.
|
|
static AiffChunk | ReadChunkHeader (BinaryReader br) |
| Reads the header of a chunk from the provided BinaryReader and returns an AiffChunk object.
|
|
static string | ReadChunkName (BinaryReader br) |
| Reads a chunk name from the provided BinaryReader and returns it as a string.
|
|
A read-only stream of AIFF data based on an aiff file with an associated WaveFormat originally contributed to NAudio by Giawa.
◆ AiffFileReader() [1/2]
NAudio.Wave.AiffFileReader.AiffFileReader |
( |
String | aiffFile | ) |
|
|
inline |
Supports opening a AIF file.
The AIF is of similar nastiness to the WAV format. This supports basic reading of uncompressed PCM AIF files, with 8, 16, 24 and 32 bit PCM data.
◆ AiffFileReader() [2/2]
NAudio.Wave.AiffFileReader.AiffFileReader |
( |
Stream | inputStream | ) |
|
|
inline |
Creates an Aiff File Reader based on an input stream.
- Parameters
-
inputStream | The input stream containing a AIF file including header |
◆ ConvertInt()
static uint NAudio.Wave.AiffFileReader.ConvertInt |
( |
byte[] | buffer | ) |
|
|
inlinestaticprivate |
Converts a byte array to an unsigned integer.
- Parameters
-
buffer | The byte array to be converted. |
- Exceptions
-
Exception | Thrown when the length of the buffer is not 4. |
- Returns
- The unsigned integer value obtained from the byte array.
This method converts the input byte array buffer to an unsigned integer by performing bitwise operations on the individual bytes. It shifts the bytes to their respective positions and then performs a bitwise OR operation to combine them into a single integer value. If the length of the input buffer is not 4, an exception is thrown indicating an incorrect length for the conversion.
◆ ConvertShort()
static short NAudio.Wave.AiffFileReader.ConvertShort |
( |
byte[] | buffer | ) |
|
|
inlinestaticprivate |
Converts a byte array to a short integer and returns the result.
- Parameters
-
buffer | The byte array to be converted to a short integer. |
- Returns
- The short integer value obtained by converting the input byte array.
- Exceptions
-
Exception | Thrown when the length of the input byte array is not 2. |
This method converts the input byte array to a short integer by performing a bitwise left shift operation on the first byte and then performing a bitwise OR operation with the second byte. The resulting short integer value is returned.
◆ Dispose()
override void NAudio.Wave.AiffFileReader.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotected |
Releases the unmanaged resources used by the AiffFileReader 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 AiffFileReader and optionally releases the managed resources. If disposing is true, this method releases all resources held by any managed objects that this AiffFileReader references. This method is called by the public Dispose() method and the Finalize method.
◆ Read()
override int NAudio.Wave.AiffFileReader.Read |
( |
byte[] | array, |
|
|
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
-
array | An 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. |
offset | The zero-based byte offset in array at which to begin storing the data read from the current stream. |
count | The maximum number of bytes to be read from the current stream. |
- Exceptions
-
ArgumentException | Thrown when count is not a multiple of waveFormat.BlockAlign. |
- Returns
- The total number of bytes read into the buffer. This might 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.
This method reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. If the end of the stream is reached, it returns zero. It first checks if count is a multiple of waveFormat.BlockAlign, and if not, it throws an ArgumentException. It then locks the lockObject to ensure thread safety while reading from the stream. It checks if there is more data at the end of the file past the data chunk, and adjusts the count accordingly. It reads data from waveStream into a buffer and then performs endianness conversion based on the wave format's BitsPerSample. Finally, it returns the total number of bytes read into the buffer.
Implements NAudio.Wave.IWaveProvider.
◆ ReadAiffHeader()
static void NAudio.Wave.AiffFileReader.ReadAiffHeader |
( |
Stream | stream, |
|
|
out WaveFormat | format, |
|
|
out long | dataChunkPosition, |
|
|
out int | dataChunkLength, |
|
|
List< AiffChunk > | chunks ) |
|
inlinestatic |
Reads the AIFF header from the provided stream and extracts the wave format, data chunk position, data chunk length, and optional additional chunks.
- Parameters
-
stream | The input stream containing the AIFF data. |
format | When this method returns, contains the wave format extracted from the AIFF header, if valid; otherwise, null. |
dataChunkPosition | When this method returns, contains the position of the data chunk within the stream, if found; otherwise, -1. |
dataChunkLength | When this method returns, contains the length of the data chunk, if found; otherwise, 0. |
chunks | An optional list to store additional AIFF chunks found in the header. |
- Exceptions
-
FormatException | Thrown when the input stream does not contain a valid AIFF file or when specific required chunks are not found. |
◆ ReadChunkHeader()
static AiffChunk NAudio.Wave.AiffFileReader.ReadChunkHeader |
( |
BinaryReader | br | ) |
|
|
inlinestaticprivate |
Reads the header of a chunk from the provided BinaryReader and returns an AiffChunk object.
- Parameters
-
br | The BinaryReader used to read the chunk header. |
- Returns
- An AiffChunk object representing the read chunk header.
◆ ReadChunkName()
static string NAudio.Wave.AiffFileReader.ReadChunkName |
( |
BinaryReader | br | ) |
|
|
inlinestaticprivate |
Reads a chunk name from the provided BinaryReader and returns it as a string.
- Parameters
-
br | The BinaryReader from which to read the chunk name. |
- Returns
- A string representing the chunk name read from the BinaryReader.
◆ chunks
◆ dataChunkLength
readonly int NAudio.Wave.AiffFileReader.dataChunkLength |
|
private |
◆ dataPosition
readonly long NAudio.Wave.AiffFileReader.dataPosition |
|
private |
◆ lockObject
readonly object NAudio.Wave.AiffFileReader.lockObject = new object() |
|
private |
◆ ownInput
readonly bool NAudio.Wave.AiffFileReader.ownInput |
|
private |
◆ waveFormat
readonly WaveFormat NAudio.Wave.AiffFileReader.waveFormat |
|
private |
◆ waveStream
Stream NAudio.Wave.AiffFileReader.waveStream |
|
private |
◆ Length
override long NAudio.Wave.AiffFileReader.Length |
|
get |
◆ Position
override long NAudio.Wave.AiffFileReader.Position |
|
getset |
Position in the AIFF file Stream.Position
◆ SampleCount
long NAudio.Wave.AiffFileReader.SampleCount |
|
get |
Number of Samples (if possible to calculate)
◆ WaveFormat
override WaveFormat NAudio.Wave.AiffFileReader.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/AiffFileReader.cs