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

@ -581,6 +581,11 @@ const generic_params = [
'size', 'size',
'a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb.', 'a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb.',
], ],
[
'f',
'roomsize',
'a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb.',
],
// ['f', 'sagogo', ''], // ['f', 'sagogo', ''],
// ['f', 'sclap', ''], // ['f', 'sclap', ''],
// ['f', 'sclaves', ''], // ['f', 'sclaves', ''],

View File

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

View File

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