From 608b27541f88bda5bf2b3c9330e84f28df3b7b07 Mon Sep 17 00:00:00 2001 From: kgalvin Date: Thu, 9 Nov 2023 13:47:34 -0800 Subject: [PATCH] fix types --- src/components/ContourAudioControls.tsx | 4 ++-- src/components/ContourAudioEngine.tsx | 4 ++-- src/components/FractalPlayer.tsx | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/components/ContourAudioControls.tsx b/src/components/ContourAudioControls.tsx index c51c668..bb924fb 100644 --- a/src/components/ContourAudioControls.tsx +++ b/src/components/ContourAudioControls.tsx @@ -3,7 +3,7 @@ import WebRenderer from "@elemaudio/web-renderer"; import dynamic from "next/dynamic"; import React, {useEffect, useState} from "react"; import styled from "styled-components"; -import {AudioParamsType, KnobRow} from "@/components/FractalPlayer"; +import {ContourAudioParamsType, KnobRow} from "@/components/FractalPlayer"; type ContourAudioControlsProps = { contour: { angle: number; duration: number }[]; @@ -25,7 +25,7 @@ const ContourAudioControls: React.FC = ( const [freqScaling, setFreqScaling] = useState(1); const [highest, setHighest] = useState(6000); const [duration, setDuration] = useState(5); - const [audioParams, setAudioParams] = useState({ + const [audioParams, setAudioParams] = useState({ volume: 0, threshold: 0, highest: 0, diff --git a/src/components/ContourAudioEngine.tsx b/src/components/ContourAudioEngine.tsx index 1ddb94b..f11c724 100644 --- a/src/components/ContourAudioEngine.tsx +++ b/src/components/ContourAudioEngine.tsx @@ -1,4 +1,4 @@ -import {AudioParamsType} from "@/components/FractalPlayer"; +import {ContourAudioParamsType} from "@/components/FractalPlayer"; import dynamic from "next/dynamic"; import React, {useCallback, useEffect, useState} from "react"; import {el, NodeRepr_t} from "@elemaudio/core"; @@ -14,7 +14,7 @@ type AudioEngineProps = { audioContext: AudioContext | null; core: WebRenderer; playing: boolean; - audioParams: AudioParamsType; + audioParams: ContourAudioParamsType; } const AudioEngine: React.FC = ({ diff --git a/src/components/FractalPlayer.tsx b/src/components/FractalPlayer.tsx index a256258..aa2abdd 100644 --- a/src/components/FractalPlayer.tsx +++ b/src/components/FractalPlayer.tsx @@ -41,12 +41,18 @@ type FractalPlayerProps = { export type AudioParamsType = { volume: number; - threshold?: number; - highest?: number; - lowest?: number; - smoothing?: number; - freqScaling?: number; - duration?: number; + threshold: number; + highest: number; + lowest: number; + smoothing: number; +} + +export type ContourAudioParamsType = { + volume: number; + threshold: number; + highest: number; + freqScaling: number; + duration: number; } const FractalPlayer: React.FC = ({