Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ConfigurationHandler

File: Rhapsodist/Core/Processors/ConfigurationHandler.js · Expected module ID: configurationHandler (a Script Processor / MIDI Processor).

Overview

ConfigurationHandler applies Manifest-driven patch and articulation configuration to every module in the project. It’s the processing counterpart to the UI-only ComponentHandler.

It runs as its own Script Processor and includes App/Manifest.js and ArticulationDataManager.js itself, independently of Interface.js.

Running as a separate Script Processor also means it isn’t affected by Core.js’s Synth.deferCallbacks(true) (which only defers the Interface script’s own callbacks), so it responds to patch/articulation changes in real time.

See The Manifest

Parameters

IDDescription
PatchCurrent patch index. Not meant to be operated directly; link it via processorId/parameterId to the shell’s own knbPatch knob so changing the shell’s patch control drives this one automatically.
ArticulationCurrent articulation index. Same as Patch: link it via processorId/parameterId to the shell’s own knbArticulation knob rather than operating it directly.

Events and communication

ConfigurationHandler writes the current patch/articulation index to two global cables ("patch" and "articulation") on every change, so a standalone processor with no broadcaster connection to the Interface script can read the current patch/articulation from there. See Architecture: Patch and Articulation Changes.

It also resolves MIDI keyswitches, CC 32 (bank-select LSB, when Manifest.useUacc is enabled), and Program Change messages, calling changeArticulation on a match.

Usage

Add ConfigurationHandler.js as a Script Processor with the ID configurationHandler, then link the shell’s invisible knbPatch/knbArticulation knobs to its own Patch/Articulation knobs via processorId/parameterId. From then on, changing the shell’s patch or articulation control drives changePatch()/changeArticulation() automatically.

Internal Reference

FunctionDescriptionReturns
changePatch(index: number)Applies Manifest.patches[index]: the Manifest-level scripts/modulators/effects/samplers attributes as a baseline, then the patch’s own overrides, then its muters. Sample maps are loaded for the samplers referenced by Manifest.samplers + patch.samplers; any sampler not referenced is bypassed and cleared. If a patchGain effect exists, its Gain is set from patch.gain (default 0).—
changeArticulation(index: number)Applies the merged articulation from ArticulationDataManager.getArticulation(index) the same way, sets articulationGain’s Gain from articulation.gain (default 0) if that processor exists, and applies the articulation’s muters if present.—
loadManifestConfiguration()Applies the Manifest-level scripts/modulators/effects/samplers attributes as the baseline, before a patch’s own overrides are applied.—
setArticulationGain(gain: number)Sets articulationGain’s Gain attribute, if that script exists.—
setAttributes(modules, moduleIds: Array, attributeIds: JSON, data)Applies a {id, properties} array (a Manifest entry’s scripts/modulators/effects/samplers list) to the matching modules, unbypassing each one and setting its properties as attributes.—
setAttribute(module: ScriptObject, attribute: number, property: string, value)Applies a single property to a module, special-casing Bypass, Gain, Intensity, File, CrossfadeTable, Table, and Bipolar.—
loadSampleMaps(data)Loads sample maps for the samplers referenced in data and activates group 1; clears and bypasses every sampler not referenced.—
clearSamplers(samplersToSkip: Array)Bypasses and clears the sample map of every sampler not in samplersToSkip.—
enableMuters(mutersToEnable: Array)Enables the muters listed by index and mutes every other muter; does nothing if the list is empty.—
setDefaultCrossfadeTables(samplerIndex: number, numGroups: number)Auto-generates evenly spaced crossfade tables for a sampler’s groups when a CrossfadeGroups count is given without an explicit CrossfadeTable.—
setCrossfadeTables(samplerTable: ScriptObject, data: Array)Restores explicit crossfade tables for a sampler from base64 data.—