diff --git a/src/App.tsx b/src/App.tsx index 4d82286..d9a5b6a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -59,14 +59,20 @@ function App() { // Find range config const rangeConfig = currentInstrumentDef.ranges.find(r => r.id === settings.difficulty); + const getNotesFromConfig = (config: typeof rangeConfig) => { + if (!config) return []; + if (config.notes) return config.notes; + return Array.from({ length: config.max - config.min + 1 }, (_, i) => config.min + i); + }; + if (rangeConfig) { - return Array.from({ length: rangeConfig.max - rangeConfig.min + 1 }, (_, i) => rangeConfig.min + i); + return getNotesFromConfig(rangeConfig); } // Fallback if difficulty ID doesn't match current instrument (e.g. after switch) // Return first range of current instrument const fallbackRange = currentInstrumentDef.ranges[0]; - return Array.from({ length: fallbackRange.max - fallbackRange.min + 1 }, (_, i) => fallbackRange.min + i); + return getNotesFromConfig(fallbackRange); }, [settings.difficulty, currentInstrumentDef]); diff --git a/src/components/Controls.tsx b/src/components/Controls.tsx index edb523b..5b9ddcf 100644 --- a/src/components/Controls.tsx +++ b/src/components/Controls.tsx @@ -2,7 +2,7 @@ import { Settings, Guitar, Music, Gauge } from 'lucide-react'; import { TUNINGS, INSTRUMENT_TUNINGS } from '../music/Tunings'; import { INSTRUMENT_DEFINITIONS } from '../music/InstrumentConfigs'; -export type Difficulty = 'all' | 'first_pos' | 'open' | 'e_string'; +export type Difficulty = string; export interface RhythmSettings { mode: 'bpm' | 'seconds'; @@ -112,7 +112,7 @@ export const Controls: React.FC = ({ settings, onUpdateSettings }