soundfont2
Version:
A SoundFont2 parser for Node.js and web browsers
30 lines (29 loc) • 1.33 kB
TypeScript
import { SF2Chunk } from '~/chunk';
import { Generator, GeneratorType, Modulator, Zone, ZoneItems, ZoneItemsWithReference } from '~/types';
/**
* Get the preset or instrument zones from a chunk.
*
* @param {SF2Chunk} chunk - The input chunk
* @param {string} type - The type of chunk ('pbag' or 'ibag')
*/
export declare const getZones: (chunk: SF2Chunk, type: "pbag" | "ibag") => Zone[];
/**
* Get all modulators, generators and the instrument (for presets) or sample (for instruments) in a
* preset or instrument.
*
* @template T
* @template R
* @param {T} headers - The preset or instrument headers
* @param {Zone[]} zones - All zones for the preset or instrument
* @param {Modulator[]} itemModulators - All modulators for the preset or instrument
* @param {Generator[]} itemGenerators - All generators for the preset or instrument
* @param {R[]} references - The instruments or samples to reference in the zone
* @param {GeneratorType} referenceType - The generator type to reference it by
*/
export declare const getItemsInZone: <T extends {
bagIndex: number;
}, R>(headers: T[], zones: Zone[], itemModulators: Modulator[], itemGenerators: Generator[], references: R[], referenceType: GeneratorType) => {
header: T;
zones: ZoneItemsWithReference<R>[];
globalZone?: ZoneItems | undefined;
}[];