Fixed more JSDoc notation issues.

This commit is contained in:
Harrison Deng 2022-04-18 18:48:24 -05:00
parent 725a08ea8f
commit 56c07f52d8
9 changed files with 71 additions and 66 deletions

View File

@ -13,7 +13,7 @@ import { mapBinNumerical, mapRangedAvgNumerical } from "./numeric.js";
* @param {string} conf.unit The unit the upper and lower bounds are measured in. * @param {string} conf.unit The unit the upper and lower bounds are measured in.
* @param {number} conf.lowerBin The lower boundary of bins to be mapped (or the single bin to be mapped if the upper bin is undefined). * @param {number} conf.lowerBin The lower boundary of bins to be mapped (or the single bin to be mapped if the upper bin is undefined).
* @param {VisUpdateRouter} conf.visUpdateRouter The visualizer update manager to be mapped to. * @param {VisUpdateRouter} conf.visUpdateRouter The visualizer update manager to be mapped to.
* @param {interpolator} conf.interpolator The interpolation function to be used to transition from one value to the next. * @param {module:support/easings~interpolator} conf.interpolator The interpolation function to be used to transition from one value to the next.
* @param {number} [conf.upperBin] The upper bin or undefined, which results in mapping to a single bin. * @param {number} [conf.upperBin] The upper bin or undefined, which results in mapping to a single bin.
* @param {boolean} [conf.reversed=false] If true, then high amplitudes are mapped to lower values and vice versa. * @param {boolean} [conf.reversed=false] If true, then high amplitudes are mapped to lower values and vice versa.
* @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} The listener that was added (ranged if an upper bound was provided, binned otherwise). * @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} The listener that was added (ranged if an upper bound was provided, binned otherwise).
@ -51,7 +51,7 @@ export function mapWidth({ element, growLower, growUpper, unit, lowerBin, visUpd
* @param {string} conf.unit The unit the upper and lower bounds are measured in. * @param {string} conf.unit The unit the upper and lower bounds are measured in.
* @param {number} conf.lowerBin The lower boundary of bins to be mapped (or the single bin to be mapped if the upper bin is undefined). * @param {number} conf.lowerBin The lower boundary of bins to be mapped (or the single bin to be mapped if the upper bin is undefined).
* @param {VisUpdateRouter} conf.visUpdateRouter The visualizer update manager to be mapped to. * @param {VisUpdateRouter} conf.visUpdateRouter The visualizer update manager to be mapped to.
* @param {interpolator} conf.interpolator The interpolation function to be used to transition from one value to the next. * @param {module:support/easings~interpolator} conf.interpolator The interpolation function to be used to transition from one value to the next.
* @param {number} [conf.upperBin] The upper bin or undefined, which results in mapping to a single bin. * @param {number} [conf.upperBin] The upper bin or undefined, which results in mapping to a single bin.
* @param {boolean} [conf.reversed=false] If true, then high amplitudes are mapped to lower values and vice versa. * @param {boolean} [conf.reversed=false] If true, then high amplitudes are mapped to lower values and vice versa.
* @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} The listener that was added (ranged if an upper bound was provided, binned otherwise). * @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} The listener that was added (ranged if an upper bound was provided, binned otherwise).

View File

