mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
set ireal as default dict
+ add global way to set and reset default dict
This commit is contained in:
parent
1525992d73
commit
d4eebf1a77
@ -77,8 +77,13 @@ export const voicingRegistry = {
|
|||||||
lefthand: { dictionary: lefthand, range: ['F3', 'A4'], mode: 'below', anchor: 'a4' },
|
lefthand: { dictionary: lefthand, range: ['F3', 'A4'], mode: 'below', anchor: 'a4' },
|
||||||
triads: { dictionary: triads, mode: 'below', anchor: 'a4' },
|
triads: { dictionary: triads, mode: 'below', anchor: 'a4' },
|
||||||
guidetones: { dictionary: guidetones, mode: 'above', anchor: 'a4' },
|
guidetones: { dictionary: guidetones, mode: 'above', anchor: 'a4' },
|
||||||
default: { dictionary: defaultDictionary, mode: 'below', anchor: 'a4' },
|
legacy: { dictionary: defaultDictionary, mode: 'below', anchor: 'a4' },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let defaultDict = 'ireal';
|
||||||
|
export const setDefaultVoicings = (dict) => (defaultDict = dict);
|
||||||
|
// e.g. setDefaultVoicings('legacy');
|
||||||
|
|
||||||
export const setVoicingRange = (name, range) => addVoicings(name, voicingRegistry[name].dictionary, range);
|
export const setVoicingRange = (name, range) => addVoicings(name, voicingRegistry[name].dictionary, range);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,7 +198,7 @@ export const voicing = register('voicing', function (pat) {
|
|||||||
.fmap((value) => {
|
.fmap((value) => {
|
||||||
// destructure voicing controls out
|
// destructure voicing controls out
|
||||||
value = typeof value === 'string' ? { chord: value } : value;
|
value = typeof value === 'string' ? { chord: value } : value;
|
||||||
let { dictionary = 'default', chord, anchor, offset, mode, n, octaves, ...rest } = value;
|
let { dictionary = defaultDict, chord, anchor, offset, mode, n, octaves, ...rest } = value;
|
||||||
dictionary =
|
dictionary =
|
||||||
typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' };
|
typeof dictionary === 'string' ? voicingRegistry[dictionary] : { dictionary, mode: 'below', anchor: 'c5' };
|
||||||
try {
|
try {
|
||||||
@ -234,3 +239,8 @@ Object.keys(simple).forEach((symbol) => {
|
|||||||
|
|
||||||
registerVoicings('ireal', simple);
|
registerVoicings('ireal', simple);
|
||||||
registerVoicings('ireal-ext', complex);
|
registerVoicings('ireal-ext', complex);
|
||||||
|
|
||||||
|
export function resetVoicings() {
|
||||||
|
lastVoicing = undefined;
|
||||||
|
setDefaultVoicings('ireal');
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user