-- | This example is a MIDI host (unlike the other, which are MIDI clients). -- This only works on OSX. module Main where -------------------------------------------------------------------------------- import Control.Monad import System.MIDI import System.MIDI.Utility -------------------------------------------------------------------------------- myCallback :: Connection -> ClientCallback myCallback outconn event@(MidiEvent tstamp msg) = do print event case msg of MidiMessage chn short -> do putStrLn "forwarding message" send outconn msg _ -> return () -------------------------------------------------------------------------------- main :: IO () main = do outconn <- createSource "hmidi host out" inconn <- createDestination "hmidi host in" (Just (myCallback outconn)) start outconn start inconn putStrLn "started. Press 'ENTER' to exit." getLine stop inconn stop outconn putStrLn "stopped." close inconn close outconn putStrLn "closed." disposeConnection inconn disposeConnection outconn --------------------------------------------------------------------------------