packages feed

alsa-seq-0.5: examples/test1.hs

import qualified Sound.ALSA.Sequencer.Client as Client
import qualified Sound.ALSA.Sequencer.Port as Port
import qualified Sound.ALSA.Sequencer.Event as Event
import qualified Sound.ALSA.Sequencer as SndSeq
import qualified Sound.ALSA.Exception as AlsaExc

main :: IO ()
main = (do
  putStrLn "Starting."
  SndSeq.with SndSeq.defaultName SndSeq.Block $ \h -> do
  Client.setName (h :: SndSeq.T SndSeq.InputMode) "HS1"
  putStrLn "Created sequencer."
  Port.withSimple h "one"
     (Port.caps [Port.capWrite, Port.capSubsWrite]) Port.typeMidiGeneric $ \ _p1 -> do
  Port.withSimple h "two"
     (Port.caps [Port.capWrite, Port.capSubsWrite]) Port.typeMidiGeneric $ \ _p2 -> do
  putStrLn "Created ports."
  let loop = do putStrLn "waiting for an event:"
                e <- Event.input h
                print e
                loop
  loop)
  `AlsaExc.catch` \e ->
     putStrLn $ "alsa_exception: " ++ AlsaExc.show e