Class WaveChunks
A read-only view of the non-essential RIFF chunks found in a WAV file
(everything except the fmt and data chunks, which are handled
directly by WaveFileReader).
Chunk metadata (id, length, stream position) is materialised when the file is opened; chunk contents are read lazily via GetData(RiffChunk) or an IWaveChunkInterpreter<T>.
public sealed class WaveChunks : IReadOnlyList<RiffChunk>, IReadOnlyCollection<RiffChunk>, IEnumerable<RiffChunk>, IEnumerable
- Inheritance
-
WaveChunks
- Implements
- Inherited Members
- Extension Methods
Properties
Count
Number of chunks.
public int Count { get; }
Property Value
this[int]
Gets the chunk metadata at the given index.
public RiffChunk this[int index] { get; }
Parameters
indexint
Property Value
Methods
Contains(string)
Returns true if a chunk with the given four-character identifier is present.
Comparison is case-insensitive (RIFF treats LIST and list as the same chunk).
public bool Contains(string chunkId)
Parameters
chunkIdstring
Returns
Find(string)
Returns the first chunk matching the given four-character identifier, or null if none is present. Comparison is case-insensitive.
public RiffChunk Find(string chunkId)
Parameters
chunkIdstring
Returns
FindAll(string)
Returns every chunk matching the given four-character identifier. Comparison is case-insensitive.
public IEnumerable<RiffChunk> FindAll(string chunkId)
Parameters
chunkIdstring
Returns
GetData(RiffChunk)
Reads the raw bytes for the given chunk from the underlying stream. The stream position is preserved across the call.
public byte[] GetData(RiffChunk chunk)
Parameters
chunkRiffChunk
Returns
- byte[]
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<RiffChunk> GetEnumerator()
Returns
- IEnumerator<RiffChunk>
An enumerator that can be used to iterate through the collection.
Read<T>(IWaveChunkInterpreter<T>)
Runs the given interpreter over this chunk collection. Returns default
if the interpreter's required chunks are not present.
public T Read<T>(IWaveChunkInterpreter<T> interpreter)
Parameters
interpreterIWaveChunkInterpreter<T>
Returns
- T
Type Parameters
T