Skip to content

Commit

Permalink
fix warns
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Apr 10, 2024
1 parent ade3be3 commit 08518ba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Sound/Tidal/Pattern.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import qualified Data.Map.Strict as Map
import Data.Maybe (catMaybes, fromJust, isJust, mapMaybe)
import Data.Typeable (Typeable)
import Data.Word (Word8)
import GHC.Generics
import GHC.Generics (Generic)

import Sound.Tidal.Time

Expand Down Expand Up @@ -267,13 +267,13 @@ _trigJoin cycleZero pat_of_pats = pattern q
where q st =
catMaybes $
concatMap
(\(Event oc (Just jow) op ov) ->
(\(Event oc jow op ov) ->
map (\(Event ic (iw) ip iv) ->
do w <- subMaybeArc (Just jow) iw
do w <- subMaybeArc jow iw
p <- subArc op ip
return $ Event (combineContexts [ic, oc]) w p iv
)
$ query (((if cycleZero then id else cyclePos) $ start jow) `rotR` ov) st
$ query (((if cycleZero then id else cyclePos) $ start (fromJust jow)) `rotR` ov) st
)
(query (filterDigital pat_of_pats) st)

Expand Down
14 changes: 8 additions & 6 deletions src/Sound/Tidal/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,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
Expand All @@ -382,11 +382,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
Expand Down
5 changes: 3 additions & 2 deletions src/Sound/Tidal/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ randArcs n =

-- TODO - what does this do? Something for @stripe@ ..
randStruct :: Int -> Pattern Int
randStruct n = splitQueries $ Pattern {query = f}
randStruct n = splitQueries $ Pattern f Nothing Nothing
where f st = map (\(a,b,c) -> Event (Context []) (Just a) (fromJust b) c) $ filter (\(_,x,_) -> isJust x) as
where as = map (\(i, Arc s' e') ->
(Arc (s' + sam s) (e' + sam s),
Expand Down Expand Up @@ -1862,7 +1862,8 @@ ur t outer_p ps fs = _slow t $ unwrap $ adjust <$> timedValues (getPat . split <
transform _ _ = id
transform' str (Arc s e) p = s `rotR` inside (pure $ 1/(e-s)) (matchF str) p
matchF str = fromMaybe id $ lookup str fs
timedValues = withEvent (\(Event c (Just a) a' v) -> Event c (Just a) a' (a,v)) . filterDigital
timedValues = filterJust . withEvent (\(Event c ma a' v) -> Event c ma a' (ma >>= \a -> Just (a,v))
) . filterDigital

{- | A simpler version of 'ur' that just provides name-value bindings that are
reflected in the provided pattern.
Expand Down

0 comments on commit 08518ba

Please sign in to comment.