add aliasbank function
This commit is contained in:
parent
4f6e38f714
commit
e6604491a9
1 changed files with 12 additions and 0 deletions
|
|
@ -20,6 +20,18 @@ export function registerSound(key, onTrigger, data = {}) {
|
||||||
soundMap.setKey(key, { onTrigger, data });
|
soundMap.setKey(key, { onTrigger, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function aliasBank(alias, bank) {
|
||||||
|
const _soundMap = soundMap.get();
|
||||||
|
const soundsToAdd = {};
|
||||||
|
for (const soundName in _soundMap) {
|
||||||
|
const [soundPrefix, soundSuffix] = soundName.split('_');
|
||||||
|
if (soundPrefix == bank) {
|
||||||
|
soundsToAdd[`${alias}_${soundSuffix}`] = _soundMap[soundName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
soundMap.set(soundsToAdd);
|
||||||
|
}
|
||||||
|
|
||||||
export function getSound(s) {
|
export function getSound(s) {
|
||||||
return soundMap.get()[s];
|
return soundMap.get()[s];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue