{- |
MIDI controller data type and common controller definitions.

See <http://www.midi.org/techspecs/midimessages.php>.
-}
module Sound.MIDI.Controller (
   T, Value, fromInt, toInt,

   bankSelect, modulation, breathControl, footControl, portamentoTime,
   dataEntry, volume, balance, panorama, expression,
   effectControl1, effectControl2,
   generalPurpose1, generalPurpose2, generalPurpose3, generalPurpose4,
   vectorX, vectorY,
   soundController1, soundController2, soundController3,
   soundController4, soundController5, soundController6,
   soundController7, soundController8, soundController9,
   soundController10, portamentoControl,
   effect1Depth, effect2Depth, effect3Depth, effect4Depth, effect5Depth,

   bankSelectMSB, modulationMSB, breathControlMSB, footControlMSB,
   portamentoTimeMSB, dataEntryMSB, volumeMSB, balanceMSB,
   panoramaMSB, expressionMSB,
   effectControl1MSB, effectControl2MSB,
   generalPurpose1MSB, generalPurpose2MSB,
   generalPurpose3MSB, generalPurpose4MSB,

   bankSelectLSB, modulationLSB, breathControlLSB, footControlLSB,
   portamentoTimeLSB, dataEntryLSB, volumeLSB, balanceLSB,
   panoramaLSB, expressionLSB,
   effectControl1LSB, effectControl2LSB,
   generalPurpose1LSB, generalPurpose2LSB,
   generalPurpose3LSB, generalPurpose4LSB,

   soundVariation, timbre, harmonicIntensity,
   releaseTime, attackTime, brightness, decayTime,
   vibratoRate, vibratoDepth, vibratoDelay,
   reverbSendLevel, chorusSendLevel, legato,

   sustain, portamento, sustenuto, softPedal, hold2,
   generalPurpose5, generalPurpose6, generalPurpose7, generalPurpose8,
   externalEffectDepth, tremoloDepth, chorusDepth, celesteDepth, phaserDepth,

   dataIncrement, dataDecrement,
   nonRegisteredParameterLSB, nonRegisteredParameterMSB,
   registeredParameterLSB, registeredParameterMSB,
   ) where

import qualified Sound.MIDI.ControllerPrivate as CtrlP

import Sound.MIDI.Utility (checkRange, )


-- * MIDI controller data type


{-
In the future this will be the main type,
and @Controller@ becomes a synonym and is eventually removed.
-}
type T = CtrlP.Controller

fromInt :: Int -> T
fromInt :: Int -> T
fromInt = forall a.
(Bounded a, Ord a, Show a) =>
String -> (Int -> a) -> Int -> a
checkRange String
"Controller" Int -> T
CtrlP.Controller

toInt :: T -> Int
toInt :: T -> Int
toInt = T -> Int
CtrlP.fromController


type Value = Int


-- * predefined MIDI controllers

-- ** simple names for controllers, if only most-significant bytes are used

bankSelect, modulation, breathControl, footControl, portamentoTime,
   dataEntry, volume, balance, panorama, expression,
   effectControl1, effectControl2,
   generalPurpose1, generalPurpose2, generalPurpose3, generalPurpose4 :: T
bankSelect :: T
bankSelect      = T
bankSelectMSB
modulation :: T
modulation      = T
modulationMSB
breathControl :: T
breathControl   = T
breathControlMSB
footControl :: T
footControl     = T
footControlMSB
portamentoTime :: T
portamentoTime  = T
portamentoTimeMSB
dataEntry :: T
dataEntry       = T
dataEntryMSB
volume :: T
volume          = T
volumeMSB
balance :: T
balance         = T
balanceMSB
panorama :: T
panorama        = T
panoramaMSB
expression :: T
expression      = T
expressionMSB
effectControl1 :: T
effectControl1  = T
effectControl1MSB
effectControl2 :: T
effectControl2  = T
effectControl2MSB
generalPurpose1 :: T
generalPurpose1 = T
generalPurpose1MSB
generalPurpose2 :: T
generalPurpose2 = T
generalPurpose2MSB
generalPurpose3 :: T
generalPurpose3 = T
generalPurpose3MSB
generalPurpose4 :: T
generalPurpose4 = T
generalPurpose4MSB


