hsc3-lang-0.13: Haskell SuperCollider Language

Safe HaskellNone



For a single input controller, key events always arrive in sequence (ie. on->off), ie. for any key on message can allocate an ID and associate it with the key, an off message can retrieve the ID given the key.



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

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)]

parse_b :: Integral n => Message -> [n]Source

Parse midi-osc midi message.

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.

type Node_Id = IntSource

SC3 node identifiers are integers.

data K a Source

Map of allocated Node_Ids.


K (Map (a, a) Node_Id) Node_Id 

type KT = StateT (K Int) IOSource

StateT of K specialised to Int.

k_init :: Node_Id -> K aSource

Initialise K with starting Node_Id.

k_alloc :: (Int, Int) -> KT Node_IdSource

K Node_Id allocator.

k_get :: (Int, Int) -> KT Node_IdSource

K Node_Id retrieval.

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 AsyncExceptions.