add helper hap.ensureObjectValue

This commit is contained in:
Felix Roos 2023-02-24 10:15:06 +01:00
parent c8f8f02a46
commit 6283273d81
4 changed files with 18 additions and 18 deletions

View file

@ -28,9 +28,7 @@ export const csound = register('csound', (instrument, pat) => {
logger('[csound] not loaded yet', 'warning');
return;
}
if (typeof hap.value !== 'object') {
throw new Error('csound only support objects as hap values');
}
hap.ensureObjectValue();
let { gain = 0.8 } = hap.value;
gain *= 0.2;