reorganization

This commit is contained in:
2025-09-30 16:56:14 +02:00
parent 304627b248
commit d867f12fcd
14 changed files with 413 additions and 80 deletions

View File

@ -9,6 +9,9 @@ export class ReverbEffect implements Effect {
private convolverNode: ConvolverNode
private wetNode: GainNode
private dryNode: GainNode
private bypassed: boolean = false
private currentWetValue: number = 0
private currentDryValue: number = 1
constructor(audioContext: AudioContext) {
this.audioContext = audioContext
@ -52,11 +55,27 @@ export class ReverbEffect implements Effect {
return this.outputNode
}
setBypass(bypass: boolean): void {
this.bypassed = bypass
if (bypass) {
this.wetNode.gain.value = 0
this.dryNode.gain.value = 1
} else {
this.wetNode.gain.value = this.currentWetValue
this.dryNode.gain.value = this.currentDryValue
}
}
updateParams(values: Record<string, number>): void {
if (values.reverbWetDry !== undefined) {
const wet = values.reverbWetDry / 100
this.wetNode.gain.value = wet
this.dryNode.gain.value = 1 - wet
this.currentWetValue = wet
this.currentDryValue = 1 - wet
if (!this.bypassed) {
this.wetNode.gain.value = this.currentWetValue
this.dryNode.gain.value = this.currentDryValue
}
}
}