Skip to content

Commit

Permalink
instrument audioManager.audioEnabledProperty, #745
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph authored and jessegreenberg committed Sep 21, 2021
1 parent 4e91201 commit 64c5cfc
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions js/audioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,27 @@ import BooleanProperty from '../../axon/js/BooleanProperty.js';
import DerivedProperty from '../../axon/js/DerivedProperty.js';
import voicingManager from '../../scenery/js/accessibility/voicing/voicingManager.js';
import soundManager from '../../tambo/js/soundManager.js';
import PhetioObject from '../../tandem/js/PhetioObject.js';
import Tandem from '../../tandem/js/Tandem.js';
import joist from './joist.js';
import packageJSON from './packageJSON.js';

// constants
const packageSimFeatures = packageJSON.phet.simFeatures || {};

class AudioManager {
constructor() {
class AudioManager extends PhetioObject {

/**
* @param {Tandem} tandem
*/
constructor( tandem ) {

super( {
tandem: tandem,
phetioState: false,
phetioDocumentation: 'Controls the simulation\'s audio features. This includes sound and voicing. For sims that ' +
'do not support these features, this element and its children can be ignored.'
} );

// @public (joist-internal, read-only) {boolean} - true if sound is supported and enabled
this.supportsSound = phet.chipper.queryParameters.supportsSound &&
Expand Down Expand Up @@ -58,7 +71,10 @@ class AudioManager {

// @public {BooleanProperty} - Whether or not all features involving audio are enabled (including sound, enhanced
// sound, and voicing). When false, everything should be totally silent.
this.audioEnabledProperty = new BooleanProperty( phet.chipper.queryParameters.audio === 'enabled' );
this.audioEnabledProperty = new BooleanProperty( phet.chipper.queryParameters.audio === 'enabled', {
tandem: tandem.createTandem( 'audioEnabledProperty' ),
phetioDocumentation: 'determines whether audio features are enabled for this simulation'
} );

// @public {DerivedProperty.<boolean>} - Indicates when both Audio and Sound are enabled. When false, the
// soundManager will not produce any sound.
Expand Down Expand Up @@ -131,7 +147,7 @@ class AudioManager {
}
}

const audioManager = new AudioManager();
const audioManager = new AudioManager( Tandem.GENERAL_VIEW.createTandem( 'audioManager' ) );

joist.register( 'audioManager', audioManager );
export default audioManager;

0 comments on commit 64c5cfc

Please sign in to comment.