File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ var WebAudioSound = new Class({
2121 * @property {GainNode } volumeNode
2222 */
2323 this . volumeNode = manager . context . createGain ( ) ;
24+ this . volumeNode . connect ( manager . destination ) ;
2425 if ( config === void 0 ) {
2526 config = { } ;
2627 }
@@ -44,9 +45,21 @@ var WebAudioSound = new Class({
4445 var source = this . manager . context . createBufferSource ( ) ;
4546 // TODO assign config values to buffer source
4647 source . buffer = this . audioBuffer ;
47- source . connect ( this . manager . destination ) ;
48+ source . connect ( this . volumeNode ) ;
4849 source . start ( ) ;
4950 return this ;
5051 }
5152} ) ;
53+ /**
54+ * Global volume setting.
55+ * @property {number } volume
56+ */
57+ Object . defineProperty ( WebAudioSound . prototype , 'volume' , {
58+ get : function ( ) {
59+ return this . volumeNode . gain . value ;
60+ } ,
61+ set : function ( value ) {
62+ this . volumeNode . gain . value = value ;
63+ }
64+ } ) ;
5265module . exports = WebAudioSound ;
You can’t perform that action at this time.
0 commit comments