From 90e62b4313f300de1da3013a558d51f7d4c883a6 Mon Sep 17 00:00:00 2001 From: Gubolin Date: Mon, 4 Aug 2014 11:10:21 +0200 Subject: allow changing the volume of notes --- objects.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'objects.js') diff --git a/objects.js b/objects.js index b385ee9..1a42e0f 100644 --- a/objects.js +++ b/objects.js @@ -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; -- cgit v1.3.1