Add soundAlias function

This commit is contained in:
Antipathie 2025-09-03 00:15:47 +02:00
parent ff2c59a2a6
commit 56b1ea3fa5
2 changed files with 21 additions and 0 deletions

View file

@ -113,6 +113,19 @@ export async function aliasBank(...args) {
}
}
/**
* Register an alias for a sound.
* @param {string} original - The original sound name
* @param {string} alias - The alias to use for the sound
*/
export function soundAlias(original, alias) {
if (getSound(original) == null) {
logger('soundAlias: original sound not found');
return;
}
soundMap.setKey(alias, getSound(original));
}
export function getSound(s) {
if (typeof s !== 'string') {
console.warn(`getSound: expected string got "${s}". fall back to triangle`);