kopia lustrzana https://github.com/backface/turtlestitch
map volume to a logarithmic gain scale
because that's how acoustics works, to get it right (unlike Scratch3)pull/89/head
rodzic
53140c9108
commit
b9519e51e1
|
@ -3274,7 +3274,7 @@ SpriteMorph.prototype.reportSounds = function () {
|
|||
SpriteMorph.prototype.setVolume = function (num) {
|
||||
this.volume = Math.max(Math.min(+num, 100), 0);
|
||||
this.getGainNode().gain.setValueAtTime(
|
||||
this.volume / 100,
|
||||
1 / Math.pow(10, Math.log2(100 / this.volume)),
|
||||
this.audioContext().currentTime
|
||||
);
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue