Skip to content

Commit

Permalink
enabled sound, added reset sound generator, see #166
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Jul 9, 2019
1 parent 5ffa6af commit 311a217
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/gravity-force-lab-basics-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ define( require => {
thanks: ''
},
keyboardHelpNode: keyboardHelpContent,
accessibility: true
accessibility: true,
supportsSound: true
};

SimLauncher.launch( () => {
Expand Down
7 changes: 7 additions & 0 deletions js/gravity-force-lab-basics/model/GFLBModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,23 @@ define( require => {
tandem: tandem.createTandem( 'distanceProperty' )
}
);

// @public (read-only) - true when a reset is in progress
this.resetInProgressProperty = new BooleanProperty( false, {
tandem: tandem.createTandem( 'resetInProgressProperty' )
} );
}

/**
* Reset the GFLBModel.
* @public
*/
reset() {
this.resetInProgressProperty.set( true );
this.constantRadiusProperty.reset();
this.showDistanceProperty.reset();
super.reset();
this.resetInProgressProperty.set( false );
}
}

Expand Down
6 changes: 6 additions & 0 deletions js/gravity-force-lab-basics/view/GFLBScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ define( require => {
const PlayAreaNode = require( 'SCENERY_PHET/accessibility/nodes/PlayAreaNode' );
const Property = require( 'AXON/Property' );
const ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' );
const ResetAllSoundGenerator = require( 'TAMBO/sound-generators/ResetAllSoundGenerator' );
const ScreenView = require( 'JOIST/ScreenView' );
const soundManager = require( 'TAMBO/soundManager' );
const SpherePositionsPDOMNode = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/view/SpherePositionsPDOMNode' );
const Vector2 = require( 'DOT/Vector2' );

Expand Down Expand Up @@ -259,6 +261,10 @@ define( require => {
tandem: tandem.createTandem( 'resetAllButton' )
} );

soundManager.addSoundGenerator( new ResetAllSoundGenerator( model.resetInProgressProperty, {
initialOutputLevel: 0.7
} ) );

// children
playAreaNode.children = [
objectOneMassPDOMNode,
Expand Down

0 comments on commit 311a217

Please sign in to comment.