Skip to content

Commit

Permalink
Do not use voicingUtteranceQueue.addToBack and register Utterances to…
Browse files Browse the repository at this point in the history
… a VoicingNode, see #298
  • Loading branch information
jessegreenberg committed Apr 14, 2022
1 parent 5eb1fe2 commit 379e614
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions js/friction/view/FrictionScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import Bounds2 from '../../../../dot/js/Bounds2.js';
import ScreenView from '../../../../joist/js/ScreenView.js';
import ResetAllButton from '../../../../scenery-phet/js/buttons/ResetAllButton.js';
import ThermometerNode from '../../../../scenery-phet/js/ThermometerNode.js';
import { voicingUtteranceQueue } from '../../../../scenery/js/imports.js';
import { Node } from '../../../../scenery/js/imports.js';
import { Node, Voicing } from '../../../../scenery/js/imports.js';
import SoundClip from '../../../../tambo/js/sound-generators/SoundClip.js';
import SoundLevelEnum from '../../../../tambo/js/SoundLevelEnum.js';
import soundManager from '../../../../tambo/js/soundManager.js';
Expand Down Expand Up @@ -98,7 +97,7 @@ class FrictionScreenView extends ScreenView {

this.alertDescriptionUtterance( atomsJiggleTinyBitUtterance );

voicingUtteranceQueue.addToBack( atomsJiggleTinyBitUtterance );
Voicing.alertUtterance( atomsJiggleTinyBitUtterance );
};

let amplitudeIncreasedEnoughForSettledAndCoolAlert = false;
Expand Down Expand Up @@ -260,6 +259,17 @@ class FrictionScreenView extends ScreenView {
// add a node that creates a "play area" accessible section in the PDOM
this.pdomControlAreaNode.pdomOrder = [ resetAllButton ];

// voicing - Make is so that the Utterances of each Alerter cannot be announced unless the chemistryBookNode
// is globally visible and voicingVisible in the display
Voicing.registerUtteranceToVoicingNode( temperatureIncreasingAlerter.maxTempUtterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( temperatureIncreasingAlerter.temperatureJiggleUtterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( temperatureDecreasingAlerter.utterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( breakAwayAlerter.utterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( bookMovementAlerter.bottomDescriptionUtterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( bookMovementAlerter.bottomVoicingUtterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( bookMovementAlerter.moveDownToRubHarderUtterance, chemistryBookNode );
Voicing.registerUtteranceToVoicingNode( atomsJiggleTinyBitUtterance, chemistryBookNode );

// @private
this.resetFrictionScreenView = () => {

Expand Down
6 changes: 3 additions & 3 deletions js/friction/view/book/BookMovementAlerter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import merge from '../../../../../phet-core/js/merge.js';
import BorderAlertsDescriber from '../../../../../scenery-phet/js/accessibility/describers/BorderAlertsDescriber.js';
import DirectionEnum from '../../../../../scenery-phet/js/accessibility/describers/DirectionEnum.js';
import MovementAlerter from '../../../../../scenery-phet/js/accessibility/describers/MovementAlerter.js';
import { voicingUtteranceQueue } from '../../../../../scenery/js/imports.js';
import { Voicing } from '../../../../../scenery/js/imports.js';
import ResponsePacket from '../../../../../utterance-queue/js/ResponsePacket.js';
import Utterance from '../../../../../utterance-queue/js/Utterance.js';
import friction from '../../../friction.js';
Expand Down Expand Up @@ -108,7 +108,7 @@ class BookMovementAlerter extends MovementAlerter {
// Once touching, speak the alert
if ( !wasTouching && isTouching && model.numberOfAtomsShearedOffProperty.value === 0 ) {
this.alert( this.bottomDescriptionUtterance );
voicingUtteranceQueue.addToBack( this.bottomVoicingUtterance );
Voicing.alertUtterance( this.bottomVoicingUtterance );
}
} );
}
Expand Down Expand Up @@ -153,7 +153,7 @@ class BookMovementAlerter extends MovementAlerter {
this.alert( this.moveDownToRubHarderUtterance );

// Support voicing for this hint
voicingUtteranceQueue.addToBack( this.moveDownToRubHarderUtterance );
Voicing.alertUtterance( this.moveDownToRubHarderUtterance );

// This means that we will get left/right alerts again after a "move down" cue
this.separatedAlertPair.reset();
Expand Down

0 comments on commit 379e614

Please sign in to comment.