//! MIDI word definitions: channel, CC, pitch bend, transport, and device routing.

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

pub(super) const WORDS: &[Word] = &[
    Word {
        name: "chan",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set MIDI channel 1-16",
        example: "1 chan",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "ccnum",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set MIDI CC number 0-127",
        example: "1 ccnum",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "ccout",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set MIDI CC output value 0-127",
        example: "64 ccout",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "bend",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set pitch bend -1.0 to 1.0 (0 = center)",
        example: "0.5 bend",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "pressure",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set channel pressure (aftertouch) 0-127",
        example: "64 pressure",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "program",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set program change number 0-127",
        example: "0 program",
        compile: Param,
        varargs: true,
    },
    Word {
        name: "m.",
        aliases: &[],
        category: "MIDI",
        stack: "(--)",
        desc: "Emit MIDI message from params (note/cc/bend/pressure/program)",
        example: "60 note 100 velocity 1 chan m.",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "mclock",
        aliases: &[],
        category: "MIDI",
        stack: "(--)",
        desc: "Send MIDI clock pulse (24 per quarter note)",
        example: "mclock",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "mstart",
        aliases: &[],
        category: "MIDI",
        stack: "(--)",
        desc: "Send MIDI start message",
        example: "mstart",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "mstop",
        aliases: &[],
        category: "MIDI",
        stack: "(--)",
        desc: "Send MIDI stop message",
        example: "mstop",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "mcont",
        aliases: &[],
        category: "MIDI",
        stack: "(--)",
        desc: "Send MIDI continue message",
        example: "mcont",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "ccval",
        aliases: &[],
        category: "MIDI",
        stack: "(cc chan -- val)",
        desc: "Read CC value 0-127 from MIDI input (uses dev param for device)",
        example: "1 1 ccval",
        compile: Simple,
        varargs: false,
    },
    Word {
        name: "dev",
        aliases: &[],
        category: "MIDI",
        stack: "(v.. --)",
        desc: "Set MIDI device slot 0-3 for output/input",
        example: "1 dev 60 note m.",
        compile: Param,
        varargs: true,
    },
];
