diff --git a/dependencies.json b/dependencies.json index a0a954a9..54d91ba6 100644 --- a/dependencies.json +++ b/dependencies.json @@ -1,5 +1,5 @@ { - "comment": "# molecules-and-light 1.5.0-dev.9 Mon Nov 04 2019 17:20:50 GMT-0500 (Eastern Standard Time)", + "comment": "# molecules-and-light 1.5.0-dev.11 Mon Nov 04 2019 16:00:25 GMT-0700 (Mountain Standard Time)", "assert": { "sha": "a99a9ce9ee0774bf3ef509bf3e31ca7383f67478", "branch": "master" @@ -13,7 +13,7 @@ "branch": "master" }, "chipper": { - "sha": "59fdc88e1a6079b108ca063367b21a1bea79b853", + "sha": "9f69f9e381778e740ced31d914f69e7664c36fd7", "branch": "master" }, "dot": { @@ -21,7 +21,7 @@ "branch": "master" }, "joist": { - "sha": "21d163d28b186bf0a7b3226ca769402a0d8a0d38", + "sha": "7fbe5dcd309a818964232b828266f503027156a7", "branch": "master" }, "kite": { @@ -29,7 +29,7 @@ "branch": "master" }, "molecules-and-light": { - "sha": "46a5d257353216bd7517316dc10603e1781bc917", + "sha": "b7870023f40bb07ab553f8f6223d92e966c41b9e", "branch": "master" }, "nitroglycerin": { diff --git a/js/moleculesandlight/view/MoleculesAndLightScreenView.js b/js/moleculesandlight/view/MoleculesAndLightScreenView.js index 1bb49485..227740e9 100644 --- a/js/moleculesandlight/view/MoleculesAndLightScreenView.js +++ b/js/moleculesandlight/view/MoleculesAndLightScreenView.js @@ -56,16 +56,11 @@ define( require => { const breakApartSoundV2Info = require( 'sound!MOLECULES_AND_LIGHT/break-apart-v2.mp3' ); const moleculeEnergizedLoopInfo = require( 'sound!MOLECULES_AND_LIGHT/glow-loop-higher.mp3' ); const rotateSoundInfo = require( 'sound!MOLECULES_AND_LIGHT/rotate-loop.mp3' ); - const vibrateOption1SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-001.mp3' ); const vibrateOption2SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-002.mp3' ); - const vibrateOption3SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-003.mp3' ); + const vibrateOption2HigherSoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-002-higher.mp3' ); + const vibrateOption2SaturatedEQSoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-002-saturated-eq.mp3' ); const vibrateOption4SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-004.mp3' ); - const vibrateOption5SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-005.mp3' ); - const vibrateOption6SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-006.mp3' ); const vibrateOption7SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-007.mp3' ); - const vibrateOption8SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-008.mp3' ); - const vibrateOption9SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-009.mp3' ); - const vibrateOption10SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/vibrate-option-010.mp3' ); const microwavePhotonV1SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/photon-v1-4th-interval-000.mp3' ); const infraredPhotonV1SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/photon-v1-4th-interval-001.mp3' ); const visiblePhotonV1SoundInfo = require( 'sound!MOLECULES_AND_LIGHT/photon-v1-4th-interval-002.mp3' ); @@ -103,6 +98,9 @@ define( require => { // volume of photon emission sounds const PHOTON_SOUND_OUTPUT_LEVEL = 0.1; + // X position at which the lamp emission sound is played, empirically determined + const PLAY_LAMP_EMISSION_X_POSITION = -1400; + /** * Constructor for the screen view of Molecules and Light. * @@ -271,10 +269,11 @@ define( require => { // sound to play when molecule becomes "energized", which is depicted as glowing in the view const moleculeEnergizedLoop = new SoundClip( moleculeEnergizedLoopInfo, { loop: true, - initialOutputLevel: 0.1 + initialOutputLevel: 0.1, + enableControlProperties: [ photonAbsorptionModel.runningProperty ] } ); soundManager.addSoundGenerator( moleculeEnergizedLoop ); - const moleculeEnergizedSoundPlayer = moleculeEnergized => { + const updateMoleculeEnergizedSound = moleculeEnergized => { if ( moleculeEnergized ) { moleculeEnergizedLoop.play(); } @@ -291,29 +290,33 @@ define( require => { }; // molecule rotating sound - const rotateSound = new SoundClip( rotateSoundInfo, { initialOutputLevel: 0.05, loop: true } ); + const rotateSound = new SoundClip( rotateSoundInfo, { + initialOutputLevel: 0.05, + loop: true, + enableControlProperties: [ photonAbsorptionModel.runningProperty ] + } ); soundManager.addSoundGenerator( rotateSound ); - const rotateSoundPlayer = rotating => { + const updateRotationSound = rotating => { rotating ? rotateSound.play() : rotateSound.stop(); }; // molecule vibration sounds + const moleculeVibrationSoundClipOptions = { + initialOutputLevel: 0.2, + loop: true, + enableControlProperties: [ photonAbsorptionModel.runningProperty ] + }; const moleculeVibrationSoundClips = [ - new SoundClip( vibrateOption1SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption2SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption3SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption4SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption5SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption6SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption7SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption8SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption9SoundInfo, { initialOutputLevel: 0.2, loop: true } ), - new SoundClip( vibrateOption10SoundInfo, { initialOutputLevel: 0.2, loop: true } ) + new SoundClip( vibrateOption2SoundInfo, moleculeVibrationSoundClipOptions ), + new SoundClip( vibrateOption2HigherSoundInfo, moleculeVibrationSoundClipOptions ), + new SoundClip( vibrateOption2SaturatedEQSoundInfo, moleculeVibrationSoundClipOptions ), + new SoundClip( vibrateOption4SoundInfo, moleculeVibrationSoundClipOptions ), + new SoundClip( vibrateOption7SoundInfo, moleculeVibrationSoundClipOptions ) ]; moleculeVibrationSoundClips.forEach( soundClip => { soundManager.addSoundGenerator( soundClip ); } ); - const vibrationSoundPlayer = vibrating => { + const updateVibrationSound = vibrating => { const indexToPlay = malSoundOptionsDialogContent.vibrationSoundProperty.value - 1; if ( vibrating ) { @@ -340,10 +343,10 @@ define( require => { // function that adds all of the listeners involved in creating sound const addSoundPlayersToMolecule = molecule => { - molecule.highElectronicEnergyStateProperty.link( moleculeEnergizedSoundPlayer ); + molecule.highElectronicEnergyStateProperty.link( updateMoleculeEnergizedSound ); molecule.brokeApartEmitter.addListener( breakApartSoundPlayer ); - molecule.rotatingProperty.link( rotateSoundPlayer ); - molecule.vibratingProperty.link( vibrationSoundPlayer ); + molecule.rotatingProperty.link( updateRotationSound ); + molecule.vibratingProperty.link( updateVibrationSound ); }; // add listeners to molecules for playing the sounds @@ -352,17 +355,17 @@ define( require => { // remove listeners when the molecules go away photonAbsorptionModel.activeMolecules.addItemRemovedListener( function( removedMolecule ) { - if ( removedMolecule.highElectronicEnergyStateProperty.hasListener( moleculeEnergizedSoundPlayer ) ) { - removedMolecule.highElectronicEnergyStateProperty.unlink( moleculeEnergizedSoundPlayer ); + if ( removedMolecule.highElectronicEnergyStateProperty.hasListener( updateMoleculeEnergizedSound ) ) { + removedMolecule.highElectronicEnergyStateProperty.unlink( updateMoleculeEnergizedSound ); } if ( removedMolecule.brokeApartEmitter.hasListener( breakApartSoundPlayer ) ) { removedMolecule.brokeApartEmitter.removeListener( breakApartSoundPlayer ); } - if ( removedMolecule.rotatingProperty.hasListener( rotateSoundPlayer ) ) { - removedMolecule.rotatingProperty.unlink( rotateSoundPlayer ); + if ( removedMolecule.rotatingProperty.hasListener( updateRotationSound ) ) { + removedMolecule.rotatingProperty.unlink( updateRotationSound ); } - if ( removedMolecule.vibratingProperty.hasListener( vibrationSoundPlayer ) ) { - removedMolecule.vibratingProperty.unlink( vibrationSoundPlayer ); + if ( removedMolecule.vibratingProperty.hasListener( updateVibrationSound ) ) { + removedMolecule.vibratingProperty.unlink( updateVibrationSound ); } } ); @@ -396,19 +399,27 @@ define( require => { } ); } ); photonAbsorptionModel.photons.addItemAddedListener( photon => { - let soundSetIndex; + const soundClipIndex = ORDERED_WAVELENGTHS.indexOf( photon.wavelength ); if ( photon.locationProperty.value.x < 0 ) { // photon was emitted from lamp, use the initial emission sound - soundSetIndex = malSoundOptionsDialogContent.photonInitialEmissionSoundSetProperty.value - 1; + // soundSetIndex = malSoundOptionsDialogContent.photonInitialEmissionSoundSetProperty.value - 1; + + const playEmitFromLampSound = position => { + if ( position.x >= PLAY_LAMP_EMISSION_X_POSITION ) { + const soundSetIndex = malSoundOptionsDialogContent.photonInitialEmissionSoundSetProperty.value - 1; + photonEmissionSoundPlayers[ soundSetIndex ][ soundClipIndex ].play(); + photon.locationProperty.unlink( playEmitFromLampSound ); + } + }; + photon.locationProperty.link( playEmitFromLampSound ); } else { // photon was emitted from lamp, use the secondary emission sound - soundSetIndex = malSoundOptionsDialogContent.photonSecondaryEmissionSoundSetProperty.value - 1; + const soundSetIndex = malSoundOptionsDialogContent.photonSecondaryEmissionSoundSetProperty.value - 1; + photonEmissionSoundPlayers[ soundSetIndex ][ soundClipIndex ].play(); } - const soundClipIndex = ORDERED_WAVELENGTHS.indexOf( photon.wavelength ); - photonEmissionSoundPlayers[ soundSetIndex ][ soundClipIndex ].play(); } ); } diff --git a/js/moleculesandlight/view/malSoundOptionsDialogContent.js b/js/moleculesandlight/view/malSoundOptionsDialogContent.js index 27145534..cdf34243 100644 --- a/js/moleculesandlight/view/malSoundOptionsDialogContent.js +++ b/js/moleculesandlight/view/malSoundOptionsDialogContent.js @@ -42,7 +42,7 @@ define( require => { // @public (read-only) this.photonInitialEmissionSoundSetProperty = new NumberProperty( 3 ); this.photonSecondaryEmissionSoundSetProperty = new NumberProperty( 2 ); - this.vibrationSoundProperty = new NumberProperty( 1 ); + this.vibrationSoundProperty = new NumberProperty( 2 ); // @private {Node} - dialog content, created when requested, see explanation below this.dialogContent = null; @@ -93,7 +93,7 @@ define( require => { // sound selection for molecule vibration const vibrationSoundRadioButtonGroup = new VerticalAquaRadioButtonGroup( this.vibrationSoundProperty, - createNumberedRadioButtonDescriptorSet( 10 ) + createNumberedRadioButtonDescriptorSet( 5 ) ); const vibrationSoundSelectionPanel = new Panel( new VBox( { diff --git a/package.json b/package.json index 9ca9e3b5..d06b11e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "molecules-and-light", - "version": "1.5.0-dev.9", + "version": "1.5.0-dev.11", "license": "GPL-3.0", "repository": { "type": "git", diff --git a/sounds/license.json b/sounds/license.json index 06cdaf78..355852b6 100644 --- a/sounds/license.json +++ b/sounds/license.json @@ -119,14 +119,6 @@ "license": "contact phethelp@colorado.edu", "notes": "created by Ashton Morris (PhET Interactive Simulations)" }, - "vibrate-option-001.mp3": { - "text": [ - "Copyright 2018 University of Colorado Boulder" - ], - "projectURL": "http://phet.colorado.edu", - "license": "contact phethelp@colorado.edu", - "notes": "created by Ashton Morris (PhET Interactive Simulations)" - }, "vibrate-option-002.mp3": { "text": [ "Copyright 2018 University of Colorado Boulder" @@ -135,7 +127,7 @@ "license": "contact phethelp@colorado.edu", "notes": "created by Ashton Morris (PhET Interactive Simulations)" }, - "vibrate-option-003.mp3": { + "vibrate-option-002-higher.mp3": { "text": [ "Copyright 2018 University of Colorado Boulder" ], @@ -143,7 +135,7 @@ "license": "contact phethelp@colorado.edu", "notes": "created by Ashton Morris (PhET Interactive Simulations)" }, - "vibrate-option-004.mp3": { + "vibrate-option-002-saturated-eq.mp3": { "text": [ "Copyright 2018 University of Colorado Boulder" ], @@ -151,15 +143,7 @@ "license": "contact phethelp@colorado.edu", "notes": "created by Ashton Morris (PhET Interactive Simulations)" }, - "vibrate-option-005.mp3": { - "text": [ - "Copyright 2018 University of Colorado Boulder" - ], - "projectURL": "http://phet.colorado.edu", - "license": "contact phethelp@colorado.edu", - "notes": "created by Ashton Morris (PhET Interactive Simulations)" - }, - "vibrate-option-006.mp3": { + "vibrate-option-004.mp3": { "text": [ "Copyright 2018 University of Colorado Boulder" ], @@ -174,29 +158,5 @@ "projectURL": "http://phet.colorado.edu", "license": "contact phethelp@colorado.edu", "notes": "created by Ashton Morris (PhET Interactive Simulations)" - }, - "vibrate-option-008.mp3": { - "text": [ - "Copyright 2018 University of Colorado Boulder" - ], - "projectURL": "http://phet.colorado.edu", - "license": "contact phethelp@colorado.edu", - "notes": "created by Ashton Morris (PhET Interactive Simulations)" - }, - "vibrate-option-009.mp3": { - "text": [ - "Copyright 2018 University of Colorado Boulder" - ], - "projectURL": "http://phet.colorado.edu", - "license": "contact phethelp@colorado.edu", - "notes": "created by Ashton Morris (PhET Interactive Simulations)" - }, - "vibrate-option-010.mp3": { - "text": [ - "Copyright 2018 University of Colorado Boulder" - ], - "projectURL": "http://phet.colorado.edu", - "license": "contact phethelp@colorado.edu", - "notes": "created by Ashton Morris (PhET Interactive Simulations)" } } diff --git a/sounds/vibrate-option-001.mp3 b/sounds/vibrate-option-001.mp3 deleted file mode 100644 index 9f38fc50..00000000 Binary files a/sounds/vibrate-option-001.mp3 and /dev/null differ diff --git a/sounds/vibrate-option-002-higher.mp3 b/sounds/vibrate-option-002-higher.mp3 new file mode 100644 index 00000000..1f22da45 Binary files /dev/null and b/sounds/vibrate-option-002-higher.mp3 differ diff --git a/sounds/vibrate-option-002-saturated-eq.mp3 b/sounds/vibrate-option-002-saturated-eq.mp3 new file mode 100644 index 00000000..d1be2a7e Binary files /dev/null and b/sounds/vibrate-option-002-saturated-eq.mp3 differ diff --git a/sounds/vibrate-option-003.mp3 b/sounds/vibrate-option-003.mp3 deleted file mode 100644 index a632862d..00000000 Binary files a/sounds/vibrate-option-003.mp3 and /dev/null differ diff --git a/sounds/vibrate-option-005.mp3 b/sounds/vibrate-option-005.mp3 deleted file mode 100644 index 0ecb7c65..00000000 Binary files a/sounds/vibrate-option-005.mp3 and /dev/null differ diff --git a/sounds/vibrate-option-006.mp3 b/sounds/vibrate-option-006.mp3 deleted file mode 100644 index 72ecebe8..00000000 Binary files a/sounds/vibrate-option-006.mp3 and /dev/null differ diff --git a/sounds/vibrate-option-008.mp3 b/sounds/vibrate-option-008.mp3 deleted file mode 100644 index b8600c41..00000000 Binary files a/sounds/vibrate-option-008.mp3 and /dev/null differ diff --git a/sounds/vibrate-option-009.mp3 b/sounds/vibrate-option-009.mp3 deleted file mode 100644 index 168f219f..00000000 Binary files a/sounds/vibrate-option-009.mp3 and /dev/null differ diff --git a/sounds/vibrate-option-010.mp3 b/sounds/vibrate-option-010.mp3 deleted file mode 100644 index 7d497bde..00000000 Binary files a/sounds/vibrate-option-010.mp3 and /dev/null differ