fix tests

This commit is contained in:
Felix Roos 2022-09-18 22:42:30 +02:00
parent dbb057621d
commit d3645f6c63
2 changed files with 795 additions and 1527 deletions

View File

@ -1,28 +1,30 @@
class FeedbackDelayNode extends DelayNode { if (typeof DelayNode !== 'undefined') {
constructor(ac, wet, time, feedback) { class FeedbackDelayNode extends DelayNode {
super(ac); constructor(ac, wet, time, feedback) {
wet = Math.abs(wet); super(ac);
this.delayTime.value = time; wet = Math.abs(wet);
this.delayTime.value = time;
const feedbackGain = ac.createGain(); const feedbackGain = ac.createGain();
feedbackGain.gain.value = Math.min(Math.abs(feedback), 0.995); feedbackGain.gain.value = Math.min(Math.abs(feedback), 0.995);
const delayGain = ac.createGain(); const delayGain = ac.createGain();
delayGain.gain.value = wet; delayGain.gain.value = wet;
this.delayGain = delayGain; this.delayGain = delayGain;
this.connect(feedbackGain); this.connect(feedbackGain);
this.connect(delayGain); this.connect(delayGain);
feedbackGain.connect(this); feedbackGain.connect(this);
this.connect = (target) => delayGain.connect(target); this.connect = (target) => delayGain.connect(target);
return this; return this;
} }
start(t) { start(t) {
this.delayGain.gain.setValueAtTime(this.delayGain.gain.value, t + this.delayTime.value); this.delayGain.gain.setValueAtTime(this.delayGain.gain.value, t + this.delayTime.value);
}
} }
AudioContext.prototype.createFeedbackDelay = function (wet, time, feedback) {
return new FeedbackDelayNode(this, wet, time, feedback);
};
} }
AudioContext.prototype.createFeedbackDelay = function (wet, time, feedback) {
return new FeedbackDelayNode(this, wet, time, feedback);
};

File diff suppressed because it is too large Load Diff