Skip to content

Commit

Permalink
use undefined instead of soundConstants, so we're not making assumpti…
Browse files Browse the repository at this point in the history
…ons about default behavior of setOutputLevel
  • Loading branch information
pixelzoom committed Jun 14, 2021
1 parent 134961f commit fdf6627
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/discrete/view/FourierSoundGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Range from '../../../../dot/js/Range.js';
import AssertUtils from '../../../../phetcommon/js/AssertUtils.js';
import OscillatorSoundGenerator from '../../../../tambo/js/sound-generators/OscillatorSoundGenerator.js';
import SoundGenerator from '../../../../tambo/js/sound-generators/SoundGenerator.js';
import soundConstants from '../../../../tambo/js/soundConstants.js';
import FMWConstants from '../../common/FMWConstants.js';
import FourierSeries from '../../common/model/FourierSeries.js';
import fourierMakingWaves from '../../fourierMakingWaves.js';
Expand Down Expand Up @@ -62,10 +61,11 @@ class FourierSoundGenerator extends SoundGenerator {
// Set amplitudes for harmonics. unlink is not needed.
fourierSeries.amplitudesProperty.lazyLink( amplitudes => {

// If audio is disabled, update immediately by using timeConstant=0. Otherwise we'll briefly hear stale
// output levels the next time that oscillatorSoundGenerator.play is called.
// If audio is disabled, update immediately by using optional timeConstant=0. This cancels scheduled values on
// the master gain node. If we do not do this, then we'll briefly hear stale output levels the next time that
// oscillatorSoundGenerator.play is called.
// See https://github.com/phetsims/fourier-making-waves/issues/45
const timeConstant = enabledProperty.value ? soundConstants.DEFAULT_PARAM_CHANGE_TIME_CONSTANT : 0;
const timeConstant = enabledProperty.value ? undefined : 0;

// Set amplitudes for the harmonics.
for ( let i = 0; i < amplitudes.length; i++ ) {
Expand Down

0 comments on commit fdf6627

Please sign in to comment.