From b30f711c67228e20a5da57deb69176c88c6e2a20 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 31 Jan 2020 11:20:10 +0000 Subject: [PATCH] compat with latest tidal --- src/Common.hs | 12 ++++++------ src/CycleAnimation.hs | 2 +- src/Vis.hs | 6 +++--- src/VisCycle.hs | 2 +- src/VisGradient.hs | 2 +- src/VisPart.hs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Common.hs b/src/Common.hs index a2f31e8..08c7abb 100644 --- a/src/Common.hs +++ b/src/Common.hs @@ -50,7 +50,7 @@ levelsWhole pat = arrangeEventsWhole $ sortOn' ((\Arc{..} -> 0 - (stop - start)) -- levelsWhole pat = arrangeEventsWhole $ defragParts $ queryArc pat (Arc 0 1) fits :: Event b -> [Event b] -> Bool -fits (Event _ part' _) events = not $ any (\Event{..} -> isJust $ subArc part' part) events +fits (Event _ _ part' _) events = not $ any (\Event{..} -> isJust $ subArc part' part) events addEvent :: Event b -> [[Event b]] -> [[Event b]] addEvent e [] = [[e]] @@ -82,7 +82,7 @@ stringToColour str = sRGB (r/256) (g/256) (b/256) segmentator :: Pattern ColourD -> Pattern [ColourD] segmentator p@Pattern{..} = Pattern $ \(State arc@Arc{..} _) - -> filter (\(Event _ (Arc start' stop') _) -> start' < stop && stop' > start) + -> filter (\(Event _ _ (Arc start' stop') _) -> start' < stop && stop' > start) $ groupByTime (segment' (defragParts $ queryArc p arc)) segment' :: [Event a] -> [Event a] @@ -91,20 +91,20 @@ segment' es = foldr split es pts split :: Time -> [Event a] -> [Event a] split _ [] = [] -split t (ev@(Event whole Arc{..} value):es) +split t (ev@(Event c whole Arc{..} value):es) | t > start && t < stop = - Event whole (Arc start t) value : Event whole (Arc t stop) value : split t es + Event c whole (Arc start t) value : Event c whole (Arc t stop) value : split t es | otherwise = ev:split t es points :: [Event a] -> [Time] points [] = [] -points (Event _ Arc{..} _ : es) = start : stop : points es +points (Event _ _ Arc{..} _ : es) = start : stop : points es groupByTime :: [Event a] -> [Event [a]] groupByTime es = map merge $ groupBy ((==) `on` part) $ sortOn (stop . part) es where merge :: [EventF a b] -> EventF a [b] - merge evs@(Event{whole, part} : _) = Event whole part $ map (\Event{value} -> value) evs + merge evs@(Event{context, whole, part} : _) = Event context whole part $ map (\Event{value} -> value) evs merge _ = error "groupByTime" beatNow :: Tempo.Tempo -> IO Double diff --git a/src/CycleAnimation.hs b/src/CycleAnimation.hs index 91b1fc3..de2faf6 100644 --- a/src/CycleAnimation.hs +++ b/src/CycleAnimation.hs @@ -196,7 +196,7 @@ drawPatR (x1,x2) p screen beat = mapM_ drawEvents $ event (pos beat) p (width * fromRational (b - pos beat)) (width * fromRational (e - b)) 1 event :: Rational -> Pat.Pattern ColourD -> [((Rational, Rational), [ColourD])] -event position pat = map (\(Pat.Event _ Arc{..} events) -> +event position pat = map (\(Pat.Event _ _ Arc{..} events) -> ((max start position, min stop (position + 1)), events)) $ queryArc (segmentator pat) (Arc position (position + 1)) diff --git a/src/Vis.hs b/src/Vis.hs index a24eb1c..3e1d162 100644 --- a/src/Vis.hs +++ b/src/Vis.hs @@ -82,7 +82,7 @@ v sf fn (x,y) pat = -- | Convert time and color to rendered type. renderEvent :: Event [ColourD] -> C.Render () -renderEvent (Event _ Arc{..} value) = do +renderEvent (Event _ _ Arc{..} value) = do C.save drawBlocks value 0 C.restore @@ -104,8 +104,8 @@ renderEvent (Event _ Arc{..} value) = do events :: Pattern ColourD -> [Event [ColourD]] events pat = map - ( \(Event whole Arc{..} value) - -> Event whole (Arc ((start - tick) / speed') ((stop - tick) / speed')) value + ( \(Event context whole Arc{..} value) + -> Event context whole (Arc ((start - tick) / speed') ((stop - tick) / speed')) value ) $ queryArc (segmentator pat) (Arc tick (tick + speed')) where diff --git a/src/VisCycle.hs b/src/VisCycle.hs index 22f3f78..a91c3df 100644 --- a/src/VisCycle.hs +++ b/src/VisCycle.hs @@ -52,7 +52,7 @@ renderLevel total (num, level) = do C.restore where drawEvent :: Event ColourD -> C.Render () - drawEvent (Event _ Arc{..} c) = do + drawEvent (Event _ _ Arc{..} c) = do let (RGB r g b) = toSRGB c let levelHeight = (1 / fi (total+1))/2 let h = levelHeight * fi (num + 1) diff --git a/src/VisGradient.hs b/src/VisGradient.hs index b5c222f..fe45e93 100644 --- a/src/VisGradient.hs +++ b/src/VisGradient.hs @@ -48,7 +48,7 @@ renderLevel _ (num, level) = do mapM_ drawEvent $ level C.restore where - drawEvent e@(Event _ Arc{..} c) = do + drawEvent e@(Event _ _ Arc{..} c) = do let (Arc sWhole eWhole) = wholeOrPart e let (RGB r g b) = toSRGB c let x = (fromRational start) * totalWidth diff --git a/src/VisPart.hs b/src/VisPart.hs index 87753b2..f92d90f 100644 --- a/src/VisPart.hs +++ b/src/VisPart.hs @@ -59,7 +59,7 @@ renderLevel _ (num, level) = do mapM_ drawEvent $ level C.restore where - drawEvent e@(Event _ (Arc sPart ePart) v) = do + drawEvent e@(Event _ _ (Arc sPart ePart) v) = do let (Arc sWhole eWhole) = wholeOrPart e let (r, g, b) = (0,0,0) let px = (fromRational sPart) * totalWidth