Skip to content

Commit

Permalink
prevent sounds for charge migration when charges not visible, see #479
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Feb 23, 2021
1 parent 50ad486 commit 60cf2ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/balloons-and-static-electricity/view/BalloonNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* @author John Blanco
*/

import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import Property from '../../../../axon/js/Property.js';
import Bounds2 from '../../../../dot/js/Bounds2.js';
import Vector2 from '../../../../dot/js/Vector2.js';
Expand Down Expand Up @@ -216,9 +217,15 @@ class BalloonNode extends Node {
}
} );

// {Property.<boolean> - a value that reflects whether charges are being shown on the balloon
const chargesShownOnBalloonProperty = new DerivedProperty(
[ globalModel.showChargesProperty ],
showCharges => showCharges !== 'none'
);

// sound generation for charges moving on to this balloon
const popSoundGenerator = new PitchedPopGenerator( {
// enableControlProperties: [ model.showChargesProperty ],
enableControlProperties: [ chargesShownOnBalloonProperty ],
initialOutputLevel: 0.3
} );
soundManager.addSoundGenerator( popSoundGenerator );
Expand Down

0 comments on commit 60cf2ca

Please sign in to comment.