From 323dfb7f576299e4084c62476a4d5b7e85bc1760 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 11 Apr 2024 09:32:26 +0100 Subject: [PATCH] fix warns --- src/Sound/Tidal/Stream/Process.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Sound/Tidal/Stream/Process.hs b/src/Sound/Tidal/Stream/Process.hs index 150651a3..6d02e8a9 100644 --- a/src/Sound/Tidal/Stream/Process.hs +++ b/src/Sound/Tidal/Stream/Process.hs @@ -177,7 +177,7 @@ toOSC busses pe osc@(OSC _ _) -- (but perhaps we should explicitly crash with an error message if it contains something else?). -- Map.mapKeys tail is used to remove ^ from the keys. -- In case (value e) has the key "", we will get a crash here. - playmap' = Map.union (Map.mapKeys tail $ Map.map (\(VI i) -> VS ('c':(show $ toBus i))) busmap) playmap + playmap' = Map.union (Map.mapKeys tail $ Map.map (\v -> VS ('c':(show $ toBus $ fromMaybe 0 $ getI v))) busmap) playmap val = value . peEvent -- Only events that start within the current nowArc are included playmsg | peHasOnset pe = do @@ -198,11 +198,13 @@ toOSC busses pe osc@(OSC _ _) toBus n | null busses = n | otherwise = busses !!! n busmsgs = map - (\(('^':k), (VI b)) -> do v <- Map.lookup k playmap - return $ (tsPart, - True, -- bus message ? - O.Message "/c_set" [O.int32 b, toDatum v] - ) + (\(k, b) -> do k' <- if (not $ null k) && head k == '^' then Just (tail k) else Nothing + v <- Map.lookup k' playmap + bi <- getI b + return $ (tsPart, + True, -- bus message ? + O.Message "/c_set" [O.int32 bi, toDatum v] + ) ) (Map.toList busmap) where