hunk ./Help/sin-osc.hs 12 - C.run_ctl [ (0, C.ctl { C.name = "| ofreq |" }) - , (1, C.ctl { C.name = "| oampl |" }) - , (2, C.ctl { C.name = "| osloc |" }) ] + C.run_ctl [(0,C.ctl {C.name = "| ofreq |"}) + ,(1,C.ctl {C.name = "| oampl |"}) + ,(2,C.ctl {C.name = "| osloc |"})] hunk ./Sound/SC3/Ctl/CtlT.hs 1 -module Sound.SC3.Ctl.CtlT (Ctl(..), ctl, run_ctl) where +module Sound.SC3.Ctl.CtlT (Ctl(..),ctl,run_ctl) where hunk ./Sound/SC3/Ctl/CtlT.hs 3 -import Control.Monad +import qualified Data.ByteString.Lazy as B hunk ./Sound/SC3/Ctl/CtlT.hs 9 -data Ctl = Ctl { name :: String - , value :: Int } +data Ctl = Ctl {name :: String + ,value :: Int} hunk ./Sound/SC3/Ctl/CtlT.hs 13 -ctl = Ctl { name = "|------|" - , value = 0 } +ctl = Ctl {name = "|------|" + ,value = 0} hunk ./Sound/SC3/Ctl/CtlT.hs 19 -extract :: OSC -> Maybe (Int, Int) -extract (Message "/midi" [Int _, Blob [0xb0, c, x]]) = - Just (fromIntegral c, fromIntegral x) -extract _ = Nothing +extract :: OSC -> Maybe (Int,Int) +extract m = + case m of + Message "/midi" [Int _,Blob d] -> + case B.unpack d of + [0xb0,c,x] -> Just (fromIntegral c,fromIntegral x) + _ -> Nothing + _ -> Nothing hunk ./Sound/SC3/Ctl/CtlT.hs 28 -set_ctl :: Transport t => t -> (Int, Int) -> IO () -set_ctl fd (i, x) = +set_ctl :: Transport t => t -> (Int,Int) -> IO () +set_ctl fd (i,x) = hunk ./Sound/SC3/Ctl/CtlT.hs 41 - C.leaveOk True + _ <- C.leaveOk True hunk ./Sound/SC3/Ctl/CtlT.hs 45 -pad d n xs | m == n = xs - | m > n = take n xs - | otherwise = let s = replicate (n - m) ' ' - in if d then xs ++ s else s ++ xs - where m = length xs +pad d n xs = + let m = length xs + in case compare m n of + EQ -> xs + GT -> take n xs + LT -> let s = replicate (n - m) ' ' + in if d then xs ++ s else s ++ xs hunk ./Sound/SC3/Ctl/CtlT.hs 56 -c_draw :: C.Window -> M.IntMap Ctl -> (Int, Int) -> IO () -c_draw w m (i, x) = do +c_draw :: C.Window -> M.IntMap Ctl -> (Int,Int) -> IO () +c_draw w m (i,x) = do hunk ./Sound/SC3/Ctl/CtlT.hs 68 - + hunk ./Sound/SC3/Ctl/CtlT.hs 74 -run_ctl :: [(Int, Ctl)] -> IO () +run_ctl :: [(Int,Ctl)] -> IO () hunk ./Sound/SC3/Ctl/CtlT.hs 81 - send s (c_getn [(0, 96)]) + send s (c_getn [(0,96)]) hunk ./tctl.cabal 2 -Version: 0.9 +Version: 0.10 hunk ./tctl.cabal 22 + bytestring, hunk ./tctl.cabal 24 - hosc == 0.9, - hsc3 == 0.9, + hosc == 0.10, + hsc3 == 0.10, hunk ./Sound/SC3/Ctl/CtlT.hs 3 -import qualified Data.ByteString.Lazy as B -import qualified Data.IntMap as M -import Sound.OpenSoundControl -import Sound.SC3 -import qualified UI.HSCurses.Curses as C +import qualified Data.ByteString.Lazy as B {- bytestring -} +import qualified Data.IntMap as M {- containers -} +import Sound.OpenSoundControl {- hosc -} +import Sound.SC3 {- hsc3 -} +import qualified UI.HSCurses.Curses as C {- hscurses -}