{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "ctrl-units-v1",
  "title": "Control units v1: engineering units for MIDI-CI Property Exchange controller entries",
  "description": "Optional x-units object on an AllCtrlList / ChCtrlList entry (M2-117). Maps the entry's 32-bit minMax linearly onto an engineering range for display and stepping. A device that uses it serves this schema as JSONSchema with resId \"ctrl-units-v1\".",
  "type": "object",
  "properties": {
    "x-units": {
      "type": "object",
      "required": [
        "min",
        "max"
      ],
      "additionalProperties": false,
      "properties": {
        "min": {
          "type": "number",
          "description": "Engineering value at minMax[0]"
        },
        "max": {
          "type": "number",
          "description": "Engineering value at minMax[1]"
        },
        "unit": {
          "type": "string",
          "maxLength": 8,
          "description": "Shown after the value: an SI symbol (ns, kHz, ms, V), %, °, or a short word"
        },
        "decimals": {
          "type": "integer",
          "minimum": 0,
          "maximum": 6,
          "default": 0
        },
        "step": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Fine step in engineering units; values are rounded to it. Default 10^-decimals"
        },
        "coarse": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Normal (coarse) step; default = step"
        },
        "zero": {
          "type": "number",
          "description": "Bar origin for bipolar controls; default 0 when min < 0 < max, else min"
        }
      }
    }
  },
  "$comment": "EIS clause 8.1 (CTRL-USB). Published at https://lzxindustries.net/eis/data/ctrl-units-v1.schema.json; a device serves it as the PE JSONSchema resource with resId ctrl-units-v1."
}