@ -23,9 +23,9 @@ import VisUpdateRouter from "../visualization/VisUpdateRouter.js";
* @param {number} conf.maxVal The maximum value of the numerical value. * @param {number} conf.maxVal The maximum value of the numerical value.
* @param {number} conf.lowerBin The lower bin of the range of bins this value is to be mapped to. * @param {number} conf.lowerBin The lower bin of the range of bins this value is to be mapped to.
* @param {number} conf.upperBin The upper bin of the range of bins this value si to be mapped to. * @param {number} conf.upperBin The upper bin of the range of bins this value si to be mapped to.
* @param {numericalGetter} conf.getter The getter callback to be used to get the current number. * @param {module:mappings/numeric~numericalGetter} conf.getter The getter callback to be used to get the current number.
* @param {numericalSetter} conf.setter The setter callback to be used to set the new number. * @param {module:mappings/numeric~numericalSetter} conf.setter The setter callback to be used to set the new number.
* @param {interpolator} conf.interpolator The interpolation function to use. * @param {module:support/easings~interpolator} conf.interpolator The interpolation function to use.
* @param {VisUpdateRouter} conf.visUpdateRouter the visualizer update manager this mapping corresponds with. * @param {VisUpdateRouter} conf.visUpdateRouter the visualizer update manager this mapping corresponds with.
* @param {boolean} [conf.reversed = false] If true, then high amplitudes will be mapped to low values and vice versa. * @param {boolean} [conf.reversed = false] If true, then high amplitudes will be mapped to low values and vice versa.
* @returns {{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} An object containing the lower and upper bounds for the range of a listener, which is also in the object. * @returns {{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} An object containing the lower and upper bounds for the range of a listener, which is also in the object.
@ -64,9 +64,9 @@ export function mapRangedAvgNumerical({ minVal, maxVal, lowerBin = undefined, up
* @param {number} conf.minVal The minimum value the mapping can produce. * @param {number} conf.minVal The minimum value the mapping can produce.
* @param {number} conf.maxVal The maximum value the mapping can produce. * @param {number} conf.maxVal The maximum value the mapping can produce.
* @param {number} conf.bin The bin to map this number to. * @param {number} conf.bin The bin to map this number to.
* @param {numericalGetter} conf.getter The callback to be used to get the current number. * @param {module:mappings/numeric~numericalGetter} conf.getter The callback to be used to get the current number.
* @param {numericalSetter} conf.setter The callback to be used to set the new number. * @param {module:mappings/numeric~numericalSetter} conf.setter The callback to be used to set the new number.
* @param {interpolator} conf.interpolator The interpolation function to use. * @param {module:support/easings~interpolator} conf.interpolator The interpolation function to use.
* @param {VisUpdateRouter} conf.visUpdateRouter The update manager to map to. * @param {VisUpdateRouter} conf.visUpdateRouter The update manager to map to.
* @param {boolean} [conf.reversed] If true, then high amplitudes will be mapped to lower values and vice versa. * @param {boolean} [conf.reversed] If true, then high amplitudes will be mapped to lower values and vice versa.
* @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}} The bin listener that was added. * @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}} The bin listener that was added.

View File

