mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-21 18:48:36 +00:00
fix: envelope in chrome
This commit is contained in:
parent
18d62b32c2
commit
33d35e47a6
@ -27,12 +27,13 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) =>
|
|||||||
return {
|
return {
|
||||||
node: gainNode,
|
node: gainNode,
|
||||||
stop: (t) => {
|
stop: (t) => {
|
||||||
if (typeof gainNode.gain.cancelAndHoldAtTime === 'function') {
|
//if (typeof gainNode.gain.cancelAndHoldAtTime === 'function') {
|
||||||
gainNode.gain.cancelAndHoldAtTime(t);
|
// gainNode.gain.cancelAndHoldAtTime(t); // this seems to release instantly....
|
||||||
} else {
|
// see https://discord.com/channels/779427371270275082/937365093082079272/1086053607360712735
|
||||||
// firefox: this will glitch when the sustain has not been reached yet at the time of release
|
//} else {
|
||||||
gainNode.gain.setValueAtTime(sustain * velocity, t);
|
// firefox: this will glitch when the sustain has not been reached yet at the time of release
|
||||||
}
|
gainNode.gain.setValueAtTime(sustain * velocity, t);
|
||||||
|
//}
|
||||||
gainNode.gain.linearRampToValueAtTime(0, t + release);
|
gainNode.gain.linearRampToValueAtTime(0, t + release);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -32,9 +32,9 @@ export function registerSynthSounds() {
|
|||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
node: o.connect(g).connect(envelope),
|
node: o.connect(g).connect(envelope),
|
||||||
stop: (t) => {
|
stop: (releaseTime) => {
|
||||||
releaseEnvelope(t);
|
releaseEnvelope(releaseTime);
|
||||||
stop(t + release);
|
stop(releaseTime + release);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user