alsa-seq-0.5.1: examples/dump.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
import Control.Monad (forever, )
main :: IO ()
main = (do
putStrLn "Starting."
SndSeq.with SndSeq.defaultName SndSeq.Block $ \h -> do
Client.setName (h :: SndSeq.T SndSeq.InputMode) "Haskell-Dump"
putStrLn "Created sequencer."
Port.withSimple h "primary"
(Port.caps [Port.capWrite, Port.capSubsWrite]) Port.typeMidiGeneric $ \ _p1 -> do
Port.withSimple h "secondary"
(Port.caps [Port.capWrite, Port.capSubsWrite]) Port.typeMidiGeneric $ \ _p2 -> do
putStrLn "Created ports."
forever $ do
putStrLn "waiting for an event:"
print =<< Event.input h)
`AlsaExc.catch` \e ->
putStrLn $ "alsa_exception: " ++ AlsaExc.show e