@@ -24,17 +24,17 @@ var WebAudioSound = new Class({
2424 /**
2525 * [description]
2626 *
27- * @property {GainNode } volumeNode
27+ * @property {GainNode } muteNode
2828 */
29- this . volumeNode = manager . context . createGain ( ) ;
29+ this . muteNode = manager . context . createGain ( ) ;
3030 /**
3131 * [description]
3232 *
33- * @property {GainNode } muteNode
33+ * @property {GainNode } volumeNode
3434 */
35- this . muteNode = manager . context . createGain ( ) ;
36- this . volumeNode . connect ( this . muteNode ) ;
37- this . muteNode . connect ( manager . destination ) ;
35+ this . volumeNode = manager . context . createGain ( ) ;
36+ this . muteNode . connect ( this . volumeNode ) ;
37+ this . volumeNode . connect ( manager . destination ) ;
3838 if ( config === void 0 ) {
3939 config = { } ;
4040 }
@@ -58,33 +58,33 @@ var WebAudioSound = new Class({
5858 this . source = this . manager . context . createBufferSource ( ) ;
5959 // TODO assign config values to buffer source
6060 this . source . buffer = this . audioBuffer ;
61- this . source . connect ( this . volumeNode ) ;
61+ this . source . connect ( this . muteNode ) ;
6262 this . source . start ( ) ;
6363 return this ;
6464 }
6565} ) ;
6666/**
67- * Volume setting.
68- * @property {number } volume
67+ * Mute setting.
68+ * @property {boolean } mute
6969 */
70- Object . defineProperty ( WebAudioSound . prototype , 'volume ' , {
70+ Object . defineProperty ( WebAudioSound . prototype , 'mute ' , {
7171 get : function ( ) {
72- return this . volumeNode . gain . value ;
72+ return this . muteNode . gain . value === 0 ;
7373 } ,
7474 set : function ( value ) {
75- this . volumeNode . gain . value = value ;
75+ this . muteNode . gain . value = value ? 0 : 1 ;
7676 }
7777} ) ;
7878/**
79- * Mute setting.
80- * @property {boolean } mute
79+ * Volume setting.
80+ * @property {number } volume
8181 */
82- Object . defineProperty ( WebAudioSound . prototype , 'mute ' , {
82+ Object . defineProperty ( WebAudioSound . prototype , 'volume ' , {
8383 get : function ( ) {
84- return this . muteNode . gain . value === 0 ;
84+ return this . volumeNode . gain . value ;
8585 } ,
8686 set : function ( value ) {
87- this . muteNode . gain . value = value ? 0 : 1 ;
87+ this . volumeNode . gain . value = value ;
8888 }
8989} ) ;
9090module . exports = WebAudioSound ;
0 commit comments