From e0641ea64081e6b387ae2959dbef505b756bc870 Mon Sep 17 00:00:00 2001 From: jbphet Date: Wed, 6 Apr 2022 17:17:17 -0600 Subject: [PATCH] converted JS to TS, see https://github.com/phetsims/tambo/issues/160 --- js/PeakDetectorAudioNode.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/js/PeakDetectorAudioNode.ts b/js/PeakDetectorAudioNode.ts index 4e508796..fb378da1 100644 --- a/js/PeakDetectorAudioNode.ts +++ b/js/PeakDetectorAudioNode.ts @@ -1,7 +1,5 @@ // Copyright 2021, University of Colorado Boulder -// @ts-nocheck - /** * PeakDetectorAudioNode is a Web Audio node that can be used to detect peak audio output values in an audio signal * chain. The detected peak audio values are output to the console. This file contains the portion that runs in the @@ -28,20 +26,20 @@ import merge from '../../phet-core/js/merge.js'; import phetAudioContext from './phetAudioContext.js'; import tambo from './tambo.js'; -class PeakDetectorAudioNode extends AudioWorkletNode { +export type PeakDetectorAudioNodeOptions = { - /** - * @param {Object} [options] - */ - constructor( options ) { + // If true, zero values will be output, otherwise no output will occur if the peak value detected for a given time + // interval is zero. + logZeroValues?: boolean; +}; - options = merge( { +class PeakDetectorAudioNode extends AudioWorkletNode { - // {boolean} - If true, zero values will be output, otherwise no output will occur if the peak value detected - // for a given time interval is zero. - logZeroValues: false + constructor( providedOptions: PeakDetectorAudioNodeOptions ) { - }, options ); + const options = merge( { + logZeroValues: false + }, providedOptions ); super( phetAudioContext, 'peak-detector' );