diff --git a/src/audioshowkitlib.js b/src/audioshowkitlib.js index 0db8475..fe5efcb 100644 --- a/src/audioshowkitlib.js +++ b/src/audioshowkitlib.js @@ -5,7 +5,7 @@ -import * as mappings from "./mapping/mappings.js"; +import * as mappings from "./mappings/mappings.js"; import * as player from "./player/player.js"; import * as visualization from "./visualization/visualization.js"; import * as support from "./support/support.js"; diff --git a/src/mapping/dimensions.js b/src/mappings/dimensions.js similarity index 100% rename from src/mapping/dimensions.js rename to src/mappings/dimensions.js diff --git a/src/mapping/mappings.js b/src/mappings/mappings.js similarity index 100% rename from src/mapping/mappings.js rename to src/mappings/mappings.js diff --git a/src/mapping/numeric.js b/src/mappings/numeric.js similarity index 100% rename from src/mapping/numeric.js rename to src/mappings/numeric.js diff --git a/src/mapping/text.js b/src/mappings/text.js similarity index 83% rename from src/mapping/text.js rename to src/mappings/text.js index 4f8c024..40a8827 100644 --- a/src/mapping/text.js +++ b/src/mappings/text.js @@ -1,4 +1,5 @@ import { parseColor, rgbaToHexRgba } from "../support/colors.js"; +import VisUpdateRouter from "../visualization/VisUpdateRouter.js"; import { mapBinNumerical, mapRangedAvgNumerical } from "./numeric.js"; @@ -9,11 +10,11 @@ import { mapBinNumerical, mapRangedAvgNumerical } from "./numeric.js"; * @param {HTMLElement} rgbaMapConfiguration.element The element whose text's red value should be mapped. * @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 {VisualizerUpdateManager} 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 {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. - * @returns {{bin: number, listener: VisualizerUpdateManager.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. */ function mapRgba({ element, color, lowerBin, visUpdateRouter, interpolator, upperBin = undefined, reversed = false }) { const rgbaStr = "rgba"; @@ -55,11 +56,11 @@ function mapRgba({ element, color, lowerBin, visUpdateRouter, interpolator, uppe * @param {number} fontSizeMapConfiguration.growUpper The upper limit of the font size. * @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 {VisualizerUpdateManager} 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 {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. - * @returns {{bin: number, listener: VisualizerUpdateManager.visualizerBinUpdateListener}|{lower: number, upper: number, listener: VisualizerUpdateManager.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). */ function mapFontSize({ element, growLower, growUpper, unit, lowerBin, visUpdateRouter, interpolator, upperBin = undefined, reversed = false }) { const getter = () => parseInt(element.style.fontSize); diff --git a/src/player/SongPlaylist.js b/src/player/SongPlaylist.js deleted file mode 100644 index 54620a1..0000000 --- a/src/player/SongPlaylist.js +++ /dev/null @@ -1,78 +0,0 @@ -import PlaylistSong from "./PlaylistSong"; - -/** - * A playlist that holds a multitude of songs. - */ -export default class SongPlaylist { - - /** - * Instantiates a playlist for songs. - * - * @param {string} name The name of the playlist. - */ - constructor(name) { - this._list = []; - this._name = name; - this._current = 0; - } - - /** - * - * @returns {string} the name of the string. - */ - getName() { - return this._name; - } - - /** - * - * @param {number} index the index of the song to retrieve. - * @returns {PlaylistSong} the song at the given index. - */ - songAtIndex(index) { - if (index >= this._list.length) { - return null; - } - return this.list[index]; - } - - songsWithName(name) { - return this._list.filter((item) => item.getDisplayName() == name); - } - - add(url, name, author) { - this._list.push(new PlaylistSong(url, name, author, this, this._list.length)); - } - - remove(index) { - if (index >= this._list.length) { - return null; - } - let removed = this._list.splice(index, 1); - if (removed.length > 0) { - return removed[0]; - } - } - - findSongIndex(name) { - // TODO: Could probably be optimized. - return this._list.findIndex((item) => item.getDisplayName() == name); - } - - /** - * - * @returns {number} total number of songs in this playlist. - */ - total() { - return this._list.length; - } - - /** - * Unloads the audio data of all songs in this playlist. - */ - unloadAllAudio() { - this._list.forEach(playlistSong => { - playlistSong.unloadAudio(); - }); - } -} \ No newline at end of file