Safe Haskell | None |
---|
For a single input controller, key events always arrive in sequence (ie. on->off), ie. for any key on message we can allocate an ID and associate it with the key, an off message can retrieve the ID given the key.
- b_join :: Bits a => a -> a -> a
- b_sep :: (Num t, Bits t) => t -> (t, t)
- data Midi_Message a
- = Chanel_Aftertouch a a
- | Control_Change a a a
- | Note_On a a a
- | Note_Off a a a
- | Polyphic_Key_Pressure a a a
- | Program_Change a a
- | Pitch_Bend a a
- | Unknown [a]
- data Control_Message a
- = All_Notes_Off a
- | All_Sound_Off a
- | Balance a a
- | Bank_Select a a
- | Breath_Controller a a
- | Expression_Controller a a
- | Foot_Controller a a
- | Local_Control a a
- | Modulation_Wheel a a
- | Mono_Mode_On a a
- | Omni_Mode_Off a
- | Omni_Mode_On a
- | Pan a a
- | Poly_Mode_On a
- | Portamento_On_Off a a
- | Portamento_Time a a
- | Reset_All_Controllers a a
- | Soft_Pedal_On_Off a a
- | Sostenuto_On_Off a a
- | Sustain_On_Off a a
- | Undefined
- control_message :: (Eq a, Num a) => (a, a, a) -> Control_Message a
- parse_b :: Integral n => Message -> [n]
- parse_c :: Integral n => Message -> [n]
- parse_m :: (Bits n, Integral n) => Message -> Midi_Message n
- type Node_Id = Int
- data K a = K (Map (a, a) Node_Id) Node_Id
- type KT = StateT (K Int) IO
- k_init :: Node_Id -> K a
- k_alloc :: (Int, Int) -> KT Node_Id
- k_get :: (Int, Int) -> KT Node_Id
- type Midi_Receiver m n = Midi_Message n -> Int -> m ()
- midi_act :: Midi_Receiver IO Int -> Message -> StateT (K Int) IO ()
- start_midi :: (UDP -> Midi_Receiver IO Int) -> IO ()
Bits
b_join :: Bits a => a -> a -> aSource
Join two 7-bit values into a 14-bit value.
map (uncurry b_join) [(0,0),(0,64),(127,127)] == [0,8192,16383]
b_sep :: (Num t, Bits t) => t -> (t, t)Source
Inverse of b_join
.
map b_sep [0,8192,16383] == [(0,0),(0,64),(127,127)]
Types
data Midi_Message a Source
Chanel_Aftertouch a a | |
Control_Change a a a | |
Note_On a a a | |
Note_Off a a a | |
Polyphic_Key_Pressure a a a | |
Program_Change a a | |
Pitch_Bend a a | |
Unknown [a] |
Eq a => Eq (Midi_Message a) | |
Show a => Show (Midi_Message a) |
data Control_Message a Source
Control_Change
midi messages have, in some cases, commonly
defined meanings.
All_Notes_Off a | |
All_Sound_Off a | |
Balance a a | |
Bank_Select a a | |
Breath_Controller a a | |
Expression_Controller a a | |
Foot_Controller a a | |
Local_Control a a | |
Modulation_Wheel a a | |
Mono_Mode_On a a | |
Omni_Mode_Off a | |
Omni_Mode_On a | |
Pan a a | |
Poly_Mode_On a | |
Portamento_On_Off a a | |
Portamento_Time a a | |
Reset_All_Controllers a a | |
Soft_Pedal_On_Off a a | |
Sostenuto_On_Off a a | |
Sustain_On_Off a a | |
Undefined |
Eq a => Eq (Control_Message a) | |
Show a => Show (Control_Message a) |
control_message :: (Eq a, Num a) => (a, a, a) -> Control_Message aSource
Control_Change
midi messages may, in some cases, have commonly
defined meanings.
control_message (0,123,0) == All_Notes_Off 0
OSC
parse_c :: Integral n => Message -> [n]Source
Variant of parse_b
that give status byte as low and high.
parse_m :: (Bits n, Integral n) => Message -> Midi_Message nSource
Variant of parse_c
that constructs a Midi_Message
.
SC3
IO
type Midi_Receiver m n = Midi_Message n -> Int -> m ()Source
The Midi_Receiver
is passed a Midi_Message
and a Node_Id
.
For Note_On
and Note_Off
messages the Node_Id
is positive,
for all other message it is -1
.
midi_act :: Midi_Receiver IO Int -> Message -> StateT (K Int) IO ()Source
Parse incoming midi messages, do K
allocation, and run
Midi_Receiver
.
start_midi :: (UDP -> Midi_Receiver IO Int) -> IO ()Source
Run midi system, handles AsyncException
s.