diff options
author | Andrew Cady <d@jerkface.net> | 2014-01-14 05:12:16 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2014-01-14 05:12:16 -0500 |
commit | b3a24f6cb37c0e59aaadb1ce699ecdd56c2cf40e (patch) | |
tree | 089a4a8e41c515146beccb336cacb6ac7617109f /midi-dump.hs | |
parent | d95475d8c16d1baf066492e36ed6ebe8866bba31 (diff) |
backup
Diffstat (limited to 'midi-dump.hs')
-rw-r--r-- | midi-dump.hs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/midi-dump.hs b/midi-dump.hs index 3652162..38641cd 100644 --- a/midi-dump.hs +++ b/midi-dump.hs | |||
@@ -14,6 +14,7 @@ import Text.Printf (printf, ) | |||
14 | import Control.Monad (liftM5, liftM2, join, when, filterM, forM_) | 14 | import Control.Monad (liftM5, liftM2, join, when, filterM, forM_) |
15 | 15 | ||
16 | import Sound.ALSA.Sequencer.Connect as AlsaConn | 16 | import Sound.ALSA.Sequencer.Connect as AlsaConn |
17 | import qualified Sound.ALSA.Sequencer.Address as Addr | ||
17 | 18 | ||
18 | 19 | ||
19 | listPorts :: IO () | 20 | listPorts :: IO () |
@@ -46,8 +47,10 @@ findPort wantName f = do | |||
46 | when (name == wantName) $ do | 47 | when (name == wantName) $ do |
47 | client <- ClientInfo.getClient cinfo | 48 | client <- ClientInfo.getClient cinfo |
48 | PortInfo.queryLoop_ h client $ \pinfo -> do | 49 | PortInfo.queryLoop_ h client $ \pinfo -> do |
49 | port <- (fmap (\(Client.Cons p) -> p) $ PortInfo.getClient pinfo) | 50 | cport <- PortInfo.getClient pinfo |
50 | f port | 51 | f $ show cport |
52 | -- port <- (fmap (\(Client.Cons p) -> p) $ PortInfo.getClient pinfo) | ||
53 | -- f port | ||
51 | 54 | ||
52 | main :: IO () | 55 | main :: IO () |
53 | main = (do | 56 | main = (do |
@@ -63,11 +66,9 @@ main = (do | |||
63 | (Port.caps [Port.capWrite, Port.capSubsWrite]) Port.typeMidiGeneric $ \ _p2 -> do | 66 | (Port.caps [Port.capWrite, Port.capSubsWrite]) Port.typeMidiGeneric $ \ _p2 -> do |
64 | putStrLn "Created ports." | 67 | putStrLn "Created ports." |
65 | 68 | ||
66 | clientPointer <- ClientInfo.get h | 69 | clientID <- Client.getId h |
67 | clientID_Cons <- ClientInfo.getClient clientPointer | ||
68 | clientID <- (\(Client.Cons p) -> return p) clientID_Cons | ||
69 | 70 | ||
70 | findPort "AXIS-49 2A" (connectAxis clientID) | 71 | findPort "AXIS-49 2A" (connectAxis h clientID _p1) |
71 | 72 | ||
72 | when False $ do | 73 | when False $ do |
73 | forever $ do | 74 | forever $ do |
@@ -76,5 +77,9 @@ main = (do | |||
76 | `AlsaExc.catch` \e -> | 77 | `AlsaExc.catch` \e -> |
77 | putStrLn $ "alsa_exception: " ++ AlsaExc.show e | 78 | putStrLn $ "alsa_exception: " ++ AlsaExc.show e |
78 | 79 | ||
79 | connectAxis myID axisID = do | 80 | connectAxis h myID myPort axisID = do |
80 | printf "Found my ID: %d.\nFound Axis ID: %d.\n" myID axisID | 81 | myID_int <- (\(Client.Cons p) -> return p) myID |
82 | printf "Found my ID: %d.\nFound Axis ID: %s.\n" myID_int axisID | ||
83 | AlsaConn.createFrom h myPort =<< Addr.parse h (axisID ++ ":0") | ||
84 | return () | ||
85 | |||