/* Presets.jsx — A/B player presets.
   Audio path: live/audio/main-player-presets/{preset.file}      (wet/on)
   Dry path:   live/audio/main-player-presets/{preset.dryFile}   (raw/off)

   Each preset bundles its own wet+dry pair (rendered with that exact
   fader configuration in the plugin). The earlier "voice × preset"
   matrix is gone: there is no global vocal-sample picker anymore. */

// Single-entry stub. Kept so existing engine signatures
// (`engine.play(sampleId, preset)`, `hasRealWet(sampleId, presetId)`,
// etc.) don't need a refactor — the sampleId is now a constant.
const MV_SAMPLES = [
  { id: 'main', label: '', folder: 'main-player-presets' },
];

// Hero A/B player chip strip. Each preset renders a real wet+dry pair
// captured against that exact fader configuration in the actual plugin.
const MV_PRESETS = [
  {
    id: 'michael-j', name: 'Michael J',
    file: 'michael-j-on.mp3', dryFile: 'michael-j-off.mp3',
    color: '#f5c518', genre: 'Pop',
    real: { main: true },
    state: { power: 0.45, focus: 0.31, fat: 0.66, doubler: 0.33, reverb: 0.53, delay: 0.49, clarity: 0.35, deess: 0.51, voice: 'off', input: 0.5, output: 0.5, autoGain: 1 },
  },
  {
    id: 'bedroom-pop', name: 'Bedroom Pop',
    file: 'bedroom-pop-on.mp3', dryFile: 'bedroom-pop-off.mp3',
    color: '#ff7ca8', genre: 'Pop',
    real: { main: true },
    state: { power: 0.22, focus: 0.24, fat: 0.49, doubler: 0.20, reverb: 0.53, delay: 0.37, clarity: 0.20, deess: 0.38, voice: 'male', input: 0.5, output: 0.5, autoGain: 1 },
  },
  {
    id: 'voice-and-guitar', name: 'Voice and Guitar',
    file: 'voice-and-guitar-on.mp3', dryFile: 'voice-and-guitar-off.mp3',
    color: '#7dd3fc', genre: 'Acoustic',
    real: { main: true },
    state: { power: 0.36, focus: 0.27, fat: 0.57, doubler: 0.15, reverb: 0.62, delay: 0.41, clarity: 0.32, deess: 0.45, voice: 'off', input: 0.5, output: 0.5, autoGain: 1 },
  },
  {
    id: 'indie-rock', name: 'Indie Rock',
    file: 'indie-rock-on.mp3', dryFile: 'indie-rock-off.mp3',
    color: '#a7a5ff', genre: 'Rock',
    real: { main: true },
    // input 0.283 ≈ -5.2 dB given the (v - 0.5) * 24 mapping in PluginShell.
    state: { power: 0.30, focus: 0.23, fat: 0.50, doubler: 0.49, reverb: 0.60, delay: 0.48, clarity: 0.18, deess: 0.44, voice: 'female', input: 0.283, output: 0.5, autoGain: 1 },
  },
];

// Helper: get wet/dry URLs. sampleId is kept in the signature only so
// callers in AudioEngine don't need to change shape.
const getAudioUrl = (sampleId, presetFile) => {
  const sample = MV_SAMPLES.find(s => s.id === sampleId);
  if (!sample || !presetFile) return null;
  return `live/audio/${sample.folder}/${presetFile}`;
};
const getDryUrl = (sampleId, preset) => {
  const sample = MV_SAMPLES.find(s => s.id === sampleId);
  if (!sample || !preset || !preset.dryFile) return null;
  return `live/audio/${sample.folder}/${preset.dryFile}`;
};

// Effects story — kept for the playground section
const MV_EFFECTS_STORY = [
  { key: 'focus',   label: 'FOCUS',   color: '#ff7ca8',
    headline: 'Cut the mud. Push the presence.',
    body: 'FOCUS sweeps out everything below the voice \u2014 the room rumble, the proximity bloom, the cable hum \u2014 then lifts the 3\u20135k band that makes a vocal sit where the listener\u2019s attention lives.',
    soloValue: 0.95 },
  { key: 'fat',     label: 'FAT',     color: '#ff7ca8',
    headline: 'Weight without mud.',
    body: 'FAT adds body around 150\u2013250 Hz \u2014 the chest of the voice. Controlled shelf, not a bass boost. On a thin take, it\u2019s the difference between tiny and in the room.',
    soloValue: 0.85 },
  { key: 'doubler', label: 'DOUBLER', color: '#f5c518',
    headline: 'Two voices from one take.',
    body: 'Stereo micro-delay with detuned returns. Makes the lead wider and fuller without killing the mono collapse. Turn it up on hooks, leave it down on verses.',
    soloValue: 0.8 },
  { key: 'reverb',  label: 'REVERB',  color: '#f5c518',
    headline: 'Depth, tuned per genre.',
    body: 'A plate-style tail voiced for contemporary vocal production \u2014 short and tight on rap, long and lush on R&B.',
    soloValue: 0.85 },
  { key: 'delay',   label: 'DELAY',   color: '#f5c518',
    headline: 'Space between the words.',
    body: 'A short musical delay tuned to sit behind the vocal instead of crowding it. Use it for a subtle throw on the ends of lines \u2014 or push it for an 80s pad.',
    soloValue: 0.85 },
  { key: 'clarity', label: 'CLARITY', color: '#a7a5ff',
    headline: 'Air, not harshness.',
    body: 'A high-shelf you can actually push. Most air bands turn a great take into a sibilance machine \u2014 CLARITY is voiced around 8\u201312k so you get sparkle without the pain.',
    soloValue: 0.95 },
  { key: 'deess',   label: 'DE-ESS',  color: '#a7a5ff',
    headline: 'Tame the esses. Keep the air.',
    body: 'Frequency-dependent gain riding around the sibilant band. Works with CLARITY \u2014 push air all you want, the esses stay in their lane.',
    soloValue: 0.95 },
  { key: 'power',   label: 'POWER',   color: '#ef4444',
    headline: 'The master drive.',
    body: 'POWER feeds the whole chain harder \u2014 the character knob. At low settings it\u2019s transparent; past noon it pushes saturation and density into the lead.',
    soloValue: 0.85 },
];

Object.assign(window, { MV_SAMPLES, MV_PRESETS, MV_EFFECTS_STORY, getAudioUrl, getDryUrl });