@ -12,7 +12,7 @@ import { mapBinNumerical, mapRangedAvgNumerical } from "./numeric.js";
* @param {number} rgbaMapConfiguration.color Where r for red, g, for green, b for blue, and a for alpha. * @param {number} rgbaMapConfiguration.color Where r for red, g, for green, b for blue, and a for alpha.
* @param {number} rgbaMapConfiguration.lowerBin The lower bound of the bins to be mapped. * @param {number} rgbaMapConfiguration.lowerBin The lower bound of the bins to be mapped.
* @param {VisUpdateRouter} rgbaMapConfiguration.visUpdateRouter The visualizer update manager associated with the audio playback you would like the mapping with. * @param {VisUpdateRouter} rgbaMapConfiguration.visUpdateRouter The visualizer update manager associated with the audio playback you would like the mapping with.
* @param {interpolator} rgbaMapConfiguration.interpolator The interpolation function to use. * @param {Function} rgbaMapConfiguration.interpolator The interpolation function to use.
* @param {number} [rgbaMapConfiguration.upperBin=undefined] The upper bound of the bins to be mapped. If left undefined, then only the bin defined by the min value is used. * @param {number} [rgbaMapConfiguration.upperBin=undefined] The upper bound of the bins to be mapped. If left undefined, then only the bin defined by the min value is used.
* @param {boolean} [rgbaMapConfiguration.reversed=true] If true, then the quieter, the greater the red value. * @param {boolean} [rgbaMapConfiguration.reversed=true] If true, then the quieter, the greater the red value.
* @returns {{bin: number, listener: visualizerBinUpdateListener}|{lower: number, upper: number, listener: visualizerRangedUpdateListener}} The ranged listener that was added. * @returns {{bin: number, listener: visualizerBinUpdateListener}|{lower: number, upper: number, listener: visualizerRangedUpdateListener}} The ranged listener that was added.
@ -58,7 +58,7 @@ export function mapRgba({ element, color, lowerBin, visUpdateRouter, interpolato
* @param {string} fontSizeMapConfiguration.unit The unit the upper and lower bounds are measured in. * @param {string} fontSizeMapConfiguration.unit The unit the upper and lower bounds are measured in.
* @param {number} fontSizeMapConfiguration.lowerBin The lower boundary of bins to be mapped (or the single bin to be mapped if the upper bin is undefined). * @param {number} fontSizeMapConfiguration.lowerBin The lower boundary of bins to be mapped (or the single bin to be mapped if the upper bin is undefined).
* @param {VisUpdateRouter} fontSizeMapConfiguration.visUpdateRouter the visualizer update manager to be mapped to. * @param {VisUpdateRouter} fontSizeMapConfiguration.visUpdateRouter the visualizer update manager to be mapped to.
* @param {interpolator} fontSizeMapConfiguration.interpolator The interpolation function to be used to transition from one value to the next. * @param {module:support/easings~interpolator} fontSizeMapConfiguration.interpolator The interpolation function to be used to transition from one value to the next.
* @param {number} [fontSizeMapConfiguration.upperBin=undefined] The upper bin, or undefined, which results in mapping to a single bin. * @param {number} [fontSizeMapConfiguration.upperBin=undefined] The upper bin, or undefined, which results in mapping to a single bin.
* @param {boolean} [fontSizeMapConfiguration.reversed=false] If true, then high amplitudes are mapped to lower values and vice versa. * @param {boolean} [fontSizeMapConfiguration.reversed=false] If true, then high amplitudes are mapped to lower values and vice versa.
* @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} The listener that was added (ranged if an upper bound was provided, binned otherwise). * @returns {{bin: number, listener: VisUpdateRouter.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisUpdateRouter.visualizerRangedUpdateListener}} The listener that was added (ranged if an upper bound was provided, binned otherwise).

View File

@ -2,10 +2,6 @@ import Visualizer from "../visualization/Visualizer.js";
/**
* @callback AudioEventCallback
* @param {HTMLAudioElement} audio
*/
/** /**
* A music with metadata that can be used as part of a {@link MusicPlaylist}. * A music with metadata that can be used as part of a {@link MusicPlaylist}.
@ -19,6 +15,11 @@ export default class Music {
#visualizer; #visualizer;
#ready = false; #ready = false;
/**
* @callback Music~audioEventCallback
* @param {HTMLAudioElement} audio
*/
/** /**
* Constructs a music for a {@link MusicPlaylist}. * Constructs a music for a {@link MusicPlaylist}.
* *
@ -35,7 +36,7 @@ export default class Music {
/** /**
* *
* @param {AudioEventCallback} [onReady] called when the music is ready, including right away if the music is already ready. * @param {Music~audioEventCallback} [onReady] called when the music is ready, including right away if the music is already ready.
* @returns {HTMLAudioElement} The audio element that represents this music. * @returns {HTMLAudioElement} The audio element that represents this music.
*/ */
fetchAudio(onReady) { fetchAudio(onReady) {
@ -90,7 +91,7 @@ export default class Music {
/** /**
* Begins audio playback as soon as possible. * Begins audio playback as soon as possible.
* *
* This function uses the {@link PlaylistMusic#getAudio} function and specifically, the {@link AudioEventCallback}. * This function uses the {@link PlaylistMusic#getAudio} function and specifically, the {@link Music~audioEventCallback}.
*/ */
play() { play() {
this.fetchAudio((audio) => { this.fetchAudio((audio) => {

View File

@ -3,11 +3,6 @@ import MusicPlaylist from "./MusicPlaylist.js";
/**
* @callback changeListener
* @param {*} old the previous value.
* @param {*} current the the current (new) value.
*/
/** /**
* A player that keeps track of global properties for playback as well as traversing a playlist. Additionally keeps track of music audio data and attempts to reduce memory usage when possible. * A player that keeps track of global properties for playback as well as traversing a playlist. Additionally keeps track of music audio data and attempts to reduce memory usage when possible.
@ -21,6 +16,12 @@ export default class MusicPlayer {
#volumeChangeListeners = []; #volumeChangeListeners = [];
#allAudioEventListeners = {}; #allAudioEventListeners = {};
/**
* @callback MusicPlayer~changeListener
* @param {*} old the previous value.
* @param {*} current the the current (new) value.
*/
/** /**
* *
* @param {MusicPlaylist} playlist the playlist of musics that this player is in charge of. * @param {MusicPlaylist} playlist the playlist of musics that this player is in charge of.
@ -224,7 +225,7 @@ export default class MusicPlayer {
/** /**
* *
* @param {changeListener} listener the playlist change listener to add to the callback list. * @param {MusicPlayer~changeListener} listener the playlist change listener to add to the callback list.
* @returns {boolean} true if and only if the given listener was successfully registered. * @returns {boolean} true if and only if the given listener was successfully registered.
*/ */
addPlaylistChangeListener(listener) { addPlaylistChangeListener(listener) {
@ -236,7 +237,7 @@ export default class MusicPlayer {
/** /**
* *
* @param {changeListener} listener the playlist change listener to remove. * @param {MusicPlayer~changeListener} listener the playlist change listener to remove.
* @returns {boolean} true if and only if a listener was successfully removed from the callback list. * @returns {boolean} true if and only if a listener was successfully removed from the callback list.
*/ */
removePlaylistChangeListener(listener) { removePlaylistChangeListener(listener) {
@ -249,7 +250,7 @@ export default class MusicPlayer {
/** /**
* *
* @param {changeListener} listener the listener that is called when the player's volume is changed. * @param {MusicPlayer~changeListener} listener the listener that is called when the player's volume is changed.
* @returns {boolean} true if and only if the listener was successfully added. * @returns {boolean} true if and only if the listener was successfully added.
*/ */
addVolumeChangeListener(listener) { addVolumeChangeListener(listener) {
@ -260,7 +261,7 @@ export default class MusicPlayer {
/** /**
* *
* @param {changeListener} listener the volume change listener to remove. * @param {MusicPlayer~changeListener} listener the volume change listener to remove.
* @returns {boolean} true if and only if a listener was successfully removed from the callback list. * @returns {boolean} true if and only if a listener was successfully removed from the callback list.
*/ */
removeVolumeChangeListener(listener) { removeVolumeChangeListener(listener) {

View File

@ -2,18 +2,6 @@ import Music from "./Music.js";
/**
* @callback positionChangeListener
* @param {number} old the previous position.
* @param {number} current the the current (new) position.
*/
/**
* @callback lengthChangeListener
* @param {number} changed The index of the music that has changed.
* @param {boolean} added True if and only if the change was caused by adding music.
* @param {Music} music The music that was added or removed.
*/
/** /**
* A playlist that holds a multitude of musics in the form of {@link Music}. * A playlist that holds a multitude of musics in the form of {@link Music}.
@ -25,6 +13,20 @@ export default class MusicPlaylist {
#positionChangeListeners = []; #positionChangeListeners = [];
#lengthChangeListeners = []; #lengthChangeListeners = [];
/**
* @callback MusicPlaylist~positionChangeListener
* @param {number} old the previous position.
* @param {number} current the the current (new) position.
*/
/**
* @callback MusicPlaylist~lengthChangeListener
* @param {number} changed The index of the music that has changed.
* @param {boolean} added True if and only if the change was caused by adding music.
* @param {Music} music The music that was added or removed.
*/
/** /**
* Instantiates a playlist for musics. * Instantiates a playlist for musics.
* *
@ -155,7 +157,7 @@ export default class MusicPlaylist {
/** /**
* *
* @param {positionChangeListener} listener the listener to receive the updates. * @param {MusicPlaylist~positionChangeListener} listener the listener to receive the updates.
* @returns {boolean} true if and only if successfully added the listener. * @returns {boolean} true if and only if successfully added the listener.
*/ */
addPositionChangeListener(listener) { addPositionChangeListener(listener) {
@ -166,7 +168,7 @@ export default class MusicPlaylist {
/** /**
* *
* @param {positionChangeListener} listener the music change listener to remove. * @param {MusicPlaylist~positionChangeListener} listener the music change listener to remove.
* @returns {boolean} true if and only if the music change listener given was successfully removed. * @returns {boolean} true if and only if the music change listener given was successfully removed.
*/ */
removePositionChangeListener(listener) { removePositionChangeListener(listener) {
@ -180,7 +182,7 @@ export default class MusicPlaylist {
/** /**
* Adds a listener for whether music was added or removed to the playlist. * Adds a listener for whether music was added or removed to the playlist.
* *
* @param {lengthChangeListener} listener The listener to be added. * @param {MusicPlaylist~lengthChangeListener} listener The listener to be added.
* @returns {boolean} True if and only if the listener was successfully added. * @returns {boolean} True if and only if the listener was successfully added.
*/ */
addLengthChangeListener(listener) { addLengthChangeListener(listener) {
@ -192,7 +194,7 @@ export default class MusicPlaylist {
/** /**
* Removes a listener for whether music is added or removed to the playlist. * Removes a listener for whether music is added or removed to the playlist.
* *
* @param {lengthChangeListener} listener The listener to be removed. * @param {MusicPlaylist~lengthChangeListener} listener The listener to be removed.
* @returns {boolean} True if and only if the provided listener was successfully removed. * @returns {boolean} True if and only if the provided listener was successfully removed.
*/ */
removeLengthChangeListener(listener) { removeLengthChangeListener(listener) {

View File

@ -13,7 +13,7 @@
/** /**
* *
* @param {number} rate the number of frequency values to shift by per second. * @param {number} rate the number of frequency values to shift by per second.
* @returns {interpolator} the interpolation function with the given rate. * @returns {module:support/easings~interpolator} the interpolation function with the given rate.
*/ */
export function createEaseLinear(rate) { export function createEaseLinear(rate) {
return (current, dest, frameDelta) => { return (current, dest, frameDelta) => {

View File

@ -2,18 +2,6 @@
import Visualizer from "./Visualizer.js"; import Visualizer from "./Visualizer.js";
/**
* @callback visualizerBinUpdateListener
* @param {number} timeDelta elapsed time since last update.
* @param {number} amplitude The amplitude of the associated bin.
* @param {number} ampDelta change in amplitude of the frequency bin.
*/
/**
* @callback visualizerRangedUpdateListener
* @param {number} timeDelta elapsed time since last update.
* @param {number} bins the bins of the range.
*/
/** /**
@ -28,6 +16,18 @@ export default class VisUpdateRouter {
#lastBins; #lastBins;
#visualizer; #visualizer;
/**
* @callback VisUpdateRouter~visualizerBinUpdateListener
* @param {number} timeDelta elapsed time since last update.
* @param {number} amplitude The amplitude of the associated bin.
* @param {number} ampDelta change in amplitude of the frequency bin.
*/
/**
* @callback VisUpdateRouter~visualizerRangedUpdateListener
* @param {number} timeDelta elapsed time since last update.
* @param {number} bins the bins of the range.
*/
/** /**
* *
@ -73,7 +73,7 @@ export default class VisUpdateRouter {
* *
* @param {object} freqBinListener the listener for a specific frequency bin. * @param {object} freqBinListener the listener for a specific frequency bin.
* @param {number} freqBinListener.freqBin the frequency bin this update listener should listen to. * @param {number} freqBinListener.freqBin the frequency bin this update listener should listen to.
* @param {visualizerBinUpdateListener} freqBinListener.listener the listener itself that will be called upon the bin updating. * @param {VisUpdateRouter~visualizerBinUpdateListener} freqBinListener.listener the listener itself that will be called upon the bin updating.
* @returns {boolean} true if and only if the updater was added successfully. * @returns {boolean} true if and only if the updater was added successfully.
*/ */
AddVisualizerBinUpdateListener({ freqBin, listener }) { AddVisualizerBinUpdateListener({ freqBin, listener }) {
@ -88,7 +88,7 @@ export default class VisUpdateRouter {
* @param {object} rangedUpdateListener The ranged update listener to add. * @param {object} rangedUpdateListener The ranged update listener to add.
* @param {number} rangedUpdateListener.lower The lower bound of the bins to listen to (inclusive). * @param {number} rangedUpdateListener.lower The lower bound of the bins to listen to (inclusive).
* @param {number} rangedUpdateListener.upper The upper bound of the bins to listen to (inclusive). * @param {number} rangedUpdateListener.upper The upper bound of the bins to listen to (inclusive).
* @param {visualizerRangedUpdateListener} rangedUpdateListener.listener The listener to register to the range. * @param {VisUpdateRouter~visualizerRangedUpdateListener} rangedUpdateListener.listener The listener to register to the range.
* @returns {boolean} True if and only if the ranged listener was added successfully. * @returns {boolean} True if and only if the ranged listener was added successfully.
*/ */
addVisualizerRangedUpdateListener({ lower, upper, listener }) { addVisualizerRangedUpdateListener({ lower, upper, listener }) {
@ -108,7 +108,7 @@ export default class VisUpdateRouter {
* *
* @param {object} binFreqListener The bin frequency listener to remove. * @param {object} binFreqListener The bin frequency listener to remove.
* @param {number} binFreqListener.freqBin the frequency bin the update listener to be removed from is in. * @param {number} binFreqListener.freqBin the frequency bin the update listener to be removed from is in.
* @param {visualizerBinUpdateListener} binFreqListener.listener the listener that is to be removed. * @param {VisUpdateRouter~visualizerBinUpdateListener} binFreqListener.listener the listener that is to be removed.
* @returns {boolean} true if and only if the listener was successfully removed. * @returns {boolean} true if and only if the listener was successfully removed.
*/ */
removeVisualizerBinUpdateListener({ freqBin, listener }) { removeVisualizerBinUpdateListener({ freqBin, listener }) {
@ -124,7 +124,7 @@ export default class VisUpdateRouter {
* @param {object} rangedListener The ranged listener to remove. * @param {object} rangedListener The ranged listener to remove.
* @param {number} rangedListener.lower The lower bound of bins to remove the listener from (inclusive). * @param {number} rangedListener.lower The lower bound of bins to remove the listener from (inclusive).
* @param {number} rangedListener.upper The upper bound of bin to remove the listener from (inclusive.) * @param {number} rangedListener.upper The upper bound of bin to remove the listener from (inclusive.)
* @param {visualizerRangedUpdateListener} rangedListener.listener The update listener to remove from the bins. * @param {VisUpdateRouter~visualizerRangedUpdateListener} rangedListener.listener The update listener to remove from the bins.
* @returns {boolean} True if and only if the given listener was removed. * @returns {boolean} True if and only if the given listener was removed.
*/ */
removeVisualizerRangedUpdateListener({ lower, upper, listener }) { removeVisualizerRangedUpdateListener({ lower, upper, listener }) {
@ -145,7 +145,7 @@ export default class VisUpdateRouter {
* @param {object[]} listeners.ranged The array of ranged listeners. * @param {object[]} listeners.ranged The array of ranged listeners.
* @param {number} listeners.ranged[].lower The lower bound of the listener. * @param {number} listeners.ranged[].lower The lower bound of the listener.
* @param {number} listeners.ranged[].upper The upper bound of the listener. * @param {number} listeners.ranged[].upper The upper bound of the listener.
* @param {visualizerRangedUpdateListener} listeners.ranged[].listener The listener for the previously mentioned ranges. * @param {VisUpdateRouter~visualizerRangedUpdateListener} listeners.ranged[].listener The listener for the previously mentioned ranges.
* @returns {boolean} true if and only if successfully loaded the new listeners. * @returns {boolean} true if and only if successfully loaded the new listeners.
*/ */
loadListeners(listeners) { loadListeners(listeners) {

View File

@ -1,8 +1,3 @@
/**
* @callback visualizerUpdateListener
* @param {number} delta elapsed time since last update.
* @param {Uint8Array} bins the bins with varying frequency values.
*/
/** /**
* Provides a simplified access point to the frequency bins in the form of a visualization update listener. * Provides a simplified access point to the frequency bins in the form of a visualization update listener.
@ -18,6 +13,12 @@ export default class Visualizer {
#lastUpdate; #lastUpdate;
#fftSize; #fftSize;
/**
* @callback Visualizer~visualizerUpdateListener
* @param {number} delta elapsed time since last update.
* @param {Uint8Array} bins the bins with varying frequency values.
*/
/** /**
* *
* @param {MediaSource|HTMLMediaElement} stream a media source to analyze. * @param {MediaSource|HTMLMediaElement} stream a media source to analyze.
@ -81,7 +82,7 @@ export default class Visualizer {
/** /**
* *
* @param {visualizerUpdateListener} listener the visualizer update listener to be registered. * @param {Visualizer~visualizerUpdateListener} listener the visualizer update listener to be registered.
* @returns {boolean} true if and only if the listener was successfully added. * @returns {boolean} true if and only if the listener was successfully added.
*/ */
addUpdateListener(listener) { addUpdateListener(listener) {
@ -93,7 +94,7 @@ export default class Visualizer {
/** /**
* *
* @param {visualizerUpdateListener} listener the visualizer update listener to remove. * @param {Visualizer~visualizerUpdateListener} listener the visualizer update listener to remove.
* @returns {boolean} true if and only if the removal of the listener was a success. * @returns {boolean} true if and only if the removal of the listener was a success.
*/ */
removeUpdateListener(listener) { removeUpdateListener(listener) {