From 184317f03a0234e42fcc3451708b143b01044b54 Mon Sep 17 00:00:00 2001 From: David Young Date: Sun, 11 Feb 2024 10:35:25 -0800 Subject: [PATCH] Adds visual controls (#27) --- app/package.json | 1 + app/src/App.tsx | 2 + .../analyzers/fftAnalyzerControls.tsx | 31 ------ app/src/components/audio/audioSource.tsx | 2 +- app/src/components/canvas/Visual3D.tsx | 16 +-- .../{audio => audioSource}/fileUpload.tsx | 0 .../soundcloud/controls.tsx | 0 .../soundcloud/player.tsx | 0 .../soundcloud/track.tsx | 0 .../soundcloud/user.tsx | 0 app/src/components/controls/mode/common.tsx | 6 +- app/src/components/controls/mode/noise.tsx | 2 +- app/src/components/controls/mode/waveform.tsx | 2 +- app/src/components/controls/modeSheet.tsx | 16 ++- app/src/components/controls/visual/cube.tsx | 100 +++++++++++++++++ .../controls/visual/diffusedRing.tsx | 97 ++++++++++++++++ app/src/components/controls/visual/grid.tsx | 104 ++++++++++++++++++ app/src/components/controls/visual/sphere.tsx | 82 ++++++++++++++ .../controls/visualSettingsSheet.tsx | 34 +++++- .../components/visualizers/cube/reactive.tsx | 27 ----- .../visualizers/diffusedRing/reactive.tsx | 10 -- .../visualizers/sphere/reactive.tsx | 28 ----- .../visualizers/visualizerAudio.tsx | 12 -- app/src/context/visual.tsx | 1 + app/src/context/visualConfig/cube.tsx | 7 ++ app/src/context/visualConfig/grid.tsx | 7 ++ app/src/lib/applicationModes.ts | 5 + 27 files changed, 461 insertions(+), 131 deletions(-) rename app/src/components/controls/{audio => audioSource}/fileUpload.tsx (100%) rename app/src/components/controls/{audio => audioSource}/soundcloud/controls.tsx (100%) rename app/src/components/controls/{audio => audioSource}/soundcloud/player.tsx (100%) rename app/src/components/controls/{audio => audioSource}/soundcloud/track.tsx (100%) rename app/src/components/controls/{audio => audioSource}/soundcloud/user.tsx (100%) create mode 100644 app/src/components/controls/visual/cube.tsx create mode 100644 app/src/components/controls/visual/diffusedRing.tsx create mode 100644 app/src/components/controls/visual/grid.tsx create mode 100644 app/src/components/controls/visual/sphere.tsx diff --git a/app/package.json b/app/package.json index 0a36dd12..7975bb92 100644 --- a/app/package.json +++ b/app/package.json @@ -7,6 +7,7 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", + "typecheck": "tsc --noEmit", "lint": "eslint .", "lint:fix": "eslint --fix .", "format": "prettier --check \"**/*.{js,cjs,mjs,ts,tsx,md,json}\"", diff --git a/app/src/App.tsx b/app/src/App.tsx index c1554dbb..808e08ff 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -13,6 +13,7 @@ const getAnalyzerComponent = (mode: ApplicationMode) => { return ; case APPLICATION_MODE.WAVE_FORM: case APPLICATION_MODE.NOISE: + case APPLICATION_MODE.PARTICLE_NOISE: return null; default: return mode satisfies never; @@ -26,6 +27,7 @@ const getCanvasComponent = (mode: ApplicationMode) => { case APPLICATION_MODE.WAVE_FORM: case APPLICATION_MODE.NOISE: case APPLICATION_MODE.AUDIO: + case APPLICATION_MODE.PARTICLE_NOISE: return ; default: return mode satisfies never; diff --git a/app/src/components/analyzers/fftAnalyzerControls.tsx b/app/src/components/analyzers/fftAnalyzerControls.tsx index 0e064414..c9fb1d34 100644 --- a/app/src/components/analyzers/fftAnalyzerControls.tsx +++ b/app/src/components/analyzers/fftAnalyzerControls.tsx @@ -13,37 +13,6 @@ export const FFTAnalyzerControls = ({ analyzer: FFTAnalyzer; }) => { const { octaveBandMode, energyMeasure } = useFFTAnalyzerContext(); - // const { octaveBands, energyMeasure } = useControls({ - // Audio: folder({ - // octaveBands: { - // value: 2, - // order: 75, - // options: { - // "1/24th octave bands": 1, - // "1/12th octave bands": 2, - // "1/8th octave bands": 3, - // "1/6th octave bands": 4, - // "1/4th octave bands": 5, - // "1/3rd octave bands": 6, - // "Half octave bands": 7, - // "Full octave bands": 8, - // }, - // }, - // energyMeasure: { - // value: "overall", - // order: 76, - // options: [ - // "overall", - // "peak", - // "bass", - // "lowMid", - // "mid", - // "highMid", - // "treble", - // ], - // }, - // }), - // }); const freqData = useVisualSourceDataX(); const energyInfo = useEnergyInfo(); const { resizeVisualSourceData } = useAppStateActions(); diff --git a/app/src/components/audio/audioSource.tsx b/app/src/components/audio/audioSource.tsx index 71d99408..e033042f 100644 --- a/app/src/components/audio/audioSource.tsx +++ b/app/src/components/audio/audioSource.tsx @@ -1,6 +1,6 @@ import { AUDIO_SOURCE } from "@/components/audio/sourceControls/common"; import FileAudioControls from "@/components/audio/sourceControls/file"; -import { CurrentTrackPlayer } from "@/components/controls/audio/soundcloud/player"; +import { CurrentTrackPlayer } from "@/components/controls/audioSource/soundcloud/player"; export const ControlledAudioSource = ({ audio, diff --git a/app/src/components/canvas/Visual3D.tsx b/app/src/components/canvas/Visual3D.tsx index 12e5badd..ca10665a 100644 --- a/app/src/components/canvas/Visual3D.tsx +++ b/app/src/components/canvas/Visual3D.tsx @@ -1,7 +1,7 @@ import { BackgroundFog, CanvasBackground } from "@/components/canvas/common"; import AudioVisual from "@/components/visualizers/visualizerAudio"; import NoiseVisual from "@/components/visualizers/visualizerNoise"; -// import ParticleNoiseVisual from "@/components/visualizers/visualizerParticleNoise"; +import ParticleNoiseVisual from "@/components/visualizers/visualizerParticleNoise"; import WaveformVisual from "@/components/visualizers/visualizerWaveform"; import { CAMERA_CONTROLS_MODE, @@ -17,20 +17,16 @@ import { MaybePaletteTracker } from "./paletteTracker"; const VisualizerComponent = ({ mode, }: { - mode: "WAVE_FORM" | "NOISE" | "AUDIO"; + mode: "WAVE_FORM" | "NOISE" | "AUDIO" | "PARTICLE_NOISE"; }) => { - const { - visual, - //palette - } = useVisualContext(); + const { visual } = useVisualContext(); switch (mode) { case APPLICATION_MODE.WAVE_FORM: return ; case APPLICATION_MODE.NOISE: - // if (visual === "swarm") { - // return ; - // } return ; + case APPLICATION_MODE.PARTICLE_NOISE: + return ; case APPLICATION_MODE.AUDIO: return ; default: @@ -79,7 +75,7 @@ const CameraControls = () => { const Visual3DCanvas = ({ mode, }: { - mode: "WAVE_FORM" | "NOISE" | "AUDIO"; + mode: "WAVE_FORM" | "NOISE" | "AUDIO" | "PARTICLE_NOISE"; }) => { return ( & { label: string; - value: string; + value: string | number; }) => { return (
{ step={0.01} onValueChange={(e) => setTimeScale(e[0])} /> - + { />
- + 1} onCheckedChange={(e) => { diff --git a/app/src/components/controls/modeSheet.tsx b/app/src/components/controls/modeSheet.tsx index a18f98c5..1bb633cd 100644 --- a/app/src/components/controls/modeSheet.tsx +++ b/app/src/components/controls/modeSheet.tsx @@ -15,7 +15,14 @@ import { isAudioMode, type ApplicationMode, } from "@/lib/applicationModes"; -import { Activity, Music, Shell, Waves } from "lucide-react"; +import { + AudioWaveform, + Drum, + HelpCircle, + Music, + Shell, + Waves, +} from "lucide-react"; import { AudioModeControls } from "./mode/audio"; import { AudioScopeModeControls } from "./mode/audioScope"; @@ -25,15 +32,18 @@ import { WaveformModeControls } from "./mode/waveform"; const ModeIcon = ({ mode }: { mode: ApplicationMode }) => { switch (mode) { case "WAVE_FORM": - return ; + return ; case "NOISE": return ; case "AUDIO": return ; case "AUDIO_SCOPE": return ; + case "PARTICLE_NOISE": + return ; default: - return mode satisfies never; + return ; + // return mode satisfies never; } }; const ModeSelectEntry = ({ mode }: { mode: ApplicationMode }) => { diff --git a/app/src/components/controls/visual/cube.tsx b/app/src/components/controls/visual/cube.tsx new file mode 100644 index 00000000..04258b43 --- /dev/null +++ b/app/src/components/controls/visual/cube.tsx @@ -0,0 +1,100 @@ +import { useEffect, useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Label } from "@/components/ui/label"; +import { Slider } from "@/components/ui/slider"; +import { Switch } from "@/components/ui/switch"; +import { + useCubeVisualConfigContext, + useCubeVisualConfigContextSetters, +} from "@/context/visualConfig/cube"; + +import { ValueLabel } from "../mode/common"; + +const Presets = [ + { + name: "default", + nPerSide: 10, + unitSpacingScalar: 0.1, + volume: true, + }, + { + name: "custom", + }, +] as const; + +export const CubeVisualSettingsControls = () => { + const { nPerSide, unitSpacingScalar, volume } = useCubeVisualConfigContext(); + const { setNPerSide, setUnitSpacingScalar, setVolume } = + useCubeVisualConfigContextSetters(); + const [preset, setPreset] = useState<(typeof Presets)[number]>( + Presets.find( + (p) => + p.name !== "custom" && + p.nPerSide === nPerSide && + p.volume === volume && + p.unitSpacingScalar === unitSpacingScalar, + ) ?? Presets[0], + ); + + useEffect(() => { + if (preset.name === "custom") { + return; + } + setNPerSide(preset.nPerSide); + setUnitSpacingScalar(preset.unitSpacingScalar); + setVolume(preset.volume); + }, [preset, setNPerSide, setUnitSpacingScalar, setVolume]); + + return ( +
+ +
+ {Presets.map((p) => ( + + ))} +
+ {preset.name === "custom" && ( + <> + + setNPerSide(e[0])} + /> + + setUnitSpacingScalar(e[0])} + /> +
+ + { + setVolume(e); + }} + /> +
+ + )} +
+ ); +}; diff --git a/app/src/components/controls/visual/diffusedRing.tsx b/app/src/components/controls/visual/diffusedRing.tsx new file mode 100644 index 00000000..d148cdc7 --- /dev/null +++ b/app/src/components/controls/visual/diffusedRing.tsx @@ -0,0 +1,97 @@ +import { useEffect, useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Label } from "@/components/ui/label"; +import { Slider } from "@/components/ui/slider"; +import { Switch } from "@/components/ui/switch"; +import { + useRingVisualConfigContext, + useRingVisualConfigContextSetters, +} from "@/context/visualConfig/diffusedRing"; + +import { ValueLabel } from "../mode/common"; + +const Presets = [ + { + name: "default", + radius: 2, + pointSize: 0.2, + mirrorEffects: false, + }, + { + name: "custom", + }, +] as const; + +export const DiffusedRingVisualSettingsControls = () => { + const { radius, pointSize, mirrorEffects } = useRingVisualConfigContext(); + const { setRadius, setPointSize, setMirrorEffects } = + useRingVisualConfigContextSetters(); + const [preset, setPreset] = useState<(typeof Presets)[number]>( + Presets.find( + (p) => + p.name !== "custom" && + p.pointSize === pointSize && + p.radius === radius && + p.mirrorEffects === mirrorEffects, + ) ?? Presets[0], + ); + + useEffect(() => { + if (preset.name === "custom") { + return; + } + setRadius(preset.radius); + setPointSize(preset.pointSize); + setMirrorEffects(preset.mirrorEffects); + }, [preset, setRadius, setPointSize, setMirrorEffects]); + + return ( +
+ +
+ {Presets.map((p) => ( + + ))} +
+ {preset.name === "custom" && ( + <> + + setRadius(e[0])} + /> + + setPointSize(e[0])} + /> +
+ + { + setMirrorEffects(e); + }} + /> +
+ + )} +
+ ); +}; diff --git a/app/src/components/controls/visual/grid.tsx b/app/src/components/controls/visual/grid.tsx new file mode 100644 index 00000000..05bdab80 --- /dev/null +++ b/app/src/components/controls/visual/grid.tsx @@ -0,0 +1,104 @@ +import { useEffect, useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Label } from "@/components/ui/label"; +import { Slider } from "@/components/ui/slider"; +import { + useGridVisualConfigContext, + useGridVisualConfigContextSetters, +} from "@/context/visualConfig/grid"; + +import { ValueLabel } from "../mode/common"; + +const Presets = [ + { + name: "default", + nRows: 100, + nCols: 100, + unitSpacingScalar: 5, + }, + { + name: "bands", + nRows: 5, + nCols: 200, + unitSpacingScalar: 1, + }, + { + name: "custom", + }, +] as const; + +export const GridVisualSettingsControls = () => { + const { nCols, nRows, unitSpacingScalar } = useGridVisualConfigContext(); + const { setNCols, setNRows, setUnitSpacingScalar } = + useGridVisualConfigContextSetters(); + const [preset, setPreset] = useState<(typeof Presets)[number]>( + Presets.find( + (p) => + p.name !== "custom" && + p.nRows === nRows && + p.nCols === nCols && + p.unitSpacingScalar === unitSpacingScalar, + ) ?? Presets[0], + ); + useEffect(() => { + if (preset.name === "custom") { + return; + } + setNRows(preset.nRows); + setNCols(preset.nCols); + setUnitSpacingScalar(preset.unitSpacingScalar); + }, [preset, setNCols, setNRows, setUnitSpacingScalar]); + + return ( +
+ +
+ {Presets.map((p) => ( + + ))} +
+ {preset.name === "custom" && ( + <> + + setNRows(e[0])} + /> + + setNCols(e[0])} + /> + + setUnitSpacingScalar(e[0])} + /> + + )} +
+ ); +}; diff --git a/app/src/components/controls/visual/sphere.tsx b/app/src/components/controls/visual/sphere.tsx new file mode 100644 index 00000000..8b27fe4e --- /dev/null +++ b/app/src/components/controls/visual/sphere.tsx @@ -0,0 +1,82 @@ +import { useEffect, useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Label } from "@/components/ui/label"; +import { Slider } from "@/components/ui/slider"; +import { + useSphereVisualConfigContext, + useSphereVisualConfigContextSetters, +} from "@/context/visualConfig/sphere"; + +import { ValueLabel } from "../mode/common"; + +const Presets = [ + { + name: "default", + radius: 2, + nPoints: 800, + }, + { + name: "custom", + }, +] as const; + +export const SphereVisualSettingsControls = () => { + const { radius, nPoints } = useSphereVisualConfigContext(); + const { setRadius, setNPoints } = useSphereVisualConfigContextSetters(); + const [preset, setPreset] = useState<(typeof Presets)[number]>( + Presets.find( + (p) => + p.name !== "custom" && p.nPoints === nPoints && p.radius === radius, + ) ?? Presets[0], + ); + + useEffect(() => { + if (preset.name === "custom") { + return; + } + setRadius(preset.radius); + setNPoints(preset.nPoints); + }, [preset, setRadius, setNPoints]); + + return ( +
+ +
+ {Presets.map((p) => ( + + ))} +
+ {preset.name === "custom" && ( + <> + + setNPoints(e[0])} + /> + + + setRadius(e[0])} + /> + + )} +
+ ); +}; diff --git a/app/src/components/controls/visualSettingsSheet.tsx b/app/src/components/controls/visualSettingsSheet.tsx index 6b95a4fa..39e95bf3 100644 --- a/app/src/components/controls/visualSettingsSheet.tsx +++ b/app/src/components/controls/visualSettingsSheet.tsx @@ -1,5 +1,6 @@ import { useState, type HTMLAttributes, type PropsWithChildren } from "react"; import { Label } from "@/components/ui/label"; +import { Separator } from "@/components/ui/separator"; import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; import { Switch } from "@/components/ui/switch"; import { useModeContext } from "@/context/mode"; @@ -12,6 +13,11 @@ import { } from "@/lib/palettes"; import { cn } from "@/lib/utils"; +import { CubeVisualSettingsControls } from "./visual/cube"; +import { DiffusedRingVisualSettingsControls } from "./visual/diffusedRing"; +import { GridVisualSettingsControls } from "./visual/grid"; +import { SphereVisualSettingsControls } from "./visual/sphere"; + const PaletteBand = ({ palette, className, @@ -49,6 +55,24 @@ const PaletteIcon = ({ ); }; +const VisualSettingsControls = () => { + const { visual } = useVisualContext(); + switch (visual) { + case "cube": + return CubeVisualSettingsControls(); + case "grid": + return GridVisualSettingsControls(); + case "sphere": + return SphereVisualSettingsControls(); + case "diffusedRing": + return DiffusedRingVisualSettingsControls(); + case "dna": + return null; + default: + return visual satisfies never; + } +}; + export const VisualSettingsSheet = ({ children }: PropsWithChildren) => { const [open, setOpen] = useState(false); const { mode } = useModeContext(); @@ -79,9 +103,8 @@ export const VisualSettingsSheet = ({ children }: PropsWithChildren) => {
- + { setColorBackground(e); @@ -89,10 +112,9 @@ export const VisualSettingsSheet = ({ children }: PropsWithChildren) => { />
- + { setPaletteTrackEnergy(e); @@ -100,6 +122,10 @@ export const VisualSettingsSheet = ({ children }: PropsWithChildren) => { />
+ +
+ +
diff --git a/app/src/components/visualizers/cube/reactive.tsx b/app/src/components/visualizers/cube/reactive.tsx index 8a6fe475..6b8c86c2 100644 --- a/app/src/components/visualizers/cube/reactive.tsx +++ b/app/src/components/visualizers/cube/reactive.tsx @@ -8,33 +8,6 @@ import BaseCube from "./base"; const CubeVisual = ({ coordinateMapper }: VisualProps) => { const { nPerSide, unitSideLength, unitSpacingScalar, volume } = useCubeVisualConfigContext(); - // const { nPerSide, cubeUnitSideLength, cubeUnitSpacingScalar, volume } = - // useControls({ - // "Visual - Cube": folder( - // { - // nPerSide: { - // value: 10, - // min: 3, - // max: 50, - // step: 1, - // }, - // cubeUnitSideLength: { - // value: 0.5, - // min: 0.1, - // max: 2.0, - // step: 0.05, - // }, - // cubeUnitSpacingScalar: { - // value: 0.1, - // min: 0, - // max: 2, - // step: 0.1, - // }, - // volume: true, - // }, - // { collapsed: true } - // ), - // }); return ( <> diff --git a/app/src/components/visualizers/diffusedRing/reactive.tsx b/app/src/components/visualizers/diffusedRing/reactive.tsx index 8a02e0c4..89a20608 100644 --- a/app/src/components/visualizers/diffusedRing/reactive.tsx +++ b/app/src/components/visualizers/diffusedRing/reactive.tsx @@ -8,16 +8,6 @@ import BaseDiffusedRing from "./base"; const DiffusedRingVisual = ({ coordinateMapper }: VisualProps) => { const { radius, pointSize, mirrorEffects } = useRingVisualConfigContext(); - // const { radius, pointSize, mirrorEffects } = useControls({ - // "Visual - Ring": folder( - // { - // radius: { value: 2, min: 0.25, max: 3, step: 0.25 }, - // pointSize: { value: 0.2, min: 0.01, max: 2, step: 0.01 }, - // mirrorEffects: false, - // }, - // { collapsed: true } - // ), - // }); return ( <> diff --git a/app/src/components/visualizers/sphere/reactive.tsx b/app/src/components/visualizers/sphere/reactive.tsx index 7859e96e..73fe014d 100644 --- a/app/src/components/visualizers/sphere/reactive.tsx +++ b/app/src/components/visualizers/sphere/reactive.tsx @@ -7,34 +7,6 @@ import BaseSphere from "./base"; const SphereVisual = ({ coordinateMapper }: VisualProps) => { const { radius, nPoints, unitSideLength } = useSphereVisualConfigContext(); - // const { - // radius, - // nPoints, - // cubeSideLength, - // // mapMode - // } = useControls({ - // "Visual - Sphere": folder( - // { - // radius: { value: 2, min: 0.25, max: 3, step: 0.25 }, - // nPoints: { value: 800, min: 100, max: 2000, step: 25 }, - // cubeSideLength: { - // value: 0.05, - // min: 0.01, - // max: 0.5, - // step: 0.005, - // }, - // // mapMode: { - // // value: MAPPING_MODE_POLAR_2D, - // // options: [ - // // MAPPING_MODE_POLAR_2D, - // // MAPPING_MODE_POLAR_PHI, - // // MAPPING_MODE_POLAR_THETA, - // // ], - // // }, - // }, - // { collapsed: true } - // ), - // }); return ( <> diff --git a/app/src/components/visualizers/visualizerAudio.tsx b/app/src/components/visualizers/visualizerAudio.tsx index 6c1612d2..9b8c51cc 100644 --- a/app/src/components/visualizers/visualizerAudio.tsx +++ b/app/src/components/visualizers/visualizerAudio.tsx @@ -11,18 +11,6 @@ const AudioVisual = ({ visual }: { visual: VisualType }) => { // TODO: Find a better place to put amplitude settings for this audio visual const { amplitude } = useFFTAnalyzerContext(); - // const { amplitude } = useControls({ - // Audio: folder({ - // amplitude: { - // value: 1.0, - // order: 74, - // min: 0.0, - // max: 5.0, - // step: 0.01, - // }, - // }), - // }); - const coordinateMapper = new CoordinateMapper_Data(amplitude, freqData); const energyTracker = new EnergyTracker(energyInfo); const VisualComponent = useMemo( diff --git a/app/src/context/visual.tsx b/app/src/context/visual.tsx index 90c56725..9c4e50ff 100644 --- a/app/src/context/visual.tsx +++ b/app/src/context/visual.tsx @@ -83,6 +83,7 @@ export const VisualContextProvider = ({ case APPLICATION_MODE.WAVE_FORM: case APPLICATION_MODE.NOISE: case APPLICATION_MODE.AUDIO_SCOPE: + case APPLICATION_MODE.PARTICLE_NOISE: setPaletteTrackEnergy(false); break; case APPLICATION_MODE.AUDIO: diff --git a/app/src/context/visualConfig/cube.tsx b/app/src/context/visualConfig/cube.tsx index 6bb1a84b..5b96717c 100644 --- a/app/src/context/visualConfig/cube.tsx +++ b/app/src/context/visualConfig/cube.tsx @@ -21,6 +21,7 @@ export const CubeVisualConfigContext = createContext<{ setUnitSideLength: Dispatch>; setUnitSpacingScalar: Dispatch>; setVolume: Dispatch>; + reset: Dispatch; }; } | null>(null); @@ -53,6 +54,12 @@ export const CubeVisualConfigContextProvider = ({ setUnitSideLength: setUnitSideLength, setUnitSpacingScalar: setUnitSpacingScalar, setVolume: setVolume, + reset: () => { + setNPerSide(initial?.nPerSide ?? 10); + setUnitSideLength(initial?.unitSideLength ?? 0.5); + setUnitSpacingScalar(initial?.unitSpacingScalar ?? 0.1); + setVolume(initial?.volume ?? true); + }, }, }} > diff --git a/app/src/context/visualConfig/grid.tsx b/app/src/context/visualConfig/grid.tsx index aad0f893..c28e1e7a 100644 --- a/app/src/context/visualConfig/grid.tsx +++ b/app/src/context/visualConfig/grid.tsx @@ -21,6 +21,7 @@ export const GridVisualConfigContext = createContext<{ setNCols: Dispatch>; setUnitSideLength: Dispatch>; setUnitSpacingScalar: Dispatch>; + reset: Dispatch; }; } | null>(null); @@ -53,6 +54,12 @@ export const GridVisualConfigContextProvider = ({ setNRows: setNRows, setUnitSideLength: setUnitSideLength, setUnitSpacingScalar: setUnitSpacingScalar, + reset: () => { + setNCols(initial?.nCols ?? 100); + setNRows(initial?.nRows ?? 100); + setUnitSideLength(initial?.unitSideLength ?? 0.025); + setUnitSpacingScalar(initial?.unitSpacingScalar ?? 5); + }, }, }} > diff --git a/app/src/lib/applicationModes.ts b/app/src/lib/applicationModes.ts index 02a7c070..e57978f0 100644 --- a/app/src/lib/applicationModes.ts +++ b/app/src/lib/applicationModes.ts @@ -3,6 +3,7 @@ export const APPLICATION_MODE = { NOISE: "NOISE", AUDIO: "AUDIO", AUDIO_SCOPE: "AUDIO_SCOPE", + PARTICLE_NOISE: "PARTICLE_NOISE", } as const; type ObjectValues = T[keyof T]; @@ -12,6 +13,7 @@ export const isAudioMode = (mode: ApplicationMode) => { switch (mode) { case APPLICATION_MODE.WAVE_FORM: case APPLICATION_MODE.NOISE: + case APPLICATION_MODE.PARTICLE_NOISE: return false; case APPLICATION_MODE.AUDIO: case APPLICATION_MODE.AUDIO_SCOPE: @@ -28,6 +30,8 @@ export const getPlatformSupportedApplicationModes = (): ApplicationMode[] => { APPLICATION_MODE.AUDIO, /* Disabled until bugs can be resolved */ // APPLICATION_MODE.AUDIO_SCOPE, + /* Disabled until IMotionMappers & ICoordinateMappers are more compatible */ + // APPLICATION_MODE.PARTICLE_NOISE, ]; }; @@ -36,6 +40,7 @@ export const isCameraMode = (mode: ApplicationMode) => { case APPLICATION_MODE.WAVE_FORM: case APPLICATION_MODE.NOISE: case APPLICATION_MODE.AUDIO: + case APPLICATION_MODE.PARTICLE_NOISE: return true; case APPLICATION_MODE.AUDIO_SCOPE: return false;