Skip to content

Commit

Permalink
make line length of drawLine configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Apr 16, 2020
1 parent 8cd6ceb commit e98252d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Sound/Tidal/Show.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,15 @@ stepcount pat = fromIntegral $ eventSteps $ concatMap (\ev -> [start ev, stop ev
data Render = Render Int Int String

instance Show Render where
show (Render cyc i render) | i <= 1024 = "\nDrawing " ++ show cyc ++ " cycles:\n" ++ render
| otherwise = show i ++ " too long to render.."
show (Render cyc i render) | i <= 1024 = "\n[" ++ show cyc ++ (if cyc == 1 then " cycle" else " cycles") ++ "]\n" ++ render
| otherwise = "That pattern is too complex to draw."


drawLine :: Pattern Char -> Render
drawLine pat = joinCycles 78 $ drawCycles pat
drawLine = drawLineSz 78

drawLineSz :: Int -> Pattern Char -> Render
drawLineSz sz pat = joinCycles sz $ drawCycles pat
where
drawCycles :: Pattern Char -> [Render]
drawCycles pat' = (draw pat'):(drawCycles $ rotL 1 pat')
Expand Down

0 comments on commit e98252d

Please sign in to comment.