@@ -442,36 +442,63 @@ this.createjs = this.createjs || {};
442442
443443
444444// class getter / setter properties
445+
445446 /**
446447 * Set the master volume of Sound. The master volume is multiplied against each sound's individual volume. For
447448 * example, if master volume is 0.5 and a sound's volume is 0.5, the resulting volume is 0.25. To set individual
448- * sound volume, use AbstractSoundInstance {{#crossLink "AbstractSoundInstance/volume:property"}}{{/crossLink}} instead.
449+ * sound volume, use AbstractSoundInstance {{#crossLink "AbstractSoundInstance/volume:property"}}{{/crossLink}}
450+ * instead.
449451 *
450452 * <h4>Example</h4>
451453 *
452454 * createjs.Sound.volume = 0.5;
453455 *
454- *
455456 * @property volume
456457 * @type {Number }
457458 * @default 1
458459 * @since 0.6.1
459460 */
461+
462+ /**
463+ * The internal volume level. Use {{#crossLink "Sound/volume:property"}}{{/crossLink}} to adjust the master volume.
464+ * @property _masterVolume
465+ * @type {number }
466+ * @default 1
467+ * @private
468+ */
460469 s . _masterVolume = 1 ;
461- Object . defineProperty ( s , "volume" , {
462- get : function ( ) { return this . _masterVolume ; } ,
463- set : function ( value ) {
464- if ( Number ( value ) == null ) { return false ; }
465- value = Math . max ( 0 , Math . min ( 1 , value ) ) ;
466- s . _masterVolume = value ;
467- if ( ! this . activePlugin || ! this . activePlugin . setVolume || ! this . activePlugin . setVolume ( value ) ) {
468- var instances = this . _instances ;
469- for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
470- instances [ i ] . setMasterVolume ( value ) ;
471- }
472- }
470+
471+ /**
472+ * Use the {{#crossLink "Sound/volume:property"}}{{/crossLink}} property instead.
473+ * @method _getMasterVolume
474+ * @private
475+ * @static
476+ * @return {Number }
477+ **/
478+ s . _getMasterVolume = function ( ) {
479+ return this . _masterVolume ;
480+ } ;
481+ // Sound.getMasterVolume is @deprecated . Remove for 1.1+
482+ s . getVolume = createjs . deprecate ( s . _getMasterVolume , "Sound.getVolume" ) ;
483+ /**
484+ * Use the {{#crossLink "Sound/volume:property"}}{{/crossLink}} property instead.
485+ * @method _setMasterVolume
486+ * @static
487+ * @private
488+ **/
489+ s . _setMasterVolume = function ( value ) {
490+ if ( Number ( value ) == null ) { return ; }
491+ value = Math . max ( 0 , Math . min ( 1 , value ) ) ;
492+ s . _masterVolume = value ;
493+ if ( ! this . activePlugin || ! this . activePlugin . setVolume || ! this . activePlugin . setVolume ( value ) ) {
494+ var instances = this . _instances ;
495+ for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
496+ instances [ i ] . setMasterVolume ( value ) ;
473497 }
474- } ) ;
498+ }
499+ } ;
500+ // Sound.stMasterVolume is @deprecated . Remove for 1.1+
501+ s . setVolume = createjs . deprecate ( s . _setMasterVolume , "Sound.setVolume" ) ;
475502
476503 /**
477504 * Mute/Unmute all audio. Note that muted audio still plays at 0 volume. This global mute value is maintained
@@ -489,22 +516,39 @@ this.createjs = this.createjs || {};
489516 * @since 0.6.1
490517 */
491518 s . _masterMute = false ;
492- // OJR references to the methods were not working, so the code had to be duplicated here
493- Object . defineProperty ( s , "muted" , {
494- get : function ( ) { return this . _masterMute ; } ,
495- set : function ( value ) {
496- if ( value == null ) { return false ; }
497-
498- this . _masterMute = value ;
499- if ( ! this . activePlugin || ! this . activePlugin . setMute || ! this . activePlugin . setMute ( value ) ) {
500- var instances = this . _instances ;
501- for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
502- instances [ i ] . setMasterMute ( value ) ;
503- }
504- }
505- return true ;
519+
520+ /**
521+ * Use the {{#crossLink "Sound/muted:property"}}{{/crossLink}} property instead.
522+ * @method _getMute
523+ * @returns {Boolean }
524+ * @static
525+ * @private
526+ */
527+ s . _getMute = function ( ) {
528+ return this . _masterMute ;
529+ } ;
530+ // Sound.getMute is @deprecated . Remove for 1.1+
531+ s . getMute = createjs . deprecate ( s . _getMute , "Sound.getMute" ) ;
532+
533+ /**
534+ * Use the {{#crossLink "Sound/muted:property"}}{{/crossLink}} property instead.
535+ * @method _setMute
536+ * @param {Boolean } value The muted value
537+ * @static
538+ * @private
539+ */
540+ s . _setMute = function ( value ) {
541+ if ( value == null ) { return ; }
542+ this . _masterMute = value ;
543+ if ( ! this . activePlugin || ! this . activePlugin . setMute || ! this . activePlugin . setMute ( value ) ) {
544+ var instances = this . _instances ;
545+ for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
546+ instances [ i ] . setMasterMute ( value ) ;
506547 }
507- } ) ;
548+ }
549+ } ;
550+ // Sound.setMute is @deprecated . Remove for 1.1+
551+ s . setMute = createjs . deprecate ( s . _setMute , "Sound.setMute" ) ;
508552
509553 /**
510554 * Get the active plugins capabilities, which help determine if a plugin can be used in the current environment,
@@ -540,12 +584,23 @@ this.createjs = this.createjs || {};
540584 * @readOnly
541585 * @since 0.6.1
542586 */
543- Object . defineProperty ( s , "capabilities" , {
544- get : function ( ) {
545- if ( s . activePlugin == null ) { return null ; }
546- return s . activePlugin . _capabilities ;
547- } ,
548- set : function ( value ) { return false ; }
587+
588+ /**
589+ * Use the {{#crossLink "Sound/capabilities:property"}}{{/crossLink}} property instead.
590+ * @returns {null }
591+ * @private
592+ */
593+ s . _getCapabilities = function ( ) {
594+ if ( s . activePlugin == null ) { return null ; }
595+ return s . activePlugin . _capabilities ;
596+ } ;
597+ // Sound.getCapabilities is @deprecated . Remove for 1.1+
598+ s . getCapabilities = createjs . deprecate ( s . _getCapabilities , "Sound.getCapabilities" ) ;
599+
600+ Object . defineProperties ( s , {
601+ volume : { get : s . _getMasterVolume , set : s . _setMasterVolume } ,
602+ muted : { get : s . _getMute , set : s . _setMute } ,
603+ capabilities : { get : s . _getCapabilities }
549604 } ) ;
550605
551606
0 commit comments