Skip to content

Commit f318aa7

Browse files
defined detune property on WebAudioSound prototype
1 parent e456ee7 commit f318aa7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

v3/src/sound/WebAudioSound.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,20 @@ Object.defineProperty(WebAudioSound.prototype, 'rate', {
106106
}
107107
}
108108
});
109+
/**
110+
* Detuning of sound.
111+
* @property {number} detune
112+
*/
113+
Object.defineProperty(WebAudioSound.prototype, 'detune', {
114+
get: function () {
115+
return this.currentConfig.detune;
116+
},
117+
set: function (value) {
118+
this.currentConfig.detune = value;
119+
if (this.source) {
120+
this.source.detune.value =
121+
Math.max(-1200, Math.min(value + this.manager.detune, 1200));
122+
}
123+
}
124+
});
109125
module.exports = WebAudioSound;

0 commit comments

Comments
 (0)