Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Nov 5, 2019
2 parents e3ee782 + 24dc697 commit 098b165
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 86 deletions.
8 changes: 4 additions & 4 deletions dependencies.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -13,23 +13,23 @@
"branch": "master"
},
"chipper": {
"sha": "59fdc88e1a6079b108ca063367b21a1bea79b853",
"sha": "9f69f9e381778e740ced31d914f69e7664c36fd7",
"branch": "master"
},
"dot": {
"sha": "26ce07a0435f2d73b41adf3327eb575f5c81ea0b",
"branch": "master"
},
"joist": {
"sha": "21d163d28b186bf0a7b3226ca769402a0d8a0d38",
"sha": "7fbe5dcd309a818964232b828266f503027156a7",
"branch": "master"
},
"kite": {
"sha": "f2a44d834638ec6c0705150f82f69dab2db4434b",
"branch": "master"
},
"molecules-and-light": {
"sha": "46a5d257353216bd7517316dc10603e1781bc917",
"sha": "b7870023f40bb07ab553f8f6223d92e966c41b9e",
"branch": "master"
},
"nitroglycerin": {
Expand Down
83 changes: 47 additions & 36 deletions js/moleculesandlight/view/MoleculesAndLightScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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();
}
Expand All @@ -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 ) {

Expand All @@ -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
Expand All @@ -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 );
}
} );

Expand Down Expand Up @@ -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();
} );
}

Expand Down
4 changes: 2 additions & 2 deletions js/moleculesandlight/view/malSoundOptionsDialogContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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( {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
46 changes: 3 additions & 43 deletions sounds/license.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@
"license": "contact [email protected]",
"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 [email protected]",
"notes": "created by Ashton Morris (PhET Interactive Simulations)"
},
"vibrate-option-002.mp3": {
"text": [
"Copyright 2018 University of Colorado Boulder"
Expand All @@ -135,31 +127,23 @@
"license": "contact [email protected]",
"notes": "created by Ashton Morris (PhET Interactive Simulations)"
},
"vibrate-option-003.mp3": {
"vibrate-option-002-higher.mp3": {
"text": [
"Copyright 2018 University of Colorado Boulder"
],
"projectURL": "http://phet.colorado.edu",
"license": "contact [email protected]",
"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"
],
"projectURL": "http://phet.colorado.edu",
"license": "contact [email protected]",
"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 [email protected]",
"notes": "created by Ashton Morris (PhET Interactive Simulations)"
},
"vibrate-option-006.mp3": {
"vibrate-option-004.mp3": {
"text": [
"Copyright 2018 University of Colorado Boulder"
],
Expand All @@ -174,29 +158,5 @@
"projectURL": "http://phet.colorado.edu",
"license": "contact [email protected]",
"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 [email protected]",
"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 [email protected]",
"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 [email protected]",
"notes": "created by Ashton Morris (PhET Interactive Simulations)"
}
}
Binary file removed sounds/vibrate-option-001.mp3
Binary file not shown.
Binary file added sounds/vibrate-option-002-higher.mp3
Binary file not shown.
Binary file added sounds/vibrate-option-002-saturated-eq.mp3
Binary file not shown.
Binary file removed sounds/vibrate-option-003.mp3
Binary file not shown.
Binary file removed sounds/vibrate-option-005.mp3
Binary file not shown.
Binary file removed sounds/vibrate-option-006.mp3
Binary file not shown.
Binary file removed sounds/vibrate-option-008.mp3
Binary file not shown.
Binary file removed sounds/vibrate-option-009.mp3
Binary file not shown.
Binary file removed sounds/vibrate-option-010.mp3
Binary file not shown.

0 comments on commit 098b165

Please sign in to comment.