mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 20:48:27 +00:00
fixed test complaint
This commit is contained in:
parent
d7fae2620e
commit
34ba81a841
@ -1,26 +1,28 @@
|
|||||||
import { getAudioContext } from './superdough.mjs';
|
import { getAudioContext } from './superdough.mjs';
|
||||||
import { clamp } from './util.mjs';
|
import { clamp } from './util.mjs';
|
||||||
|
|
||||||
AudioParam.prototype.setRelease = function (startTime, endTime, endValue, curve = 'linear') {
|
if (AudioParam != null) {
|
||||||
const ctx = getAudioContext();
|
AudioParam.prototype.setRelease = function (startTime, endTime, endValue, curve = 'linear') {
|
||||||
const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime';
|
const ctx = getAudioContext();
|
||||||
const param = this;
|
const ramp = curve === 'exponential' ? 'exponentialRampToValueAtTime' : 'linearRampToValueAtTime';
|
||||||
if (AudioParam.prototype.cancelAndHoldAtTime == null) {
|
const param = this;
|
||||||
//this replicates cancelAndHoldAtTime behavior for Firefox
|
if (AudioParam.prototype.cancelAndHoldAtTime == null) {
|
||||||
setTimeout(() => {
|
//this replicates cancelAndHoldAtTime behavior for Firefox
|
||||||
//sustain at current value
|
setTimeout(() => {
|
||||||
const currValue = param.value;
|
//sustain at current value
|
||||||
param.cancelScheduledValues(0);
|
const currValue = param.value;
|
||||||
param.setValueAtTime(currValue, 0);
|
param.cancelScheduledValues(0);
|
||||||
|
param.setValueAtTime(currValue, 0);
|
||||||
|
//release
|
||||||
|
param[ramp](endValue, endTime);
|
||||||
|
}, (startTime - ctx.currentTime) * 1000);
|
||||||
|
} else {
|
||||||
|
param.cancelAndHoldAtTime(startTime);
|
||||||
//release
|
//release
|
||||||
param[ramp](endValue, endTime);
|
param[ramp](endValue, endTime);
|
||||||
}, (startTime - ctx.currentTime) * 1000);
|
}
|
||||||
} else {
|
};
|
||||||
param.cancelAndHoldAtTime(startTime);
|
}
|
||||||
//release
|
|
||||||
param[ramp](endValue, endTime);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export function gainNode(value) {
|
export function gainNode(value) {
|
||||||
const node = getAudioContext().createGain();
|
const node = getAudioContext().createGain();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user