mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
updated description for detune setting and added a check to see if it's available, webkit implementation does not support it
This commit is contained in:
parent
d20b7abba6
commit
cafa91005f
2 changed files with 5 additions and 1 deletions
|
@ -65,6 +65,9 @@ var BaseSound = new Class({
|
|||
* Represents detuning of sound in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
|
||||
* The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
|
||||
*
|
||||
* Standards based Web Audio implementation only.
|
||||
* Webkit Web Audio implementation and HTML5 Audio don't support this.
|
||||
*
|
||||
* @property {number} detune
|
||||
*/
|
||||
this.detune = 0;
|
||||
|
|
|
@ -108,6 +108,7 @@ var WebAudioSound = new Class({
|
|||
this.source.buffer = this.audioBuffer;
|
||||
this.source.connect(this.muteNode);
|
||||
this.applyConfig();
|
||||
// TODO add onended event handler to reset sound state
|
||||
this.source.start(0, offset, duration);
|
||||
},
|
||||
/**
|
||||
|
@ -177,7 +178,7 @@ Object.defineProperty(WebAudioSound.prototype, 'detune', {
|
|||
},
|
||||
set: function (value) {
|
||||
this.currentConfig.detune = value;
|
||||
if (this.source) {
|
||||
if (this.source && this.source.detune) {
|
||||
this.source.detune.value =
|
||||
Math.max(-1200, Math.min(value + this.manager.detune, 1200));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue