diff options
| author | Gubolin <gubolin@fantasymail.de> | 2014-08-04 11:10:21 +0200 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2014-08-04 11:10:21 +0200 |
| commit | 90e62b4313f300de1da3013a558d51f7d4c883a6 (patch) | |
| tree | fc98cc505f547f3bfaac53d6949e4f20d0c12f61 /objects.js | |
| parent | 8acc6a32d414160b8de71d19457868b769768649 (diff) | |
| download | snap-90e62b4313f300de1da3013a558d51f7d4c883a6.tar.gz snap-90e62b4313f300de1da3013a558d51f7d4c883a6.zip | |
allow changing the volume of notes
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -6352,12 +6352,13 @@ Note.prototype.setupContext = function () { } Note.prototype.audioContext = new AudioContext(); Note.prototype.gainNode = Note.prototype.audioContext.createGain(); - Note.prototype.gainNode.gain.value = 0.25; // reduce volume by 1/4 }; // Note playing -Note.prototype.play = function () { +Note.prototype.play = function (volume) { + this.gainNode.gain.value = 0.25 * volume / 100; // reduce volume by 1/4 + this.oscillator = this.audioContext.createOscillator(); if (!this.oscillator.start) { this.oscillator.start = this.oscillator.noteOn; |
