Skip to content

Commit cafa910

Browse files
updated description for detune setting and added a check to see if it's available, webkit implementation does not support it
1 parent d20b7ab commit cafa910

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

v3/src/sound/BaseSound.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ var BaseSound = new Class({
6565
* Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
6666
* The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
6767
*
68+
* Standards based Web Audio implementation only.
69+
* Webkit Web Audio implementation and HTML5 Audio don't support this.
70+
*
6871
* @property {number} detune
6972
*/
7073
this.detune = 0;

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ var WebAudioSound = new Class({
108108
this.source.buffer = this.audioBuffer;
109109
this.source.connect(this.muteNode);
110110
this.applyConfig();
111+
// TODO add onended event handler to reset sound state
111112
this.source.start(0, offset, duration);
112113
},
113114
/**
@@ -177,7 +178,7 @@ Object.defineProperty(WebAudioSound.prototype, 'detune', {
177178
},
178179
set: function (value) {
179180
this.currentConfig.detune = value;
180-
if (this.source) {
181+
if (this.source && this.source.detune) {
181182
this.source.detune.value =
182183
Math.max(-1200, Math.min(value + this.manager.detune, 1200));
183184
}

0 commit comments

Comments
 (0)