controller-name.rkt
#lang typed/racket

(provide num->controller-name)

;; controller names taken from
;; http://www.midi.org/techspecs/midimessages.php
(: num->controller-name (Integer -> String))
(define (num->controller-name n)
  (match (vector-ref controller-name-table n)
    ["Undefined " (format "Undefined (~s)" n)]
    [other other]))

(: controller-name-table (Vectorof String))
(define controller-name-table
  #("Bank Select "
  "Modulation Wheel or Lever "
  "Breath Controller "
  "Undefined "
  "Foot Controller "
  "Portamento Time "
  "Data Entry MSB "
  "Channel Volume (formerly Main Volume) "
  "Balance "
  "Undefined "
  "Pan "
  "Expression Controller "
  "Effect Control 1 "
  "Effect Control 2 "
  "Undefined "
  "Undefined "
  "General Purpose Controller 1 "
  "General Purpose Controller 2 "
  "General Purpose Controller 3 "
  "General Purpose Controller 4 "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "LSB for Control 0 (Bank Select) "
  "LSB for Control 1 (Modulation Wheel or Lever) "
  "LSB for Control 2 (Breath Controller) "
  "LSB for Control 3 (Undefined) "
  "LSB for Control 4 (Foot Controller) "
  "LSB for Control 5 (Portamento Time) "
  "LSB for Control 6 (Data Entry) "
  "LSB for Control 7 (Channel Volume, formerly Main Volume) "
  "LSB for Control 8 (Balance) "
  "LSB for Control 9 (Undefined) "
  "LSB for Control 10 (Pan) "
  "LSB for Control 11 (Expression Controller) "
  "LSB for Control 12 (Effect control 1) "
  "LSB for Control 13 (Effect control 2) "
  "LSB for Control 14 (Undefined) "
  "LSB for Control 15 (Undefined) "
  "LSB for Control 16 (General Purpose Controller 1) "
  "LSB for Control 17 (General Purpose Controller 2) "
  "LSB for Control 18 (General Purpose Controller 3) "
  "LSB for Control 19 (General Purpose Controller 4) "
  "LSB for Control 20 (Undefined) "
  "LSB for Control 21 (Undefined) "
  "LSB for Control 22 (Undefined) "
  "LSB for Control 23 (Undefined) "
  "LSB for Control 24 (Undefined) "
  "LSB for Control 25 (Undefined) "
  "LSB for Control 26 (Undefined) "
  "LSB for Control 27 (Undefined) "
  "LSB for Control 28 (Undefined) "
  "LSB for Control 29 (Undefined) "
  "LSB for Control 30 (Undefined) "
  "LSB for Control 31 (Undefined) "
  "Damper Pedal on/off (Sustain) "
  "Portamento On/Off "
  "Sostenuto On/Off "
  "Soft Pedal On/Off "
  "Legato Footswitch "
  "Hold 2 "
  "Sound Controller 1 (default: Sound Variation) "
  "Sound Controller 2 (default: Timbre/Harmonic Intens.) "
  "Sound Controller 3 (default: Release Time) "
  "Sound Controller 4 (default: Attack Time) "
  "Sound Controller 5 (default: Brightness) "
  "Sound Controller 6 (default: Decay Time - see MMA RP-021) "
  "Sound Controller 7 (default: Vibrato Rate - see MMA RP-021) "
  "Sound Controller 8 (default: Vibrato Depth - see MMA RP-021) "
  "Sound Controller 9 (default: Vibrato Delay - see MMA RP-021) "
  "Sound Controller 10 (default undefined - see MMA RP-021) "
  "General Purpose Controller 5 "
  "General Purpose Controller 6 "
  "General Purpose Controller 7 "
  "General Purpose Controller 8 "
  "Portamento Control "
  "Undefined "
  "Undefined "
  "Undefined "
  "High Resolution Velocity Prefix "
  "Undefined "
  "Undefined "
  "Effects 1 Depth(default: Reverb Send Level - see MMA RP-023)(formerly External Effects Depth) "
  "Effects 2 Depth (formerly Tremolo Depth) "
  "Effects 3 Depth(default: Chorus Send Level - see MMA RP-023)(formerly Chorus Depth) "
  "Effects 4 Depth (formerly Celeste [Detune] Depth) "
  "Effects 5 Depth (formerly Phaser Depth) "
  "Data Increment (Data Entry +1) (see MMA RP-018) "
  "Data Decrement (Data Entry -1) (see MMA RP-018) "
  "Non-Registered Parameter Number (NRPN) - LSB "
  "Non-Registered Parameter Number (NRPN) - MSB "
  "Registered Parameter Number (RPN) - LSB* "
  "Registered Parameter Number (RPN) - MSB* "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "
  "Undefined "))