diff --git a/js/PeakDetectorAudioNode.ts b/js/PeakDetectorAudioNode.ts index 1dafba9..156bf31 100644 --- a/js/PeakDetectorAudioNode.ts +++ b/js/PeakDetectorAudioNode.ts @@ -35,7 +35,7 @@ export type PeakDetectorAudioNodeOptions = { class PeakDetectorAudioNode extends AudioWorkletNode { - constructor( providedOptions: PeakDetectorAudioNodeOptions ) { + constructor( providedOptions?: PeakDetectorAudioNodeOptions ) { const options = optionize()( { logZeroValues: false diff --git a/js/demo/TamboKeyboardHelpContent.ts b/js/demo/TamboKeyboardHelpContent.ts index 4f9a58d..57c185f 100644 --- a/js/demo/TamboKeyboardHelpContent.ts +++ b/js/demo/TamboKeyboardHelpContent.ts @@ -12,10 +12,6 @@ import { HBox } from '../../../scenery/js/imports.js'; import tambo from '../tambo.js'; class TamboKeyboardHelpContent extends HBox { - - /** - * @constructor - */ constructor() { super( { children: [ new BasicActionsKeyboardHelpSection() ], align: 'top', spacing: 30 } ); } diff --git a/js/demo/testing/view/AmplitudeModulatorDemoNode.ts b/js/demo/testing/view/AmplitudeModulatorDemoNode.ts index 98d0b58..3ed244d 100644 --- a/js/demo/testing/view/AmplitudeModulatorDemoNode.ts +++ b/js/demo/testing/view/AmplitudeModulatorDemoNode.ts @@ -26,7 +26,7 @@ const LABEL_FONT = new PhetFont( 16 ); class AmplitudeModulatorDemoNode extends VBox { - constructor( providedOptions: AmplitudeModulatorDemoNodeOptions ) { + constructor( providedOptions?: AmplitudeModulatorDemoNodeOptions ) { const soundSourceRadioButtonItems = [ { diff --git a/js/demo/testing/view/ContinuousPropertySoundGeneratorTestNode.ts b/js/demo/testing/view/ContinuousPropertySoundGeneratorTestNode.ts index ab685fe..689753b 100644 --- a/js/demo/testing/view/ContinuousPropertySoundGeneratorTestNode.ts +++ b/js/demo/testing/view/ContinuousPropertySoundGeneratorTestNode.ts @@ -33,7 +33,7 @@ class ContinuousPropertySoundGeneratorTestNode extends VBox { // dispose function private readonly disposeContinuousPropertySoundGeneratorTestNode: () => void; - constructor( stepEmitter: Emitter<[ number ]>, providedOptions: ContinuousPropertySoundGeneratorTestNodeOptions ) { + constructor( stepEmitter: Emitter<[ number ]>, providedOptions?: ContinuousPropertySoundGeneratorTestNodeOptions ) { // keep track of listeners added to the step emitter so that they can be disposed const stepListeners: ( ( dt: number ) => void )[] = []; diff --git a/js/demo/testing/view/RemoveAndDisposeSoundGeneratorsTestPanel.ts b/js/demo/testing/view/RemoveAndDisposeSoundGeneratorsTestPanel.ts index ce4f169..1919991 100644 --- a/js/demo/testing/view/RemoveAndDisposeSoundGeneratorsTestPanel.ts +++ b/js/demo/testing/view/RemoveAndDisposeSoundGeneratorsTestPanel.ts @@ -66,7 +66,7 @@ const SOUND_GENERATOR_INFO = new Map( [ class RemoveAndDisposeSoundGeneratorsTestPanel extends Panel { - constructor( providedOptions: RemoveAndDisposeSoundGeneratorsTestPanelOptions ) { + constructor( providedOptions?: RemoveAndDisposeSoundGeneratorsTestPanelOptions ) { const options = optionize()( { fill: '#f5d3b3', diff --git a/js/demo/testing/view/SoundClipChordTestNode.ts b/js/demo/testing/view/SoundClipChordTestNode.ts index 17dac33..269e6c8 100644 --- a/js/demo/testing/view/SoundClipChordTestNode.ts +++ b/js/demo/testing/view/SoundClipChordTestNode.ts @@ -22,7 +22,7 @@ class SoundClipChordTestNode extends VBox { private readonly disposeSoundClipChordTestNode: () => void; - constructor( providedOptions: SoundClipChordTestNodeOptions ) { + constructor( providedOptions?: SoundClipChordTestNodeOptions ) { // sound clips to be played const chordSoundClipChord = new SoundClipChord( brightMarimba_mp3 ); diff --git a/js/demo/testing/view/TestingScreenView.ts b/js/demo/testing/view/TestingScreenView.ts index c3865b6..daa072b 100644 --- a/js/demo/testing/view/TestingScreenView.ts +++ b/js/demo/testing/view/TestingScreenView.ts @@ -47,9 +47,6 @@ class TestingScreenView extends DemosScreenView { private readonly stepEmitter: Emitter<[ number ]>; - /** - * @constructor - */ constructor() { const resetInProgressProperty = new BooleanProperty( false ); diff --git a/js/demo/ui-components/model/UIComponentsModel.ts b/js/demo/ui-components/model/UIComponentsModel.ts index 923a37d..2d42a4a 100644 --- a/js/demo/ui-components/model/UIComponentsModel.ts +++ b/js/demo/ui-components/model/UIComponentsModel.ts @@ -15,9 +15,6 @@ class UIComponentsModel { // tracks whether a reset is happening public readonly resetInProgressProperty: BooleanProperty; - /** - * @constructor - */ constructor() { this.resetInProgressProperty = new BooleanProperty( false ); } diff --git a/js/sound-generators/ContinuousPropertySoundGenerator.ts b/js/sound-generators/ContinuousPropertySoundGenerator.ts index 13c9404..7d55039 100644 --- a/js/sound-generators/ContinuousPropertySoundGenerator.ts +++ b/js/sound-generators/ContinuousPropertySoundGenerator.ts @@ -68,7 +68,6 @@ class ContinuousPropertySoundGenerator extends SoundClip { * may require it to be a .wav file, since .mp3 files generally have a bit of silence at the beginning. * @param range - the range of values that the provided property can take on * @param [providedOptions] - * @constructor */ constructor( property: NumberProperty, sound: WrappedAudioBuffer, diff --git a/js/sound-generators/DiscreteSoundGenerator.ts b/js/sound-generators/DiscreteSoundGenerator.ts index 9f3aa0a..c917e12 100644 --- a/js/sound-generators/DiscreteSoundGenerator.ts +++ b/js/sound-generators/DiscreteSoundGenerator.ts @@ -46,12 +46,11 @@ class DiscreteSoundGenerator extends SoundClip { private readonly disposeDiscreteSoundGenerator: () => void; /** - * valueProperty - the value that is monitored to trigger sounds - * valueRange - the range of values expected and over which sounds will be played - * options - options for this sound generation and its parent class - * @constructor + * @param valueProperty - the value that is monitored to trigger sounds + * @param valueRange - the range of values expected and over which sounds will be played + * @param [providedOptions] - options for this sound generation and its parent class */ - constructor( valueProperty: NumberProperty, valueRange: Range, providedOptions: DiscreteSoundGeneratorOptions ) { + constructor( valueProperty: NumberProperty, valueRange: Range, providedOptions?: DiscreteSoundGeneratorOptions ) { const options = optionize()( { sound: brightMarimba_mp3, diff --git a/js/sound-generators/MultiClip.ts b/js/sound-generators/MultiClip.ts index 8e5faf1..7aa410b 100644 --- a/js/sound-generators/MultiClip.ts +++ b/js/sound-generators/MultiClip.ts @@ -56,7 +56,7 @@ class MultiClip extends SoundGenerator { * associated with the value. * @param [providedOptions] */ - constructor( valueToWrappedAudioBufferMap: Map, providedOptions: MultiClipOptions ) { + constructor( valueToWrappedAudioBufferMap: Map, providedOptions?: MultiClipOptions ) { const options = optionize()( { initialPlaybackRate: 1 diff --git a/js/sound-generators/NoiseGenerator.ts b/js/sound-generators/NoiseGenerator.ts index 91ca249..d9e04a3 100644 --- a/js/sound-generators/NoiseGenerator.ts +++ b/js/sound-generators/NoiseGenerator.ts @@ -75,7 +75,7 @@ class NoiseGenerator extends SoundGenerator { // function that handles changes to the audio context private readonly audioContextStateChangeListener: ( state: string ) => void; - constructor( providedOptions: NoiseGeneratorOptions ) { + constructor( providedOptions?: NoiseGeneratorOptions ) { const options = optionize()( { noiseType: 'pink', // valid values are 'white', 'pink', and 'brown' @@ -236,8 +236,6 @@ class NoiseGenerator extends SoundGenerator { this.noiseSourceConnectionPoint = nextOutputToConnect; this.isPlaying = false; - - // @private {number} - time at which a deferred play request occurred. this.timeOfDeferredStartRequest = Number.NEGATIVE_INFINITY; // define the listener for audio context state transitions diff --git a/js/sound-generators/OscillatorSoundGenerator.ts b/js/sound-generators/OscillatorSoundGenerator.ts index 8f32c1c..626b42c 100644 --- a/js/sound-generators/OscillatorSoundGenerator.ts +++ b/js/sound-generators/OscillatorSoundGenerator.ts @@ -32,7 +32,7 @@ class OscillatorSoundGenerator extends SoundGenerator { private readonly frequency: number; private waveformType: OscillatorType; - constructor( providedOptions: OscillatorSoundGeneratorOptions ) { + constructor( providedOptions?: OscillatorSoundGeneratorOptions ) { const options = optionize()( { initialFrequency: 440, diff --git a/js/sound-generators/PitchedPopGenerator.ts b/js/sound-generators/PitchedPopGenerator.ts index 072b558..10959d4 100644 --- a/js/sound-generators/PitchedPopGenerator.ts +++ b/js/sound-generators/PitchedPopGenerator.ts @@ -38,7 +38,7 @@ class PitchedPopGenerator extends SoundGenerator { // next sound source to use to play a sound private nextSoundSourceIndex: number; - constructor( providedOptions: PitchedPopGeneratorOptions ) { + constructor( providedOptions?: PitchedPopGeneratorOptions ) { const options = optionize()( { pitchRange: new Range( 220, 660 ), diff --git a/js/sound-generators/PropertyMultiClip.ts b/js/sound-generators/PropertyMultiClip.ts index 7168193..5189f63 100644 --- a/js/sound-generators/PropertyMultiClip.ts +++ b/js/sound-generators/PropertyMultiClip.ts @@ -31,7 +31,7 @@ class PropertyMultiClip extends MultiClip { * between values and sounds. * @param [providedOptions] */ - constructor( property: Property, valueToSoundMap: Map, providedOptions: PropertyMultiClipOptions ) { + constructor( property: Property, valueToSoundMap: Map, providedOptions?: PropertyMultiClipOptions ) { const options = optionize()( { linkLazily: true diff --git a/js/sound-generators/SoundClipPlayer.ts b/js/sound-generators/SoundClipPlayer.ts index 412854b..86b25c9 100644 --- a/js/sound-generators/SoundClipPlayer.ts +++ b/js/sound-generators/SoundClipPlayer.ts @@ -34,7 +34,6 @@ class SoundClipPlayer { /** * @param wrappedAudioBuffer - a Web Audio audio buffer containing decoded audio samples * @param [providedOptions] - * @constructor */ constructor( wrappedAudioBuffer: WrappedAudioBuffer, providedOptions?: SoundClipPlayerOptions ) { diff --git a/js/soundManager.ts b/js/soundManager.ts index ff4d82e..5fc2785 100644 --- a/js/soundManager.ts +++ b/js/soundManager.ts @@ -145,7 +145,7 @@ class SoundManager extends PhetioObject { simVisibleProperty: BooleanProperty, simActiveProperty: BooleanProperty, simSettingPhetioStateProperty: BooleanProperty, - providedOptions: SoundGeneratorInitializationOptions ) { + providedOptions?: SoundGeneratorInitializationOptions ) { assert && assert( !this.initialized, 'can\'t initialize the sound manager more than once' ); @@ -345,7 +345,12 @@ class SoundManager extends PhetioObject { * Add a sound generator. This connects the sound generator to the audio path, puts it on the list of sound * generators, and creates and returns a unique ID. */ - public addSoundGenerator( soundGenerator: SoundGenerator, providedOptions: SoundGeneratorAddOptions = {} ) { + public addSoundGenerator( soundGenerator: SoundGenerator, providedOptions?: SoundGeneratorAddOptions ) { + + // We'll need an empty object of no options were provided. + if ( providedOptions === undefined ) { + providedOptions = {}; + } // Check if initialization has been done and, if not, queue the sound generator and its options for addition // once initialization is complete. Note that when sound is not supported, initialization will never occur.