Fix for Vocodes v1 removal

Mistakenly deleted files with function still in use
This commit is contained in:
Brandon Thomas committed 2022-07-10 02:05:53 -04:00
1 parent c8f70910b6
commit b3f4477dd2
3 files changed
+19 -2

No files matched your search

@@ -0,0 +1,6 @@
import { GetRandomInt } from "./GetRandomInt";
export function GetRandomArrayValue<T>(array: Array<T>) : T {
let index = GetRandomInt(0, array.length);
return array[index];
}
@@ -0,0 +1,11 @@
/**
* Generate a random integer in range.
* @param min minimum inclusive
* @param max maximum exclusive
*/
export function GetRandomInt(min: number, max: number) : number {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
@@ -1,7 +1,7 @@
import React, { useEffect, useRef } from 'react';
import { VIRIDIS, MAGMA } from "@colormap/presets";
import { createColorMap, linearScale } from "@colormap/core";
import { getRandomArrayValue } from "../../../../v1/api/Utils";
import { GetRandomArrayValue } from '@storyteller/components/src/utils/GetRandomArrayValue';
interface Props {
spectrogramJsonLink: string
@@ -29,7 +29,7 @@ function SpectrogramFc(props: Props) {
let bytes = new Uint8ClampedArray(size);
let colorMapScale = linearScale([0, 255], [0, 1]);
let colorMapColors = getRandomArrayValue(COLOR_MAP_PRESETS);
let colorMapColors = GetRandomArrayValue(COLOR_MAP_PRESETS);
let colorMap = createColorMap(colorMapColors, colorMapScale);
let k = 0;