mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2025-01-18 05:30:06 -05:00
volume state handled in vm sound blocks
This commit is contained in:
parent
b70607d659
commit
08a81af9e5
1 changed files with 1 additions and 10 deletions
11
src/index.js
11
src/index.js
|
@ -221,16 +221,7 @@ AudioPlayer.prototype.clearEffects = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioPlayer.prototype.setVolume = function (value) {
|
AudioPlayer.prototype.setVolume = function (value) {
|
||||||
this.currentVolume = this._clamp(value, 0, 100);
|
this.effectsNode.gain.value = value / 100;
|
||||||
this.effectsNode.gain.value = this.currentVolume / 100;
|
|
||||||
};
|
|
||||||
|
|
||||||
AudioPlayer.prototype.changeVolume = function (value) {
|
|
||||||
this.setVolume(this.currentVolume + value);
|
|
||||||
};
|
|
||||||
|
|
||||||
AudioPlayer.prototype._clamp = function (input, min, max) {
|
|
||||||
return Math.min(Math.max(input, min), max);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = AudioEngine;
|
module.exports = AudioEngine;
|
||||||
|
|
Loading…
Reference in a new issue