some ui for #13

This commit is contained in:
michalcourson
2025-12-05 18:37:20 -05:00
parent 234e0d3e8a
commit cb069089c0
5 changed files with 156 additions and 81 deletions

View File

@ -53,13 +53,16 @@ function App() {
<div className="grid grid-cols-3 gap-2 items-start"> <div className="grid grid-cols-3 gap-2 items-start">
{/* Left Column */} {/* Left Column */}
<div className="border border-[#2a2a2a] rounded-lg p-4"> <div className="border border-[#2a2a2a] rounded-lg p-4">
<div className="grid grid-cols-2 grid-rows-2 gap-4 items-end"> <div className="flex flex-col gap-4">
<div className="flex items-center justify-center">
<div> <div>
<JuceSlider identifier="harmonyMix" title="Mix" /> <JuceSlider identifier="harmonyMix" title="Mix" />
</div> </div>
<div> <div>
<JuceSlider identifier="formantPreserve" title="Formant" /> <JuceSlider identifier="formantPreserve" title="Formant" />
</div> </div>
</div>
<div className="flex items-center justify-center mt-[45px]">
<div> <div>
<JuceSlider identifier="portTime" title="Portamento Speed" /> <JuceSlider identifier="portTime" title="Portamento Speed" />
</div> </div>
@ -68,33 +71,42 @@ function App() {
</div> </div>
</div> </div>
</div> </div>
</div>
<div className="border border-[#2a2a2a] rounded-lg p-4"> <div className="border border-[#2a2a2a] rounded-lg p-4">
<div className="grid grid-cols-2 grid-rows-2 gap-4 items-end "> <div className="flex flex-col gap-4">
<div className="col-span-2"> <div className="flex flex-col gap-2 items-center">
<div className="grid grid-rows-2 self-center flex justify-center items-start">
<div className="self-center justify-center items-center flex"> <div className="self-center justify-center items-center flex">
<JuceCheckbox identifier="autoTuneEnabled" /> <JuceCheckbox identifier="autoTuneEnabled" />
</div> </div>
<div className="mt-1"> <div className="mt-0 w-full">
<AutoTuneInfo /> <AutoTuneInfo />
</div> </div>
</div> </div>
<div className="grid grid-cols-2 grid-rows-1 gap-4">
<div>
<JuceSlider
identifier="autoTuneSpeed"
title="Auto Tune Speed"
/>
</div> </div>
<div> <div>
<JuceSlider identifier="autoTuneSpeed" title="Auto Tune Speed" /> <JuceSlider
identifier="autoTuneDepth"
title="Auto Tune Depth"
/>
</div> </div>
<div>
<JuceSlider identifier="autoTuneDepth" title="Auto Tune Depth" />
</div> </div>
</div> </div>
</div> </div>
<div className="border border-[#2a2a2a] rounded-lg p-4"> <div className="border border-[#2a2a2a] rounded-lg p-4">
<div className="grid grid-cols-2 grid-rows-2 gap-4 items-end"> <div className="flex flex-col gap-4 items-center justify-center">
<div className="mt-0 pt-0 col-span-2 self-start flex justify-center "> <div className="mt-0 pt-0 flex items-center justify-center ">
<JuceCheckbox identifier="freezeEnabled" /> <JuceCheckbox identifier="freezeEnabled" />
</div> </div>
<div className="flex items-center justify-center mt-[100px]">
<div> <div>
<JuceSlider identifier="freezePitch" title="Freeze Pitch" /> <JuceSlider identifier="freezePitch" title="Freeze Pitch" />
</div> </div>
@ -104,6 +116,7 @@ function App() {
</div> </div>
</div> </div>
</div> </div>
</div>
<Container></Container> <Container></Container>
<div className="rounded-lg"> <div className="rounded-lg">
<MidiNoteInfo /> <MidiNoteInfo />

View File

@ -2,6 +2,7 @@
import React, { useState, useEffect, useRef } from "react"; import React, { useState, useEffect, useRef } from "react";
import CenterGrowSlider from "./CenterGrowSlider.js"; import CenterGrowSlider from "./CenterGrowSlider.js";
import AutoTuneDataReceiver from "../DataRecievers/AutoTuneDataReceiver.js"; import AutoTuneDataReceiver from "../DataRecievers/AutoTuneDataReceiver.js";
import PianoKeyboard from "./PianoKeyboard.js";
// import { Slider } from "@mui/material"; // import { Slider } from "@mui/material";
// import { styled } from "@mui/material/styles"; // import { styled } from "@mui/material/styles";
@ -11,6 +12,8 @@ export default function AutoTuneInfo() {
const [inputCents, setInputCents] = useState(0); const [inputCents, setInputCents] = useState(0);
const [outputCents, setOutputCents] = useState(0); const [outputCents, setOutputCents] = useState(0);
const [autotuneNote, setAutotuneNote] = useState(0); const [autotuneNote, setAutotuneNote] = useState(0);
const [showPopup, setShowPopup] = useState(false);
const [autoTuneKey, setAutoTuneKey] = useState("");
const dataReceiverRef = useRef(null); const dataReceiverRef = useRef(null);
const isActiveRef = useRef(true); const isActiveRef = useRef(true);
@ -56,6 +59,7 @@ export default function AutoTuneInfo() {
}, []); }, []);
return ( return (
<div className="p-0 flex flex-col gap-1">
<div className="flex"> <div className="flex">
<h1 <h1
className="w-8 flex-initial py-2 px-1 text-xl" className="w-8 flex-initial py-2 px-1 text-xl"
@ -72,5 +76,58 @@ export default function AutoTuneInfo() {
</div> </div>
</div> </div>
</div> </div>
<div className="flex justify-start items-center">
<select
value={autoTuneKey}
className="select-none w-10 h-10 rounded px-2 bg-[#262626] text-[#eee]"
onChange={(e) => {
//send stuff to plugin here
setAutoTuneKey("");
}}
aria-label="Select note"
style={{
appearance: "none",
WebkitAppearance: "none",
textAlign: "center",
border: "none",
outline: "none",
}}
>
<option value="" disabled hidden style={{ textAlign: "center" }}>
...
</option>
{[
"C",
"C♯",
"D",
"D♯",
"E",
"F",
"F♯",
"G",
"G♯",
"A",
"A♯",
"B",
].map((key, idx) => (
<option
key={key}
value={idx}
style={{ textAlign: "start", border: "none", outline: "none" }}
>
{key}
</option>
))}
</select>
<div className="h-[40px] w-[85%] self-end px-1">
<PianoKeyboard
heldNotes={[]}
LOWEST_MIDI={0}
HIGHEST_MIDI={11}
showNoteNames={false}
/>
</div>
</div>
</div>
); );
} }

