Skip to content

Commit

Permalink
Reformatting the sound generator options, see phetsims/my-solar-syste…
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Mar 21, 2023
1 parent ff551e1 commit 41373b8
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions js/view/SolarSystemCommonNumberControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import SolarSystemCommonStrings from '../SolarSystemCommonStrings.js';
import NumberControl, { NumberControlOptions } from '../../../scenery-phet/js/NumberControl.js';
import { HBox } from '../../../scenery/js/imports.js';
import Tandem from '../../../tandem/js/Tandem.js';
import ValueChangeSoundPlayer from '../../../tambo/js/sound-generators/ValueChangeSoundPlayer.js';

type SelfOptions = EmptySelfOptions;

Expand All @@ -42,6 +43,17 @@ export default class SolarSystemCommonNumberControl extends NumberControl {
const massSliderSoundClip = new SoundClip( Mass_Slider_Bass_Pluck_mp3 );
soundManager.addSoundGenerator( massSliderSoundClip );

const valueChangeSoundGeneratorOptions = {
middleMovingUpSoundPlayer: massSliderSoundClip,
middleMovingDownSoundPlayer: massSliderSoundClip,

// TODO: what should the min max sounds be? https://github.com/phetsims/my-solar-system/issues/105
// TODO: If we want them to also be the default mapping, how do we change ValueChangeSoundGenerator to make this happen? https://github.com/phetsims/my-solar-system/issues/105
minSoundPlayer: minMassSliderSoundClip,
maxSoundPlayer: maxMassSliderSoundClip,
middleMovingUpPlaybackRateMapper: playbackRateMapper
};

const options = optionize<SolarSystemCommonNumberControlOptions, SelfOptions, NumberControlOptions>()( {
sliderOptions: {
trackSize: new Dimension2( 226, 2 ),
Expand All @@ -50,16 +62,7 @@ export default class SolarSystemCommonNumberControl extends NumberControl {
thumbCenterLineStroke: 'black',
trackFillEnabled: SolarSystemCommonColors.foregroundProperty,
trackStroke: SolarSystemCommonColors.foregroundProperty,
valueChangeSoundGeneratorOptions: {
middleMovingUpSoundPlayer: massSliderSoundClip,
middleMovingDownSoundPlayer: massSliderSoundClip,

// TODO: what should the min max sounds be? https://github.com/phetsims/my-solar-system/issues/105
// TODO: If we want them to also be the default mapping, how do we change ValueChangeSoundGenerator to make this happen? https://github.com/phetsims/my-solar-system/issues/105
minSoundPlayer: minMassSliderSoundClip,
maxSoundPlayer: maxMassSliderSoundClip,
middleMovingUpPlaybackRateMapper: playbackRateMapper
},
soundGenerator: new ValueChangeSoundPlayer( range, valueChangeSoundGeneratorOptions ),

//a11y
accessibleName: SolarSystemCommonStrings.a11y.massSliderStringProperty
Expand Down

0 comments on commit 41373b8

Please sign in to comment.