-- ** aliases for general purpose controllers

vectorX, vectorY,
   soundVariation, timbre, harmonicIntensity,
   releaseTime, attackTime, brightness, decayTime,
   vibratoRate, vibratoDepth, vibratoDelay,
   reverbSendLevel, chorusSendLevel,
   externalEffectDepth, tremoloDepth, chorusDepth, celesteDepth, phaserDepth :: T

vectorX :: T
vectorX = T
generalPurpose1
vectorY :: T
vectorY = T
generalPurpose2

soundVariation :: T
soundVariation    = T
soundController1
timbre :: T
timbre            = T
soundController2
harmonicIntensity :: T
harmonicIntensity = T
soundController2
releaseTime :: T
releaseTime       = T
soundController3
attackTime :: T
attackTime        = T
soundController4
brightness :: T
brightness        = T
soundController5
decayTime :: T
decayTime         = T
soundController6
vibratoRate :: T
vibratoRate       = T
soundController7
vibratoDepth :: T
vibratoDepth      = T
soundController8
vibratoDelay :: T
vibratoDelay      = T
soundController9

reverbSendLevel :: T
reverbSendLevel = T
effect1Depth
chorusSendLevel :: T
chorusSendLevel = T
effect3Depth

externalEffectDepth :: T
externalEffectDepth = T
effect1Depth
tremoloDepth :: T
tremoloDepth        = T
effect2Depth
chorusDepth :: T
chorusDepth         = T
effect3Depth
celesteDepth :: T
celesteDepth        = T
effect4Depth
phaserDepth :: T
phaserDepth         = T
effect5Depth


-- ** controllers for most-significant bytes of control values
bankSelectMSB, modulationMSB, breathControlMSB, footControlMSB,
   portamentoTimeMSB, dataEntryMSB,
   volumeMSB, balanceMSB, panoramaMSB, expressionMSB,
   effectControl1MSB, effectControl2MSB,
   generalPurpose1MSB, generalPurpose2MSB,
   generalPurpose3MSB, generalPurpose4MSB :: T

-- ** controllers for least-significant bytes of control values
bankSelectLSB, modulationLSB, breathControlLSB, footControlLSB,
   portamentoTimeLSB, dataEntryLSB,
   volumeLSB, balanceLSB, panoramaLSB, expressionLSB,
   effectControl1LSB, effectControl2LSB,
   generalPurpose1LSB, generalPurpose2LSB,
   generalPurpose3LSB, generalPurpose4LSB :: T

-- ** controllers of sound and global effects
sustain, portamento, sustenuto, softPedal, legato, hold2,
   soundController1, soundController2, soundController3,
   soundController4, soundController5, soundController6,
   soundController7, soundController8, soundController9,
   soundController10,
   generalPurpose5, generalPurpose6, generalPurpose7, generalPurpose8,
   portamentoControl,
   effect1Depth, effect2Depth, effect3Depth, effect4Depth, effect5Depth :: T

-- ** increment/decrement and parameter numbers
dataIncrement, dataDecrement,
   nonRegisteredParameterLSB, nonRegisteredParameterMSB,
   registeredParameterLSB, registeredParameterMSB :: T

