From 7f6541a6d551d028e6642a6e013782c20efdaf45 Mon Sep 17 00:00:00 2001 From: jbphet Date: Fri, 22 Apr 2022 14:47:01 -0600 Subject: [PATCH] removed @private annotations, see https://github.com/phetsims/tambo/issues/161 --- js/AmplitudeModulator.ts | 14 +++----------- js/demo/testing/view/CompositeSoundClipTestNode.ts | 2 +- js/demo/testing/view/SoundClipChordTestNode.ts | 2 +- js/demo/testing/view/TestingScreenView.ts | 6 +++--- js/multiSelectionSoundPlayerFactory.ts | 5 +---- .../ContinuousPropertySoundGenerator.ts | 4 +--- js/sound-generators/DiscreteSoundGenerator.ts | 3 +-- js/sound-generators/MultiClip.ts | 5 ----- js/sound-generators/NoiseGenerator.ts | 8 ++++---- js/sound-generators/OscillatorSoundGenerator.ts | 5 +---- js/sound-generators/PitchedPopGenerator.ts | 4 +--- js/sound-generators/PropertyMultiClip.ts | 2 +- js/sound-generators/SoundClipChord.ts | 3 --- js/sound-generators/SoundClipPlayer.ts | 1 - 14 files changed, 18 insertions(+), 46 deletions(-) diff --git a/js/AmplitudeModulator.ts b/js/AmplitudeModulator.ts index 15bbe2e9..8fcd9bd1 100644 --- a/js/AmplitudeModulator.ts +++ b/js/AmplitudeModulator.ts @@ -62,19 +62,9 @@ class AmplitudeModulator extends EnabledComponent { super( options ); - // {NumberProperty} - frequency of the oscillation, generally pretty low, like 1 to 20 or so this.frequencyProperty = options.frequencyProperty || new NumberProperty( DEFAULT_FREQUENCY ); - - // {NumberProperty} - 0 for no audible oscillation, 1 for full modulation this.depthProperty = options.depthProperty || new NumberProperty( DEFAULT_DEPTH ); - - // {StringProperty} - Web Audio oscillator type this.waveformProperty = options.waveformProperty || new Property( DEFAULT_WAVEFORM ); - - // the low frequency oscillator (LFO) that will control the modulation, created in the handler below - let lowFrequencyOscillator: OscillatorNode | null = null; - - // @private {GainNode} - the main gain node that is modulated in order to produce the amplitude modulation effect this.modulatedGainNode = phetAudioContext.createGain(); this.modulatedGainNode.gain.value = 0.5; // this value is added to the attenuated LFO output value @@ -83,6 +73,8 @@ class AmplitudeModulator extends EnabledComponent { const lfoAttenuator = phetAudioContext.createGain(); lfoAttenuator.connect( this.modulatedGainNode.gain ); + let lowFrequencyOscillator: OscillatorNode | null = null; + // hook up the LFO-control properties const enabledListener = ( enabled: boolean ) => { const now = phetAudioContext.currentTime; @@ -137,7 +129,7 @@ class AmplitudeModulator extends EnabledComponent { }; this.frequencyProperty.link( frequencyListener ); - // @private + // dispose function this.disposeAmplitudeModulator = () => { this.enabledProperty.unlink( enabledListener ); this.depthProperty.unlink( depthListener ); diff --git a/js/demo/testing/view/CompositeSoundClipTestNode.ts b/js/demo/testing/view/CompositeSoundClipTestNode.ts index de61b137..8c70f877 100644 --- a/js/demo/testing/view/CompositeSoundClipTestNode.ts +++ b/js/demo/testing/view/CompositeSoundClipTestNode.ts @@ -54,7 +54,7 @@ class CompositeSoundClipTestNode extends VBox { spacing: 20 }, options ) ); - // @private - dispose function + // dispose function this.disposeCompositeSoundClipTestNode = () => { soundManager.removeSoundGenerator( compositeSoundClip ); compositeSoundClip.dispose(); diff --git a/js/demo/testing/view/SoundClipChordTestNode.ts b/js/demo/testing/view/SoundClipChordTestNode.ts index e38c1c4a..17dac334 100644 --- a/js/demo/testing/view/SoundClipChordTestNode.ts +++ b/js/demo/testing/view/SoundClipChordTestNode.ts @@ -49,7 +49,7 @@ class SoundClipChordTestNode extends VBox { spacing: 20 }, providedOptions ) ); - // @private - dispose function + // dispose function this.disposeSoundClipChordTestNode = () => { soundManager.removeSoundGenerator( chordSoundClipChord ); chordSoundClipChord.dispose(); diff --git a/js/demo/testing/view/TestingScreenView.ts b/js/demo/testing/view/TestingScreenView.ts index f66f3801..c3865b64 100644 --- a/js/demo/testing/view/TestingScreenView.ts +++ b/js/demo/testing/view/TestingScreenView.ts @@ -164,7 +164,7 @@ class BasicAndEnhancedSoundTestNode extends VBox { spacing: 20 }, options ) ); - // @private - dispose function + // dispose function this.disposeBasicAndEnhancedSoundTestNode = () => { soundManager.removeSoundGenerator( loonCallSoundClip ); loonCallSoundClip.dispose(); @@ -235,7 +235,7 @@ class AdditionalAudioNodesTestNode extends VBox { spacing: 20 }, options ) ); - // @private - dispose function + // dispose function this.disposeBasicAndEnhancedSoundTestNode = () => { soundManager.removeSoundGenerator( shortSoundNormal ); shortSoundNormal.dispose(); @@ -354,7 +354,7 @@ class LongSoundTestPanel extends Node { }; resetInProgressProperty.link( resetHandler ); - // @private - dispose function + // dispose function this.disposeLongSoundTestPanel = () => { resetInProgressProperty.unlink( resetHandler ); soundManager.removeSoundGenerator( thunderSoundClip ); diff --git a/js/multiSelectionSoundPlayerFactory.ts b/js/multiSelectionSoundPlayerFactory.ts index cb0908ae..16f6893d 100644 --- a/js/multiSelectionSoundPlayerFactory.ts +++ b/js/multiSelectionSoundPlayerFactory.ts @@ -34,9 +34,8 @@ class MultiSelectionSoundPlayerFactory { /** * get the single instance of the sound player, and create it if it doesn't exist yet - * @private */ - getSoundClipInstance() { + private getSoundClipInstance() { if ( !this._basisSoundClip ) { this._basisSoundClip = new SoundClip( radioButtonV2_mp3, { initialOutputLevel: 0.7, @@ -85,8 +84,6 @@ class FixedSpeedSoundClipPlayer { private readonly playbackRate: number; constructor( soundPlayer: SoundClip, playbackRate: number ) { - - // @private this.soundPlayer = soundPlayer; this.playbackRate = playbackRate; } diff --git a/js/sound-generators/ContinuousPropertySoundGenerator.ts b/js/sound-generators/ContinuousPropertySoundGenerator.ts index 036cbf76..13c94048 100644 --- a/js/sound-generators/ContinuousPropertySoundGenerator.ts +++ b/js/sound-generators/ContinuousPropertySoundGenerator.ts @@ -97,8 +97,6 @@ class ContinuousPropertySoundGenerator extends SoundClip { this.fadeTime = options.fadeTime; this.delayBeforeStop = options.delayBeforeStop; this.nonFadedOutputLevel = options.initialOutputLevel === undefined ? 1 : options.initialOutputLevel; - - // @private {number} - countdown time used for fade out this.remainingFadeTime = 0; // start with the output level at zero so that the initial sound generation has a bit of fade in @@ -127,7 +125,7 @@ class ContinuousPropertySoundGenerator extends SoundClip { }; property.lazyLink( listener ); - // @private {function} + // dispose function this.disposeContinuousPropertySoundGenerator = () => property.unlink( listener ); } diff --git a/js/sound-generators/DiscreteSoundGenerator.ts b/js/sound-generators/DiscreteSoundGenerator.ts index 1dd526dc..9f3aa0a0 100644 --- a/js/sound-generators/DiscreteSoundGenerator.ts +++ b/js/sound-generators/DiscreteSoundGenerator.ts @@ -92,7 +92,7 @@ class DiscreteSoundGenerator extends SoundClip { // monitor the value, playing sounds when appropriate valueProperty.lazyLink( playSoundOnChanges ); - // @private {function} + // dispose function this.disposeDiscreteSoundGenerator = () => { valueProperty.unlink( playSoundOnChanges ); }; } @@ -120,7 +120,6 @@ class BinSelector { // parameter checking assert && assert( numBins > 0 ); - // @private this.minValue = valueRange.min; this.maxValue = valueRange.max; this.span = valueRange.getLength(); diff --git a/js/sound-generators/MultiClip.ts b/js/sound-generators/MultiClip.ts index 31d65a0a..8e5faf11 100644 --- a/js/sound-generators/MultiClip.ts +++ b/js/sound-generators/MultiClip.ts @@ -78,13 +78,8 @@ class MultiClip extends SoundGenerator { } } ); - // @private this.playbackRate = ( options.initialPlaybackRate === undefined ) ? 1 : options.initialPlaybackRate; - - // @private {function|null} - a listener for implementing deferred play requests, see usage for details this.audioContextStateChangeListener = null; - - // @private {number} - time at which a deferred play request occurred, in milliseconds since epoch this.timeOfDeferredPlayRequest = Number.NEGATIVE_INFINITY; } diff --git a/js/sound-generators/NoiseGenerator.ts b/js/sound-generators/NoiseGenerator.ts index 42443f67..91ca249a 100644 --- a/js/sound-generators/NoiseGenerator.ts +++ b/js/sound-generators/NoiseGenerator.ts @@ -145,7 +145,7 @@ class NoiseGenerator extends SoundGenerator { // define the noise data const noiseBufferSize = NOISE_BUFFER_SECONDS * this.audioContext.sampleRate; - this.noiseBuffer = this.audioContext.createBuffer( 1, noiseBufferSize, this.audioContext.sampleRate ); // @private + this.noiseBuffer = this.audioContext.createBuffer( 1, noiseBufferSize, this.audioContext.sampleRate ); const data = this.noiseBuffer.getChannelData( 0 ); // fill in the sample buffer based on the noise type @@ -200,12 +200,12 @@ class NoiseGenerator extends SoundGenerator { this.lfo.frequency.setValueAtTime( options.lfoInitialFrequency, now ); this.lfo.start(); - // @private {GainNode} - a gain stage to attenuate the LFO output so that it will range from -0.5 to +0.5 + // set up the gain stage that will attenuate the LFO output so that it will range from -0.5 to +0.5 this.lfoAttenuatorGainNode = this.audioContext.createGain(); this.lfoAttenuatorGainNode.gain.value = options.lfoInitialDepth / 2; this.lfo.connect( this.lfoAttenuatorGainNode ); - // @private {GainNode} - a gain stage for the LFO - the main sound path will run through here + // set up the gain stage for the LFO - the main sound path will run through here this.lfoControlledGainNode = this.audioContext.createGain(); this.lfoControlledGainNode.gain.value = 0.5; // this value is added to the attenuated LFO output value @@ -240,7 +240,7 @@ class NoiseGenerator extends SoundGenerator { // @private {number} - time at which a deferred play request occurred. this.timeOfDeferredStartRequest = Number.NEGATIVE_INFINITY; - // @private {function} - callback for when audio context isn't in 'running' state, see usage + // define the listener for audio context state transitions this.audioContextStateChangeListener = state => { if ( state === 'running' && this.isPlaying ) { diff --git a/js/sound-generators/OscillatorSoundGenerator.ts b/js/sound-generators/OscillatorSoundGenerator.ts index be61d50c..8f32c1c7 100644 --- a/js/sound-generators/OscillatorSoundGenerator.ts +++ b/js/sound-generators/OscillatorSoundGenerator.ts @@ -41,11 +41,8 @@ class OscillatorSoundGenerator extends SoundGenerator { super( options ); - // @private {OscillatorNode|null} - The Web Audio oscillator node that will be created when play is called, and set - // to null when stopped (Web Audio oscillators are meant to be single use only). + // state initialization this.oscillatorNode = null; - - // @private this.frequency = options.initialFrequency; this.waveformType = options.initialWaveformType; } diff --git a/js/sound-generators/PitchedPopGenerator.ts b/js/sound-generators/PitchedPopGenerator.ts index f92c425a..072b558e 100644 --- a/js/sound-generators/PitchedPopGenerator.ts +++ b/js/sound-generators/PitchedPopGenerator.ts @@ -63,9 +63,7 @@ class PitchedPopGenerator extends SoundGenerator { dynamicsCompressorNode.release.setValueAtTime( 0.25, now ); dynamicsCompressorNode.connect( this.soundSourceDestination ); - // create the sources - several are created so that pops can be played in rapid succession if desired - // @private {{oscillator:OscillatorNode, gainNode:GainNode}[]} - an array of sound source, several are created so - // that pops can be played in rapid succession without interfering with one another + // Create the sound sources - several are created so that pops can be played in rapid succession if desired. this.soundSources = []; _.times( options.numPopGenerators, () => { diff --git a/js/sound-generators/PropertyMultiClip.ts b/js/sound-generators/PropertyMultiClip.ts index 969e9192..71681934 100644 --- a/js/sound-generators/PropertyMultiClip.ts +++ b/js/sound-generators/PropertyMultiClip.ts @@ -48,7 +48,7 @@ class PropertyMultiClip extends MultiClip { property.link( playSoundForValue ); } - // @private - dispose function + // dispose function this.disposePropertyMultiClip = () => { property.unlink( playSoundForValue ); }; } diff --git a/js/sound-generators/SoundClipChord.ts b/js/sound-generators/SoundClipChord.ts index ffa1b871..229975b0 100644 --- a/js/sound-generators/SoundClipChord.ts +++ b/js/sound-generators/SoundClipChord.ts @@ -67,11 +67,8 @@ class SoundClipChord extends SoundGenerator implements ISoundPlayer { super( options ); - // @private this.arpeggiate = options.arpeggiate; this.arpeggiateTime = options.arpeggiateTime; - - // @private this.playbackSoundClips = options.chordPlaybackRates.map( playbackRate => { const soundClip = new SoundClip( sound, merge( { initialPlaybackRate: playbackRate diff --git a/js/sound-generators/SoundClipPlayer.ts b/js/sound-generators/SoundClipPlayer.ts index 12aaf9cd..412854ba 100644 --- a/js/sound-generators/SoundClipPlayer.ts +++ b/js/sound-generators/SoundClipPlayer.ts @@ -43,7 +43,6 @@ class SoundClipPlayer { soundManagerOptions: {} }, providedOptions ); - // {SoundClip} @private this._soundClip = new SoundClip( wrappedAudioBuffer, options.soundClipOptions ); // automatically register this sound clip with the sound manager