View File

@ -31,8 +31,8 @@ export default function MidiNoteInfo() {
}, []); }, []);
return ( return (
<div className="rounded-lg" style={{ marginTop: "1rem" }}> <div className="rounded-lg h-[80px]" style={{ marginTop: "1rem" }}>
<PianoKeyboard heldNotes={notes} /> <PianoKeyboard heldNotes={notes} LOWEST_MIDI={24} HIGHEST_MIDI={84} />
</div> </div>
); );
} }

View File

@ -17,8 +17,8 @@ const NOTE_NAMES = [
const WHITE_KEYS = [0, 2, 4, 5, 7, 9, 11]; const WHITE_KEYS = [0, 2, 4, 5, 7, 9, 11];
// C2 = 36, C5 = 72 // C2 = 36, C5 = 72
const LOWEST_MIDI = 24; // const LOWEST_MIDI = 24;
const HIGHEST_MIDI = 84; // const HIGHEST_MIDI = 84;
function getNoteName(midi) { function getNoteName(midi) {
const octave = Math.floor(midi / 12) - 1; const octave = Math.floor(midi / 12) - 1;
@ -30,7 +30,12 @@ function isWhiteKey(midi) {
return WHITE_KEYS.includes(midi % 12); return WHITE_KEYS.includes(midi % 12);
} }
export default function PianoKeyboard({ heldNotes }) { export default function PianoKeyboard({
heldNotes,
LOWEST_MIDI,
HIGHEST_MIDI,
showNoteNames = true,
}) {
const heldMap = {}; const heldMap = {};
heldNotes.forEach((n) => (heldMap[n.midi] = n.voice)); heldNotes.forEach((n) => (heldMap[n.midi] = n.voice));
@ -78,11 +83,9 @@ export default function PianoKeyboard({ heldNotes }) {
<div <div
style={{ style={{
position: "relative", position: "relative",
height: 80, height: "100%",
userSelect: "none", userSelect: "none",
width: "100%", width: "100%",
minWidth: 200,
maxWidth: 900,
margin: "0 auto", margin: "0 auto",
}} }}
> >
@ -123,6 +126,7 @@ export default function PianoKeyboard({ heldNotes }) {
borderBottomRightRadius: i === whiteKeys.length - 1 ? 6 : 0, borderBottomRightRadius: i === whiteKeys.length - 1 ? 6 : 0,
}} }}
> >
{showNoteNames && (
<div <div
style={{ style={{
display: "flex", display: "flex",
@ -145,6 +149,7 @@ export default function PianoKeyboard({ heldNotes }) {
</span> </span>
)} )}
</div> </div>
)}
</div> </div>
))} ))}
</div> </div>

View File

@ -181,7 +181,7 @@ WebViewPluginAudioProcessorEditor::WebViewPluginAudioProcessorEditor(WebViewPlug
webComponent->goToURL (WebBrowserComponent::getResourceProviderRoot()); webComponent->goToURL (WebBrowserComponent::getResourceProviderRoot());
#endif #endif
setSize(800, 390); setSize(800, 436);
startTimerHz(60); startTimerHz(60);