bankSelectMSB :: T
bankSelectMSB             = forall a. Enum a => Int -> a
toEnum Int
0x00  {-  00 00 -}
modulationMSB :: T
modulationMSB             = forall a. Enum a => Int -> a
toEnum Int
0x01  {-  01 01 -}
breathControlMSB :: T
breathControlMSB          = forall a. Enum a => Int -> a
toEnum Int
0x02  {-  02 02 -}
footControlMSB :: T
footControlMSB            = forall a. Enum a => Int -> a
toEnum Int
0x04  {-  04 04 -}
portamentoTimeMSB :: T
portamentoTimeMSB         = forall a. Enum a => Int -> a
toEnum Int
0x05  {-  05 05 -}
dataEntryMSB :: T
dataEntryMSB              = forall a. Enum a => Int -> a
toEnum Int
0x06  {-  06 06 -}
volumeMSB :: T
volumeMSB                 = forall a. Enum a => Int -> a
toEnum Int
0x07  {-  07 07 -}
balanceMSB :: T
balanceMSB                = forall a. Enum a => Int -> a
toEnum Int
0x08  {-  08 08 -}
panoramaMSB :: T
panoramaMSB               = forall a. Enum a => Int -> a
toEnum Int
0x0A  {-  10 0A -}
expressionMSB :: T
expressionMSB             = forall a. Enum a => Int -> a
toEnum Int
0x0B  {-  11 0B -}
effectControl1MSB :: T
effectControl1MSB         = forall a. Enum a => Int -> a
toEnum Int
0x0C  {-  10 0C -}
effectControl2MSB :: T
effectControl2MSB         = forall a. Enum a => Int -> a
toEnum Int
0x0D  {-  11 0D -}

generalPurpose1MSB :: T
generalPurpose1MSB        = forall a. Enum a => Int -> a
toEnum Int
0x10  {-  16 10 -}
generalPurpose2MSB :: T
generalPurpose2MSB        = forall a. Enum a => Int -> a
toEnum Int
0x11  {-  17 11 -}
generalPurpose3MSB :: T
generalPurpose3MSB        = forall a. Enum a => Int -> a
toEnum Int
0x12  {-  18 12 -}
generalPurpose4MSB :: T
generalPurpose4MSB        = forall a. Enum a => Int -> a
toEnum Int
0x13  {-  19 13 -}

bankSelectLSB :: T
bankSelectLSB             = forall a. Enum a => Int -> a
toEnum Int
0x20  {-  32 20 -}
modulationLSB :: T
modulationLSB             = forall a. Enum a => Int -> a
toEnum Int
0x21  {-  33 21 -}
breathControlLSB :: T
breathControlLSB          = forall a. Enum a => Int -> a
toEnum Int
0x22  {-  34 22 -}
footControlLSB :: T
footControlLSB            = forall a. Enum a => Int -> a
toEnum Int
0x24  {-  36 24 -}
portamentoTimeLSB :: T
portamentoTimeLSB         = forall a. Enum a => Int -> a
toEnum Int
0x25  {-  37 25 -}
dataEntryLSB :: T
dataEntryLSB              = forall a. Enum a => Int -> a
toEnum Int
0x26  {-  38 26 -}
volumeLSB :: T
volumeLSB                 = forall a. Enum a => Int -> a
toEnum Int
0x27  {-  39 27 -}
balanceLSB :: T
balanceLSB                = forall a. Enum a => Int -> a
toEnum Int
0x28  {-  40 28 -}
panoramaLSB :: T
panoramaLSB               = forall a. Enum a => Int -> a
toEnum Int
0x2A  {-  42 2A -}
expressionLSB :: T
expressionLSB             = forall a. Enum a => Int -> a
toEnum Int
0x2B  {-  43 2B -}
effectControl1LSB :: T
effectControl1LSB         = forall a. Enum a => Int -> a
toEnum Int
0x2C  {-  44 2C -}
effectControl2LSB :: T
effectControl2LSB         = forall a. Enum a => Int -> a
toEnum Int
0x2D  {-  45 2D -}

generalPurpose1LSB :: T
generalPurpose1LSB        = forall a. Enum a => Int -> a
toEnum Int
0x30  {-  48 30 -}
generalPurpose2LSB :: T
generalPurpose2LSB        = forall a. Enum a => Int -> a
toEnum Int
0x31  {-  49 31 -}
generalPurpose3LSB :: T
generalPurpose3LSB        = forall a. Enum a => Int -> a
toEnum Int
0x32  {-  50 32 -}
generalPurpose4LSB :: T
generalPurpose4LSB        = forall a. Enum a => Int -> a
toEnum Int
0x33  {-  51 33 -}

