import qualified Sound.Alsa.Sequencer as ALSA import Sound.Alsa.Sequencer ( caps, cap_write, cap_subs_write, type_midi_generic, set_client_name, event_input, alsa_catch, exception_description, ) main :: IO () main = (do putStrLn "Starting." ALSA.with ALSA.default_seq_name ALSA.Block $ \h -> do ALSA.set_client_name (h :: ALSA.SndSeq ALSA.InputMode) "HS1" putStrLn "Created sequencer." ALSA.with_simple_port h "one" (caps [cap_write,cap_subs_write]) type_midi_generic $ \ _p1 -> do ALSA.with_simple_port h "two" (caps [cap_write,cap_subs_write]) type_midi_generic $ \ _p2 -> do putStrLn "Created ports." let loop = do putStrLn "waiting for an event:" e <- event_input h print e loop loop) `alsa_catch` \e -> putStrLn ("Problem: " ++ exception_description e)