Skip to content

Commit 15367e8

Browse files
defined rate property on WebAudioSound prototype
1 parent e7177c5 commit 15367e8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

v3/src/sound/WebAudioSound.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,19 @@ Object.defineProperty(WebAudioSound.prototype, 'volume', {
9191
this.volumeNode.gain.value = value;
9292
}
9393
});
94+
/**
95+
* Playback rate.
96+
* @property {number} rate
97+
*/
98+
Object.defineProperty(WebAudioSound.prototype, 'rate', {
99+
get: function () {
100+
return this.currentConfig.rate;
101+
},
102+
set: function (value) {
103+
this.currentConfig.rate = value;
104+
if (this.source) {
105+
this.source.playbackRate.value = value * this.manager.rate;
106+
}
107+
}
108+
});
94109
module.exports = WebAudioSound;

0 commit comments

Comments
 (0)