//! Word metadata for sound commands, sample/oscillator params, FM, modulation, and LFO.

use super::{Word, WordCompile::*};

pub(super) const WORDS: &[Word] = &[
    // Sound
    Word {
        name: "sound",
        aliases: &["s"],
        category: "Sound",
        stack: "(name --)",
        desc: "Begin sound command",
        example: "\"kick\" sound",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: ".",
        aliases: &[],
        category: "Sound",
        stack: "(--)",
        desc: "Emit current sound",
        example: "\"kick\" s . . . .",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "arp",
        aliases: &[],
        category: "Sound",
        stack: "(v1..vn -- arplist)",
        desc: "Wrap stack values as arpeggio list for spreading across deltas",
        example: "c4 e4 g4 b4 arp note => arpeggio",
        compile: Simple,
        varargs: true,
    },
    Word {
        name: "clear",
        aliases: &[],
        category: "Sound",
        stack: "(--)",
        desc: "Clear sound register (sound and all params)",
        example: "\"kick\" s 0.5 gain . clear \"hat\" s .",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "all",
        aliases: &[],
        category: "Sound",
        stack: "(--)",
        desc: "Apply current params to all sounds",
        example: "500 lpf 0.5 verb all",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "noall",
        aliases: &[],
        category: "Sound",
        stack: "(--)",
        desc: "Clear global params",
        example: "noall",
        compile: Simple,
        varargs: false,
    },
    // Recording
    Word {
        name: "rec",
        aliases: &[],
        category: "Sound",
        stack: "(name --)",
        desc: "Toggle recording audio output to named sample",
        example: "\"loop1\" rec",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "overdub",
        aliases: &["dub"],
        category: "Sound",
        stack: "(name --)",
        desc: "Toggle overdub recording onto existing named sample",
        example: "\"loop1\" overdub",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "orec",
        aliases: &[],
        category: "Sound",
        stack: "(name orbit --)",
        desc: "Toggle recording a single orbit into named sample",
        example: "\"drums\" 0 orec",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "odub",
        aliases: &[],
        category: "Sound",
        stack: "(name orbit --)",
        desc: "Toggle overdub recording a single orbit onto named sample",
        example: "\"drums\" 0 odub",
        compile: Simple,
        varargs: false,
    },
    // Sample
    Word {
        name: "bank",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set sample bank suffix",
        example: "\"a\" bank",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "time",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set time offset",
        example: "0.1 time",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "repeat",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set repeat count",
        example: "4 repeat",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "dur",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set duration",
        example: "0.5 dur",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "gate",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set gate time",
        example: "0.8 gate",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "speed",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set playback speed",
        example: "1.5 speed",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "begin",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set sample start (0-1)",
        example: "0.25 begin",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "end",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set sample end (0-1)",
        example: "0.75 end",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "slice",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Divide sample into N equal slices",
        example: r#""break" s 8 slice 3 pick ."#,
        compile: Param,
        varargs: true,
    },
    Word {
        name: "pick",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Select which slice to play (0-indexed, wraps)",
        example: r#""break" s 8 slice 3 pick ."#,
        compile: Param,
        varargs: true,
    },
    Word {
        name: "voice",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set voice number",
        example: "1 voice",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "orbit",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set orbit/bus",
        example: "0 orbit",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "n",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set sample number",
        example: "0 n",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "cut",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Set cut group",
        example: "1 cut",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "reset",
        aliases: &[],
        category: "Sample",
        stack: "(v.. --)",
        desc: "Reset parameter",
        example: "1 reset",
        compile: Param,
        varargs: true,
    },
    // Oscillator
    Word {
        name: "freq",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set frequency (Hz)",
        example: "440 freq",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "detune",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set detune amount",
        example: "0.01 detune",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "glide",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set glide/portamento",
        example: "0.1 glide",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "pw",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set pulse width",
        example: "0.5 pw",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "wave",
        aliases: &["waveform"],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set drum waveform [0,1]: 0=sine, 0.5=tri, 1=saw",
        example: "0.5 wave",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "spread",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set stereo spread",
        example: "0.5 spread",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "mult",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set multiplier",
        example: "2 mult",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "warp",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set warp amount",
        example: "0.5 warp",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "mirror",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set mirror",
        example: "1 mirror",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "harmonics",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set harmonics (mutable only)",
        example: "4 harmonics",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "timbre",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set timbre (mutable only)",
        example: "0.5 timbre",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "morph",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set morph (mutable only)",
        example: "0.5 morph",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "coarse",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set coarse tune",
        example: "12 coarse",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "sub",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set sub oscillator level",
        example: "0.5 sub",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "suboct",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set sub oscillator octave",
        example: "2 suboct",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "subwave",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set sub oscillator waveform",
        example: "1 subwave",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "note",
        aliases: &[],
        category: "Oscillator",
        stack: "(v.. --)",
        desc: "Set MIDI note",
        example: "60 note",
        compile: Param,
        varargs: true,
    },
    // Wavetable
    Word {
        name: "scan",
        aliases: &[],
        category: "Wavetable",
        stack: "(v.. --)",
        desc: "Set wavetable scan position (0-1)",
        example: "0.5 scan",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "wtlen",
        aliases: &[],
        category: "Wavetable",
        stack: "(v.. --)",
        desc: "Set wavetable cycle length in samples",
        example: "2048 wtlen",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "scanlfo",
        aliases: &[],
        category: "Wavetable",
        stack: "(v.. --)",
        desc: "Set scan LFO rate (Hz)",
        example: "0.2 scanlfo",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "scandepth",
        aliases: &[],
        category: "Wavetable",
        stack: "(v.. --)",
        desc: "Set scan LFO depth (0-1)",
        example: "0.4 scandepth",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "scanshape",
        aliases: &[],
        category: "Wavetable",
        stack: "(v.. --)",
        desc: "Set scan LFO shape (sine/tri/saw/square/sh)",
        example: "\"tri\" scanshape",
        compile: Param,
        varargs: true,
    },
    // FM
    Word {
        name: "fm",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM frequency",
        example: "200 fm",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fmh",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM harmonic ratio",
        example: "2 fmh",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fmshape",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM shape",
        example: "0 fmshape",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fme",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM envelope",
        example: "0.5 fme",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fma",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM attack",
        example: "0.01 fma",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fmd",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM decay",
        example: "0.1 fmd",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fms",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM sustain",
        example: "0.5 fms",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fmr",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM release",
        example: "0.1 fmr",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fm2",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM operator 2 depth",
        example: "1.5 fm2",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fm2h",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM operator 2 harmonic ratio",
        example: "3 fm2h",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fmalgo",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM algorithm (0=cascade 1=parallel 2=branch)",
        example: "0 fmalgo",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "fmfb",
        aliases: &[],
        category: "FM",
        stack: "(v.. --)",
        desc: "Set FM feedback amount",
        example: "0.5 fmfb",
        compile: Param,
        varargs: true,
    },
    // Modulation
    Word {
        name: "vib",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set vibrato rate",
        example: "5 vib",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "vibmod",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set vibrato depth",
        example: "0.5 vibmod",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "vibshape",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set vibrato shape",
        example: "0 vibshape",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "am",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set AM frequency",
        example: "10 am",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "amdepth",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set AM depth",
        example: "0.5 amdepth",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "amshape",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set AM shape",
        example: "0 amshape",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "rm",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set RM frequency",
        example: "100 rm",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "rmdepth",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set RM depth",
        example: "0.5 rmdepth",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "rmshape",
        aliases: &[],
        category: "Modulation",
        stack: "(v.. --)",
        desc: "Set RM shape",
        example: "0 rmshape",
        compile: Param,
        varargs: true,
    },
    // LFO
    Word {
        name: "ramp",
        aliases: &[],
        category: "LFO",
        stack: "(freq curve -- val)",
        desc: "Ramp [0,1]: fract(freq*beat)^curve",
        example: "0.25 2.0 ramp",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "range",
        aliases: &[],
        category: "LFO",
        stack: "(val min max -- scaled)",
        desc: "Scale [0,1] to [min,max]",
        example: "0.5 200 800 range => 500",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "linramp",
        aliases: &[],
        category: "LFO",
        stack: "(freq -- val)",
        desc: "Linear ramp (curve=1)",
        example: "1.0 linramp",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "expramp",
        aliases: &[],
        category: "LFO",
        stack: "(freq -- val)",
        desc: "Exponential ramp (curve=3)",
        example: "0.25 expramp",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "logramp",
        aliases: &[],
        category: "LFO",
        stack: "(freq -- val)",
        desc: "Logarithmic ramp (curve=0.3)",
        example: "2.0 logramp",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "triangle",
        aliases: &[],
        category: "LFO",
        stack: "(freq -- val)",
        desc: "Triangle wave [0,1]: 0→1→0",
        example: "0.5 triangle",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "perlin",
        aliases: &[],
        category: "LFO",
        stack: "(freq -- val)",
        desc: "Perlin noise [0,1] sampled at freq*beat",
        example: "0.25 perlin",
        compile: Simple,
        varargs: false,
    },
    // Audio-rate Modulation DSL
    Word {
        name: "lfo",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Sine oscillation: min~max:period",
        example: "200 4000 2 lfo lpf",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "tlfo",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Triangle oscillation: min~max:periodt",
        example: "0.3 0.7 0.5 tlfo pan",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "wlfo",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Sawtooth oscillation: min~max:periodw",
        example: "200 4000 1 wlfo lpf",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "qlfo",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Square oscillation: min~max:periodq",
        example: "0.0 1.0 0.25 qlfo gain",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "slide",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(start end dur -- str)",
        desc: "Linear transition: start>end:dur",
        example: "0 1 0.01 slide gain",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "expslide",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(start end dur -- str)",
        desc: "Exponential transition: start>end:dure",
        example: "0 1 0.5 expslide gain",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "sslide",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(start end dur -- str)",
        desc: "Smooth transition: start>end:durs",
        example: "200 800 1 sslide lpf",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "jit",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Random hold: min?max:period",
        example: "200 4000 0.5 jit lpf",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "sjit",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Smooth random: min?max:periods",
        example: "200 4000 0.5 sjit lpf",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "drunk",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(min max period -- str)",
        desc: "Drunk walk: min?max:periodd",
        example: "200 4000 0.5 drunk lpf",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "env",
        aliases: &[],
        category: "Audio Modulation",
        stack: "(start t1 d1 ... -- str)",
        desc: "Multi-segment envelope: start>t1:d1>...",
        example: "0 1 0.01 0.7 0.1 0 2 env gain",
        compile: Simple,
        varargs: false,
    },
];
