soundfont2
Version:
A SoundFont2 parser for Node.js and web browsers
77 lines (76 loc) • 2.34 kB
TypeScript
import { ChunkIterator } from './chunkIterator';
export declare class RIFFChunk {
/**
* The chunk ID (fourCC).
*/
readonly id: string;
/**
* The length of the chunk.
*/
readonly length: number;
/**
* The raw buffer of the chunk.
*/
readonly buffer: Uint8Array;
/**
* The sub-chunks of the chunk. If the chunk is not a RIFF or LIST chunk, this will be an empty
* array.
*/
readonly subChunks: RIFFChunk[];
constructor(id: string, length: number, buffer: Uint8Array, subChunks: RIFFChunk[]);
/**
* Get a string from the buffer. If no position and no length is specified, it returns the whole
* buffer as a string.
*
* @param {number} [position]
* @param {number} [length]
*/
getString(position?: number, length?: number): string;
/**
* Get a signed 16-bit integer from the buffer.
*
* @param {number} [position]
*/
getInt16(position?: number): number;
/**
* Get an unsigned 32-bit integer from the buffer.
*
* @param {number} [position]
*/
getUInt32(position?: number): number;
/**
* Get a byte from the buffer.
*
* @param {number} [position]
*/
getByte(position?: number): number;
/**
* Get a char from the buffer.
*
* @param {number} [position]
*/
getChar(position?: number): number;
/**
* Get a chunk iterator for the chunk.
*
* @param {number} [start] - The position where to start iterating. Defaults to 0.
*/
iterator<T = any>(start?: number): ChunkIterator<T>;
/**
* Utility function to quickly iterate over a function.
*
* @template T
* @param {(iterator: ChunkIterator): T} callback - The callback that returns an instance of the
* specified return type
* @param {number} [start] - The optional index where to start iterating over the chunk
*/
iterate<T = any>(callback: (iterator: ChunkIterator) => T | null, start?: number): T[];
/**
* Get a buffer from `start` to `start` + `length`. The buffer is not copied (e.g. when using
* .slice()), so any modifications to the buffer are done to the original buffer too.
*
* @param {number} start
* @param {number} length
*/
private getBuffer;
}