From b74d5becd5db8c42d5eb962a44d43d94fabdddef Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 2 Feb 2025 23:37:20 +0100 Subject: [PATCH] allow passing ccn numbers directly to midimapped control name --- packages/midi/midi.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index 240e3844..7da20498 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -94,7 +94,14 @@ export const midiMappings = new Map(); // takes midimap and converts each control key to the main control name function unifyMapping(mapping) { - return Object.fromEntries(Object.entries(mapping).map(([key, mapping]) => [getControlName(key), mapping])); + return Object.fromEntries( + Object.entries(mapping).map(([key, mapping]) => { + if (typeof mapping === 'number') { + mapping = { ccn: mapping }; + } + return [getControlName(key), mapping]; + }), + ); } // adds a midimap to the registry export function addMidimap(name, mapping) {