Skip to content

Commit

Permalink
migrate to updated GameAudioPlayer, see phetsims/vegas#77
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Jun 4, 2019
1 parent 592dc3c commit f58a062
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 26 deletions.
3 changes: 1 addition & 2 deletions js/arithmetic-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ require.config( {
TAMBO: '../../tambo/js',
TANDEM: '../../tandem/js',
TWIXT: '../../twixt/js',
VEGAS: '../../vegas/js',
VIBE: '../../vibe/js'
VEGAS: '../../vegas/js'
},

// optional cache bust to make browser refresh load all included scripts, can be disabled with ?cacheBust=false
Expand Down
3 changes: 2 additions & 1 deletion js/arithmetic-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ define( function( require ) {
team: 'Bryce Gruneich, Karina K. R. Hensberry, Trish Loeblein, Ariel Paul, Kathy Perkins, Beth Stade',
qualityAssurance: 'Steele Dalton, Bryce Griebenow, Elise Morgan, Oliver Orejola, Ben Roberts, Bryan Yoelin',
thanks: 'Thanks to Mobile Learner Labs for working with the PhET development team to convert this simulation to HTML5.'
}
},
supportsSound: true
};

SimLauncher.launch( function() {
Expand Down
3 changes: 1 addition & 2 deletions js/common/ArithmeticGlobals.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ define( function( require ) {
var Property = require( 'AXON/Property' );

var ArithmeticGlobals = {
timerEnabledProperty: new Property( false ),
soundEnabledProperty: new Property( true )
timerEnabledProperty: new Property( false )
};

arithmetic.register( 'ArithmeticGlobals', ArithmeticGlobals );
Expand Down
1 change: 0 additions & 1 deletion js/common/model/ArithmeticModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ define( function( require ) {
this.clearGameEnvironments();

// reset sound and timer on/off settings
ArithmeticGlobals.soundEnabledProperty.reset();
ArithmeticGlobals.timerEnabledProperty.reset();
},

Expand Down
5 changes: 2 additions & 3 deletions js/common/view/ArithmeticView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ define( function( require ) {
// modules
var Animation = require( 'TWIXT/Animation' );
var arithmetic = require( 'ARITHMETIC/arithmetic' );
var ArithmeticGlobals = require( 'ARITHMETIC/common/ArithmeticGlobals' );
var Bounds2 = require( 'DOT/Bounds2' );
var Easing = require( 'TWIXT/Easing' );
var GameAudioPlayerOld = require( 'VEGAS/GameAudioPlayerOld' );
var GameAudioPlayer = require( 'VEGAS/GameAudioPlayer' );
var GameState = require( 'ARITHMETIC/common/model/GameState' );
var inherit = require( 'PHET_CORE/inherit' );
var LevelSelectionNode = require( 'ARITHMETIC/common/view/LevelSelectionNode' );
Expand Down Expand Up @@ -72,7 +71,7 @@ define( function( require ) {
this.addChild( workspaceNode );

// sounds player that is used to produce the feedback sounds for the game
var gameAudioPlayer = new GameAudioPlayerOld( ArithmeticGlobals.soundEnabledProperty );
var gameAudioPlayer = new GameAudioPlayer();

// set the origin of the answer animation in the multiplication table, which depends upon the newly set position of
// the equation node.
Expand Down
4 changes: 1 addition & 3 deletions js/common/view/LevelSelectionNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ define( function( require ) {
var Node = require( 'SCENERY/nodes/Node' );
var PhetFont = require( 'SCENERY_PHET/PhetFont' );
var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' );
var SoundToggleButton = require( 'SCENERY_PHET/buttons/SoundToggleButton' );
var Text = require( 'SCENERY/nodes/Text' );
var TimerToggleButton = require( 'SCENERY_PHET/buttons/TimerToggleButton' );
var VBox = require( 'SCENERY/nodes/VBox' );
Expand Down Expand Up @@ -116,8 +115,7 @@ define( function( require ) {
var soundAndTimerButtons = new VBox( {
spacing: 5,
children: [
new TimerToggleButton( ArithmeticGlobals.timerEnabledProperty ),
new SoundToggleButton( ArithmeticGlobals.soundEnabledProperty )
new TimerToggleButton( ArithmeticGlobals.timerEnabledProperty )
],
right: layoutBounds.maxX * 0.08,
bottom: layoutBounds.maxY * 0.95
Expand Down
8 changes: 4 additions & 4 deletions js/divide/model/DivideModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ define( function( require ) {

// modules
var arithmetic = require( 'ARITHMETIC/arithmetic' );
var ArithmeticGlobals = require( 'ARITHMETIC/common/ArithmeticGlobals' );
var ArithmeticModel = require( 'ARITHMETIC/common/model/ArithmeticModel' );
var GameState = require( 'ARITHMETIC/common/model/GameState' );
var inherit = require( 'PHET_CORE/inherit' );
var Random = require( 'DOT/Random' );
var soundManager = require( 'TAMBO/soundManager' );

/**
* @param {Tandem} tandem
Expand Down Expand Up @@ -87,8 +87,8 @@ define( function( require ) {
var self = this;

// make sure that sound is off, since otherwise it dings for every solved problem
var soundState = ArithmeticGlobals.soundEnabledProperty.value;
ArithmeticGlobals.soundEnabledProperty.value = false;
var soundState = soundManager.enabled;
soundManager.enabled = false;

// answer the questions
var numQuestions = this.activeLevelModel.tableSize * this.activeLevelModel.tableSize;
Expand Down Expand Up @@ -119,7 +119,7 @@ define( function( require ) {
} );

// restore the original sound state
ArithmeticGlobals.soundEnabledProperty.value = soundState;
soundManager.enabled = soundState;
}
} );

Expand Down
8 changes: 4 additions & 4 deletions js/factor/model/FactorModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ define( function( require ) {

// modules
var arithmetic = require( 'ARITHMETIC/arithmetic' );
var ArithmeticGlobals = require( 'ARITHMETIC/common/ArithmeticGlobals' );
var ArithmeticModel = require( 'ARITHMETIC/common/model/ArithmeticModel' );
var GameState = require( 'ARITHMETIC/common/model/GameState' );
var inherit = require( 'PHET_CORE/inherit' );
var soundManager = require( 'TAMBO/soundManager' );

/**
* @param {Tandem} tandem
Expand Down Expand Up @@ -88,8 +88,8 @@ define( function( require ) {
autoAnswer: function() {

// make sure that sound is off, since otherwise it dings for every solved problem
var soundState = ArithmeticGlobals.soundEnabledProperty.value;
ArithmeticGlobals.soundEnabledProperty.value = false;
var soundState = soundManager.enabled;
soundManager.enabled = false;

// answer the questions
var self = this;
Expand Down Expand Up @@ -117,7 +117,7 @@ define( function( require ) {
} );

// restore the original sound state
ArithmeticGlobals.soundEnabledProperty.value = soundState;
soundManager.enabled = soundState;
}
} );
} );
8 changes: 4 additions & 4 deletions js/multiply/model/MultiplyModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ define( function( require ) {

// modules
var arithmetic = require( 'ARITHMETIC/arithmetic' );
var ArithmeticGlobals = require( 'ARITHMETIC/common/ArithmeticGlobals' );
var ArithmeticModel = require( 'ARITHMETIC/common/model/ArithmeticModel' );
var GameState = require( 'ARITHMETIC/common/model/GameState' );
var inherit = require( 'PHET_CORE/inherit' );
var soundManager = require( 'TAMBO/soundManager' );

/**
* @constructor
Expand Down Expand Up @@ -72,8 +72,8 @@ define( function( require ) {
autoAnswer: function() {

// make sure that sound is off, since otherwise it dings for every solved problem
var soundState = ArithmeticGlobals.soundEnabledProperty.value;
ArithmeticGlobals.soundEnabledProperty.value = false;
var soundState = soundManager.enabled;
soundManager.enabled = false;

// answer the questions
var self = this;
Expand All @@ -95,7 +95,7 @@ define( function( require ) {
} );

// restore the original sound state
ArithmeticGlobals.soundEnabledProperty.value = soundState;
soundManager.enabled = soundState;
}
} );
} );
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"requirejsNamespace": "ARITHMETIC",
"phetLibs": [
"twixt",
"vegas",
"vibe"
"vegas"
],
"runnable": true,
"supportedBrands": [
Expand Down

0 comments on commit f58a062

Please sign in to comment.