Skip to content

Commit

Permalink
removed @Private annotations, see #161
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Apr 22, 2022
1 parent a2979ba commit 7f6541a
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 46 deletions.
14 changes: 3 additions & 11 deletions js/AmplitudeModulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<OscillatorType>( 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

Expand All @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion js/demo/testing/view/CompositeSoundClipTestNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CompositeSoundClipTestNode extends VBox {
spacing: 20
}, options ) );

// @private - dispose function
// dispose function
this.disposeCompositeSoundClipTestNode = () => {
soundManager.removeSoundGenerator( compositeSoundClip );
compositeSoundClip.dispose();
Expand Down
2 changes: 1 addition & 1 deletion js/demo/testing/view/SoundClipChordTestNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SoundClipChordTestNode extends VBox {
spacing: 20
}, providedOptions ) );

// @private - dispose function
// dispose function
this.disposeSoundClipChordTestNode = () => {
soundManager.removeSoundGenerator( chordSoundClipChord );
chordSoundClipChord.dispose();
Expand Down
6 changes: 3 additions & 3 deletions js/demo/testing/view/TestingScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class BasicAndEnhancedSoundTestNode extends VBox {
spacing: 20
}, options ) );

// @private - dispose function
// dispose function
this.disposeBasicAndEnhancedSoundTestNode = () => {
soundManager.removeSoundGenerator( loonCallSoundClip );
loonCallSoundClip.dispose();
Expand Down Expand Up @@ -235,7 +235,7 @@ class AdditionalAudioNodesTestNode extends VBox {
spacing: 20
}, options ) );

// @private - dispose function
// dispose function
this.disposeBasicAndEnhancedSoundTestNode = () => {
soundManager.removeSoundGenerator( shortSoundNormal );
shortSoundNormal.dispose();
Expand Down Expand Up @@ -354,7 +354,7 @@ class LongSoundTestPanel extends Node {
};
resetInProgressProperty.link( resetHandler );

// @private - dispose function
// dispose function
this.disposeLongSoundTestPanel = () => {
resetInProgressProperty.unlink( resetHandler );
soundManager.removeSoundGenerator( thunderSoundClip );
Expand Down
5 changes: 1 addition & 4 deletions js/multiSelectionSoundPlayerFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -85,8 +84,6 @@ class FixedSpeedSoundClipPlayer {
private readonly playbackRate: number;

constructor( soundPlayer: SoundClip, playbackRate: number ) {

// @private
this.soundPlayer = soundPlayer;
this.playbackRate = playbackRate;
}
Expand Down
4 changes: 1 addition & 3 deletions js/sound-generators/ContinuousPropertySoundGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -127,7 +125,7 @@ class ContinuousPropertySoundGenerator extends SoundClip {
};
property.lazyLink( listener );

// @private {function}
// dispose function
this.disposeContinuousPropertySoundGenerator = () => property.unlink( listener );
}

Expand Down
3 changes: 1 addition & 2 deletions js/sound-generators/DiscreteSoundGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ); };
}

Expand Down Expand Up @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions js/sound-generators/MultiClip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ class MultiClip<T> 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;
}

Expand Down
8 changes: 4 additions & 4 deletions js/sound-generators/NoiseGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 ) {
Expand Down
5 changes: 1 addition & 4 deletions js/sound-generators/OscillatorSoundGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions js/sound-generators/PitchedPopGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, () => {

Expand Down
2 changes: 1 addition & 1 deletion js/sound-generators/PropertyMultiClip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PropertyMultiClip<T> extends MultiClip<T> {
property.link( playSoundForValue );
}

// @private - dispose function
// dispose function
this.disposePropertyMultiClip = () => { property.unlink( playSoundForValue ); };
}

Expand Down
3 changes: 0 additions & 3 deletions js/sound-generators/SoundClipChord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion js/sound-generators/SoundClipPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f6541a

Please sign in to comment.