mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 14:02:29 -05:00
start audio param transition at now
Explicitly start the param transitions at the audio context's now time.
This commit is contained in:
parent
f6d5353e83
commit
0059ff53e1
2 changed files with 15 additions and 3 deletions
|
@ -58,8 +58,16 @@ class PanEffect extends Effect {
|
|||
const leftVal = Math.cos(p * Math.PI / 2);
|
||||
const rightVal = Math.sin(p * Math.PI / 2);
|
||||
|
||||
this.leftGain.gain.setTargetAtTime(leftVal, 0, this.audioEngine.DECAY_TIME);
|
||||
this.rightGain.gain.setTargetAtTime(rightVal, 0, this.audioEngine.DECAY_TIME);
|
||||
this.leftGain.gain.setTargetAtTime(
|
||||
leftVal,
|
||||
this.audioEngine.audioContext.currentTime,
|
||||
this.audioEngine.DECAY_TIME
|
||||
);
|
||||
this.rightGain.gain.setTargetAtTime(
|
||||
rightVal,
|
||||
this.audioEngine.audioContext.currentTime,
|
||||
this.audioEngine.DECAY_TIME
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,11 @@ class VolumeEffect extends Effect {
|
|||
this.value = value;
|
||||
// A gain of 1 is normal. Scale down scratch's volume value. Apply the
|
||||
// change over a tiny period of time.
|
||||
this.outputNode.gain.setTargetAtTime(value / 100, 0, this.audioEngine.DECAY_TIME);
|
||||
this.outputNode.gain.setTargetAtTime(
|
||||
value / 100,
|
||||
this.audioEngine.audioContext.currentTime,
|
||||
this.audioEngine.DECAY_TIME
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue