mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 19:18:31 +00:00
improve function
This commit is contained in:
parent
a2c896f765
commit
710da1d28d
@ -21,15 +21,14 @@ export function registerSound(key, onTrigger, data = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function aliasBank(alias, bank) {
|
export function aliasBank(alias, bank) {
|
||||||
const _soundMap = soundMap.get();
|
const soundDictionary = soundMap.get();
|
||||||
const soundsToAdd = {};
|
for (const key in soundDictionary) {
|
||||||
for (const soundName in _soundMap) {
|
if (key.startsWith(bank + '_')) continue;
|
||||||
const [soundPrefix, soundSuffix] = soundName.split('_');
|
const [, tail] = key.split('_');
|
||||||
if (soundPrefix == bank) {
|
const value = soundDictionary[key];
|
||||||
soundsToAdd[`${alias}_${soundSuffix}`] = _soundMap[soundName];
|
soundDictionary[`${alias}_${tail}`] = value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
soundMap.set({ ..._soundMap, ...soundsToAdd });
|
soundMap.set(soundDictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSound(s) {
|
export function getSound(s) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user