SplatJS / splat-ecs

MIT License
12 stars 3 forks source link

`game.sounds.setVolume` throws error #26

Closed aquisenberry closed 8 years ago

aquisenberry commented 8 years ago

In sound-loader.js:

SoundLoader.prototype.setVolume = function(gain) {
    this.volume = gain;
    this.gainNode.gain  = gain;
    this.muted = false;
};

this.gainNode.gain = gain; is throwing the following error when calling game.sounds.setVolume(num):

Cannot set property gain of # which has only a getter

ericlathrop commented 8 years ago

Looking at how the rest of the code uses gainNode, it's probably just missing the .value: this.gainNode.gain.value = this.volume;

Can you try this, and if it works, send a PR? Thanks!

ericlathrop commented 8 years ago

Fixed with PR#40