diff --git a/src/App.tsx b/src/App.tsx index d958b85..deb5867 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -306,6 +306,13 @@ function App() { return getFretboardPositions(targetMidi, currentTuning); }, [settings.showHint, targetMidi, currentTuning, currentInstrumentDef]); + // Auto-enable mic when tuner is turned on + useEffect(() => { + if (settings.showTuningMeter && !listening) { + setListening(true); + } + }, [settings.showTuningMeter, listening]); + return (
{!settings.zenMode && ( @@ -423,22 +430,18 @@ function App() { {listening ? : } - {settings.showTuningMeter && pitchData ? ( - - ) : ( -
- {pitchData ? ( - <> - - {pitchData.note} - - {Math.round(pitchData.frequency)} Hz - - ) : ( - {listening ? "Listening..." : "Mic Off"} - )} -
- )} +
+ {pitchData ? ( + <> + + {pitchData.note} + + {Math.round(pitchData.frequency)} Hz + + ) : ( + {listening ? "Listening..." : "Mic Off"} + )} +
) } @@ -446,13 +449,17 @@ function App() { {!settings.zenMode && ( - ) - } + )} + {/* Floating Zen Mode Button (Toggle) */} -

Keyboard Shortcuts

+ { + showHelp && ( +
setShowHelp(false)}> +
e.stopPropagation()}> + +

Keyboard Shortcuts

-
- Skip Note - Space -
-
- Toggle Hint - H -
-
- Toggle Zen Mode - Z -
-
- Replay Note - R -
-
- Toggle Game Mode - M -
-
- Close Help / Exit Zen - Esc +
+ Skip Note + Space +
+
+ Toggle Hint + H +
+
+ Toggle Zen Mode + Z +
+
+ Replay Note + R +
+
+ Toggle Game Mode + M +
+
+ Close Help / Exit Zen + Esc +
-
- )} + ) + } ); } diff --git a/src/components/Controls.tsx b/src/components/Controls.tsx index 679edf6..192532f 100644 --- a/src/components/Controls.tsx +++ b/src/components/Controls.tsx @@ -2,6 +2,7 @@ import { Settings, Guitar, Music, Gauge } from 'lucide-react'; import { TUNINGS, INSTRUMENT_TUNINGS } from '../music/Tunings'; import { INSTRUMENT_DEFINITIONS } from '../music/InstrumentConfigs'; import { getTempoMarking } from '../music/TempoMarkings'; +import { TuningMeter } from './TuningMeter'; export type Difficulty = string; @@ -33,9 +34,10 @@ export interface AppSettings { interface ControlsProps { settings: AppSettings; onUpdateSettings: (s: AppSettings) => void; + currentPitch: { note: string; cents: number } | null; } -export const Controls: React.FC = ({ settings, onUpdateSettings }) => { +export const Controls: React.FC = ({ settings, onUpdateSettings, currentPitch }) => { const handleDifficultyChange = (e: React.ChangeEvent) => { onUpdateSettings({ ...settings, difficulty: e.target.value as Difficulty }); }; @@ -223,6 +225,16 @@ export const Controls: React.FC = ({ settings, onUpdateSettings }
+ {settings.showTuningMeter && currentPitch && ( +
+ +
+ )} + {settings.showTuningMeter && !currentPitch && ( +
+ Listening... +
+ )} {/* Tool 2: Metronome */}