Skip to content

Commit

Permalink
changed SoundPlayer to ISoundPlayer, see phetsims/tambo#160
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Apr 15, 2022
1 parent a2258b1 commit 66bcff1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion js/AccordionBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default class AccordionBox extends Node {
// {*|null} options for the title bar, defaults filled in below
titleBarOptions: null,

// {SoundPlayer} - sound generators for expand and collapse
// {ISoundPlayer} - sound generators for expand and collapse
expandedSoundPlayer: accordionBoxOpenedSoundPlayer,
collapsedSoundPlayer: accordionBoxClosedSoundPlayer,

Expand Down
4 changes: 2 additions & 2 deletions js/ComboBoxButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { Shape } from '../../kite/js/imports.js';
import optionize from '../../phet-core/js/optionize.js';
import StringUtils from '../../phetcommon/js/util/StringUtils.js';
import { AriaHasPopUpMutator, HStrut, IPaint, Node, Path, PDOMBehaviorFunction, PDOMPeer } from '../../scenery/js/imports.js';
import SoundPlayer from '../../tambo/js/SoundPlayer.js';
import Tandem from '../../tandem/js/Tandem.js';
import ButtonNode from './buttons/ButtonNode.js';
import RectangularPushButton, { RectangularPushButtonOptions } from './buttons/RectangularPushButton.js';
Expand All @@ -20,6 +19,7 @@ import SunConstants from './SunConstants.js';
import VSeparator from './VSeparator.js';
import ComboBoxItem from './ComboBoxItem.js';
import IProperty from '../../axon/js/IProperty.js';
import nullSoundPlayer from '../../tambo/js/shared-sound-players/nullSoundPlayer.js';

// constants
const ALIGN_VALUES = [ 'left', 'center', 'right' ] as const;
Expand Down Expand Up @@ -77,7 +77,7 @@ export default class ComboBoxButton<T> extends RectangularPushButton {
yMargin: 8,
stroke: 'black',
lineWidth: 1,
soundPlayer: SoundPlayer.NO_SOUND, // disable default sound generation
soundPlayer: nullSoundPlayer, // disable default sound generation

// PushButtonModel options
enabledPropertyOptions: {
Expand Down
9 changes: 5 additions & 4 deletions js/ComboBoxItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import sun from './sun.js';

export type ComboBoxItemOptions = {

// Sound that will be played when this item is selected. If set to `null` a default sound will
// be used that is based on this item's position in the combo box list. SoundPlayer.NO_SOUND can be used to disable.
// Sound that will be played when this item is selected. If set to `null` a default sound will be used that is based
// on this item's position in the combo box list. A value of `nullSoundPlayer` can be used to disable.
soundPlayer?: ISoundPlayer | null;

// phet-io - the tandem name for this item's associated Node in the combo box
Expand All @@ -39,8 +39,9 @@ export default class ComboBoxItem<T> {

const options = optionize<ComboBoxItemOptions, ComboBoxItemOptions>( {

// {SoundPlayer|null} - Sound that will be played when this item is selected. If set to `null` a default sound will
// be used that is based on this item's position in the combo box list. SoundPlayer.NO_SOUND can be used to disable.
// {ISoundPlayer|null} - Sound that will be played when this item is selected. If set to `null` a default sound
// will be used that is based on this item's position in the combo box list. The value `nullSoundPlayer` can be
// used to turn off sound production entirely.
soundPlayer: null,

// phet-io
Expand Down
16 changes: 4 additions & 12 deletions js/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ import ScreenView from '../../joist/js/ScreenView.js';
import getGlobal from '../../phet-core/js/getGlobal.js';
import merge from '../../phet-core/js/merge.js';
import CloseButton from '../../scenery-phet/js/buttons/CloseButton.js';
import { FocusManager } from '../../scenery/js/imports.js';
import { KeyboardUtils } from '../../scenery/js/imports.js';
import { PDOMPeer } from '../../scenery/js/imports.js';
import { PDOMUtils } from '../../scenery/js/imports.js';
import { AlignBox } from '../../scenery/js/imports.js';
import { HBox } from '../../scenery/js/imports.js';
import { Node } from '../../scenery/js/imports.js';
import { VBox } from '../../scenery/js/imports.js';
import { FullScreen } from '../../scenery/js/imports.js';
import { AlignBox, FocusManager, FullScreen, HBox, KeyboardUtils, Node, PDOMPeer, PDOMUtils, VBox } from '../../scenery/js/imports.js';
import generalCloseSoundPlayer from '../../tambo/js/shared-sound-players/generalCloseSoundPlayer.js';
import generalOpenSoundPlayer from '../../tambo/js/shared-sound-players/generalOpenSoundPlayer.js';
import SoundPlayer from '../../tambo/js/SoundPlayer.js';
import nullSoundPlayer from '../../tambo/js/shared-sound-players/nullSoundPlayer.js';
import PhetioObject from '../../tandem/js/PhetioObject.js';
import Tandem from '../../tandem/js/Tandem.js';
import DynamicMarkerIO from '../../tandem/js/types/DynamicMarkerIO.js';
Expand Down Expand Up @@ -136,7 +128,7 @@ class Dialog extends Popupable( Panel ) {
phetioReadOnly: PhetioObject.DEFAULT_OPTIONS.phetioReadOnly, // default to false so it can pass it through to the close button
phetioState: PhetioObject.DEFAULT_OPTIONS.phetioState,

// {SoundPlayer} - sound generation
// {ISoundPlayer} - sound generation
openedSoundPlayer: generalOpenSoundPlayer,
closedSoundPlayer: generalCloseSoundPlayer,

Expand Down Expand Up @@ -213,7 +205,7 @@ class Dialog extends Popupable( Panel ) {
enabledPropertyOptions: { phetioFeatured: false },

// turn off default sound generation, Dialog will create its own sounds
soundPlayer: SoundPlayer.NO_SOUND,
soundPlayer: nullSoundPlayer,

// pdom
tagName: 'button',
Expand Down
2 changes: 1 addition & 1 deletion js/buttons/RectangularRadioButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type SelfOptions = {
deselectedContentOpacity?: number;

// Sound generation - If set to null a default will be used that is based on this button's
// position within the radio button group. Can be set to SoundPlayer.NO_SOUND to disable.
// position within the radio button group. Can be set to nullSoundPlayer to disable.
soundPlayer?: ISoundPlayer | null;
};

Expand Down
2 changes: 1 addition & 1 deletion js/buttons/RectangularToggleButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class RectangularToggleButton<T> extends RectangularButton {

const options = optionize<RectangularToggleButtonOptions, SelfOptions, RectangularButtonOptions, 'tandem'>( {

// {SoundPlayer} - sounds to be played on toggle transitions
// {ISoundPlayer} - sounds to be played on toggle transitions
valueOffSoundPlayer: toggleOffSoundPlayer,
valueOnSoundPlayer: toggleOnSoundPlayer,

Expand Down

0 comments on commit 66bcff1

Please sign in to comment.