Skip to content

Commit

Permalink
rename Slider.DEFAULT_SOUND to Slider.DEFAULT_SOUND_GENERATOR, phetsi…
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Feb 27, 2024
1 parent 52809d1 commit 1182333
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions js/Slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export default class Slider extends Sizable( AccessibleSlider( Node, 0 ) ) {

private readonly ticks: ObservableArray<SliderTick> = createObservableArray();

// This is a marker to indicate that we should create the actual default slider sound.
public static readonly DEFAULT_SOUND = new ValueChangeSoundPlayer( new Range( 0, 1 ) );
// The default sound used if options.soundGenerator is not set.
public static readonly DEFAULT_SOUND_GENERATOR = new ValueChangeSoundPlayer( new Range( 0, 1 ) );

// If the user is holding down the thumb outside of the enabled range, and the enabled range expands, the value should
// adjust to the new extremum of the range, see https://github.com/phetsims/mean-share-and-balance/issues/29
Expand Down Expand Up @@ -207,7 +207,7 @@ export default class Slider extends Sizable( AccessibleSlider( Node, 0 ) ) {

disabledOpacity: SceneryConstants.DISABLED_OPACITY,

soundGenerator: Slider.DEFAULT_SOUND,
soundGenerator: Slider.DEFAULT_SOUND_GENERATOR,
valueChangeSoundGeneratorOptions: {},

// phet-io
Expand All @@ -224,11 +224,11 @@ export default class Slider extends Sizable( AccessibleSlider( Node, 0 ) ) {

const rangeProperty = range instanceof Range ? new TinyProperty( range ) : range;

assert && assert( options.soundGenerator === Slider.DEFAULT_SOUND || _.isEmpty( options.valueChangeSoundGeneratorOptions ),
assert && assert( options.soundGenerator === Slider.DEFAULT_SOUND_GENERATOR || _.isEmpty( options.valueChangeSoundGeneratorOptions ),
'options should only be supplied when using default sound generator' );

// If no sound generator was provided, create the default.
if ( options.soundGenerator === Slider.DEFAULT_SOUND ) {
if ( options.soundGenerator === Slider.DEFAULT_SOUND_GENERATOR ) {
options.soundGenerator = new ValueChangeSoundPlayer( rangeProperty.value, options.valueChangeSoundGeneratorOptions || {} );
}
else if ( options.soundGenerator === null ) {
Expand Down
4 changes: 2 additions & 2 deletions js/SliderTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class SliderTrack extends WidthSizable( Node ) {
endDrag: _.noop, // called when a drag sequence ends
constrainValue: _.identity, // called before valueProperty is set
enabledRangeProperty: this.rangeProperty,
soundGenerator: Slider.DEFAULT_SOUND,
soundGenerator: Slider.DEFAULT_SOUND_GENERATOR,
valueChangeSoundGeneratorOptions: {},
voicingOnEndResponse: _.noop,

Expand All @@ -108,7 +108,7 @@ export default class SliderTrack extends WidthSizable( Node ) {
}, providedOptions );

// If no sound generator was provided, create the default.
if ( options.soundGenerator === Slider.DEFAULT_SOUND ) {
if ( options.soundGenerator === Slider.DEFAULT_SOUND_GENERATOR ) {
// NOTE: We'll want to update ValueChangeSoundPlayer for dynamic ranges if it's used more for that
options.soundGenerator = new ValueChangeSoundPlayer( this.rangeProperty.value, options.valueChangeSoundGeneratorOptions || {} );
}
Expand Down

0 comments on commit 1182333

Please sign in to comment.