sustain :: T
sustain                   = forall a. Enum a => Int -> a
toEnum Int
0x40  {-  64 40 -}
portamento :: T
portamento                = forall a. Enum a => Int -> a
toEnum Int
0x41  {-  65 41 -}
sustenuto :: T
sustenuto                 = forall a. Enum a => Int -> a
toEnum Int
0x42  {-  66 42 -}
softPedal :: T
softPedal                 = forall a. Enum a => Int -> a
toEnum Int
0x43  {-  67 43 -}
legato :: T
legato                    = forall a. Enum a => Int -> a
toEnum Int
0x44  {-  68 44 -}
hold2 :: T
hold2                     = forall a. Enum a => Int -> a
toEnum Int
0x45  {-  69 45 -}
soundController1 :: T
soundController1          = forall a. Enum a => Int -> a
toEnum Int
0x46  {-  70 46 -}
soundController2 :: T
soundController2          = forall a. Enum a => Int -> a
toEnum Int
0x47  {-  71 47 -}
soundController3 :: T
soundController3          = forall a. Enum a => Int -> a
toEnum Int
0x48  {-  72 48 -}
soundController4 :: T
soundController4          = forall a. Enum a => Int -> a
toEnum Int
0x49  {-  73 49 -}
soundController5 :: T
soundController5          = forall a. Enum a => Int -> a
toEnum Int
0x4A  {-  74 4A -}
soundController6 :: T
soundController6          = forall a. Enum a => Int -> a
toEnum Int
0x4B  {-  75 4B -}
soundController7 :: T
soundController7          = forall a. Enum a => Int -> a
toEnum Int
0x4C  {-  76 4C -}
soundController8 :: T
soundController8          = forall a. Enum a => Int -> a
toEnum Int
0x4D  {-  77 4D -}
soundController9 :: T
soundController9          = forall a. Enum a => Int -> a
toEnum Int
0x4E  {-  78 4E -}
soundController10 :: T
soundController10         = forall a. Enum a => Int -> a
toEnum Int
0x4F  {-  79 4F -}

generalPurpose5 :: T
generalPurpose5           = forall a. Enum a => Int -> a
toEnum Int
0x50  {-  80 50 -}
generalPurpose6 :: T
generalPurpose6           = forall a. Enum a => Int -> a
toEnum Int
0x51  {-  81 51 -}
generalPurpose7 :: T
generalPurpose7           = forall a. Enum a => Int -> a
toEnum Int
0x52  {-  82 52 -}
generalPurpose8 :: T
generalPurpose8           = forall a. Enum a => Int -> a
toEnum Int
0x53  {-  83 53 -}
portamentoControl :: T
portamentoControl         = forall a. Enum a => Int -> a
toEnum Int
0x54  {-  84 54 -}
effect1Depth :: T
effect1Depth              = forall a. Enum a => Int -> a
toEnum Int
0x5B  {-  91 5B -}
effect2Depth :: T
effect2Depth              = forall a. Enum a => Int -> a
toEnum Int
0x5C  {-  92 5C -}
effect3Depth :: T
effect3Depth              = forall a. Enum a => Int -> a
toEnum Int
0x5D  {-  93 5D -}
effect4Depth :: T
effect4Depth              = forall a. Enum a => Int -> a
toEnum Int
0x5E  {-  94 5E -}
effect5Depth :: T
effect5Depth              = forall a. Enum a => Int -> a
toEnum Int
0x5F  {-  95 5F -}

dataIncrement :: T
dataIncrement             = forall a. Enum a => Int -> a
toEnum Int
0x60  {-  96 60 -}
dataDecrement :: T
dataDecrement             = forall a. Enum a => Int -> a
toEnum Int
0x61  {-  97 61 -}
nonRegisteredParameterLSB :: T
nonRegisteredParameterLSB = forall a. Enum a => Int -> a
toEnum Int
0x62  {-  98 62 -}
nonRegisteredParameterMSB :: T
nonRegisteredParameterMSB = forall a. Enum a => Int -> a
toEnum Int
0x63  {-  99 63 -}
registeredParameterLSB :: T
registeredParameterLSB    = forall a. Enum a => Int -> a
toEnum Int
0x64  {- 100 64 -}
registeredParameterMSB :: T
registeredParameterMSB    = forall a. Enum a => Int -> a
toEnum Int
0x65  {- 101 65 -}