Class AiffFileReader
A read-only stream of AIFF data based on an aiff file with an associated WaveFormat originally contributed to NAudio by Giawa
public class AiffFileReader : WaveStream, IAsyncDisposable, IDisposable, IWaveProvider
- Inheritance
-
AiffFileReader
- Implements
- Inherited Members
- Extension Methods
Constructors
AiffFileReader(Stream)
Creates an Aiff File Reader based on an input stream
public AiffFileReader(Stream inputStream)
Parameters
inputStreamStreamThe input stream containing a AIF file including header
AiffFileReader(string)
Supports opening a AIF file
public AiffFileReader(string aiffFile)
Parameters
aiffFilestring
Remarks
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.
Properties
Length
public override long Length { get; }
Property Value
Position
Position in the AIFF file Position
public override long Position { get; set; }
Property Value
SampleCount
Number of Samples (if possible to calculate)
public long SampleCount { get; }
Property Value
WaveFormat
public override WaveFormat WaveFormat { get; }
Property Value
Methods
Dispose(bool)
Cleans up the resources associated with this AiffFileReader
protected override void Dispose(bool disposing)
Parameters
disposingbool
Read(byte[], int, int)
Reads bytes from the AIFF File. Read(byte[], int, int)
public override int Read(byte[] array, int offset, int count)
Parameters
Returns
Read(Span<byte>)
Reads bytes from the AIFF File into the provided span. AIFF sample data is big-endian on disk; this method swaps to little-endian. Read(Span<byte>)
public override int Read(Span<byte> buffer)
Parameters
Returns
ReadAiffHeader(Stream, out WaveFormat, out long, out int, List<AiffChunk>)
Ensures valid AIFF header and then finds data offset.
public static void ReadAiffHeader(Stream stream, out WaveFormat format, out long dataChunkPosition, out int dataChunkLength, List<AiffFileReader.AiffChunk> chunks)
Parameters
streamStreamThe stream, positioned at the start of audio data
formatWaveFormatThe format found
dataChunkPositionlongThe position of the data chunk
dataChunkLengthintThe length of the data chunk
chunksList<AiffFileReader.AiffChunk>Additional chunks found