This commit is contained in:
Felix Roos 2022-09-25 20:08:02 +02:00
parent c5342d3eb0
commit 5018669ded
3 changed files with 12 additions and 4 deletions

View file

@ -11,8 +11,9 @@ if (typeof AudioContext !== 'undefined') {
const convolver = this.createConvolver();
convolver.setDuration = (d) => {
convolver.buffer = this.impulseResponse(d);
convolver.duration = duration;
return convolver;
};
this.duration = duration;
convolver.setDuration(duration);
return convolver;
};

View file

@ -217,7 +217,8 @@ function getReverb(orbit, duration = 2) {
reverbs[orbit] = reverb;
}
if (reverbs[orbit].duration !== duration) {
reverbs[orbit].setDuration(duration);
reverbs[orbit] = reverbs[orbit].setDuration(duration);
reverbs[orbit].duration = duration;
}
return reverbs[orbit];
}
@ -277,6 +278,7 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
orbit = 1,
room,
size = 2,
roomsize = size,
} = hap.value;
const { velocity = 1 } = hap.context;
gain *= velocity; // legacy fix for velocity
@ -405,8 +407,8 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
}
// reverb
let reverbSend;
if (room > 0 && size > 0) {
const reverbNode = getReverb(orbit, size);
if (room > 0 && roomsize > 0) {
const reverbNode = getReverb(orbit, roomsize);
reverbSend = effectSend(post, reverbNode, room);
}