spessasynth_core
Version:
MIDI and SoundFont2/DLS library with no compromises
28 lines (26 loc) • 703 B
JavaScript
import { readLittleEndian } from "../../utils/byte_functions/little_endian.js";
/**
*
* @param zonesChunk {RiffChunk} both pbag and ibag work
* @returns {{mod: number[], gen: number[]}}
*/
export function readZoneIndexes(zonesChunk)
{
/**
* @type {number[]}
*/
const modStartIndexes = [];
/**
* @type {number[]}
*/
const genStartIndexes = [];
while (zonesChunk.chunkData.length > zonesChunk.chunkData.currentIndex)
{
genStartIndexes.push(readLittleEndian(zonesChunk.chunkData, 2));
modStartIndexes.push(readLittleEndian(zonesChunk.chunkData, 2));
}
return {
mod: modStartIndexes,
gen: genStartIndexes
};
}