Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

foo

  • Loading branch information...
commit df580f08ac0c6debb6b24c91db7ea631e92d8cb3 1 parent 13b8d19
@yaxu authored
Showing with 16 additions and 16 deletions.
  1. +2 −2 Dirt.hs
  2. +7 −12 Parse.hs
  3. +5 −0 Stream.hs
  4. +2 −2 test.smooth
View
4 Dirt.hs
@@ -24,9 +24,9 @@ steps = 16
channels = 4
x = Map.insert (params dirt !! 0) (Just $ String "chin/0") $ defaultMap dirt
x' pan = Map.insert (params dirt !! 4) (Just $ Float pan) $ x
-c = Cycle $ map (\i -> (Arc (Atom $ x' (channels * (fromIntegral i / fromIntegral steps))) (fromIntegral i / fromIntegral steps) Nothing)) [0 .. (steps - 1)]
+c = Cycle $ map (\i -> (Arc (Atom $ x' (channels * (fromIntegral i / fromIntegral steps))) (fromIntegral i / fromIntegral steps) 0)) [0 .. (steps - 1)]
-startdirt = start "127.0.0.1" "127.0.0.1" "deardirt" "127.0.0.1" 7771 dirt
+dirtstream name = stream "127.0.0.1" "127.0.0.1" name "127.0.0.1" 7771 dirt
sample = makeS dirt "sample"
offset = makeF dirt "offset"
View
19 Parse.hs
@@ -42,6 +42,7 @@ lexer = P.makeTokenParser haskellDef
braces = P.braces lexer
brackets = P.brackets lexer
parens = P.parens lexer
+angles = P.angles lexer
symbol = P.symbol lexer
natural = P.natural lexer
float = P.float lexer
@@ -75,10 +76,6 @@ r s orig = do catch (return $ p s)
return orig
)
---playRhythm :: (Monad m, Show a) => Parser (Pattern a) -> String -> m [Char]
---playRhythm f s = do let parsed = parseRhythm f s
--- return $ either (\e -> "Error" ++ show e) show parsed
-
parseRhythm :: Parser (Pattern a) -> String -> (Pattern a)
parseRhythm f input = either (const silence) id $ parse (pRhythm f') "" input
where f' = f
@@ -122,16 +119,14 @@ pBool = do oneOf "t1"
do oneOf "f0"
return $ Atom False
--- pColour :: Parser (Pattern ColourD)
--- pColour = do name <- many1 letter <?> "colour name"
--- colour <- readColourName name <?> "known colour"
--- return $ Atom colour
-
pInt :: Parser (Pattern Int)
pInt = do i <- natural <?> "integer"
return $ Atom (fromIntegral i)
--- doubleToGray :: Double -> ColourD
--- doubleToGray n = let shade = n in
--- sRGB shade shade shade
+pRepetition :: Parser (Double)
+pRepetition = do nf <- angles (intOrFloat <?> "float")
+ let f = either fromIntegral id nf
+ return $ f
+ <|>
+ do return 0
View
5 Stream.hs
@@ -94,6 +94,11 @@ start client server name address port shape
forkIO $ clocked name client server 1 ot
return patternM
+stream :: String -> String -> String -> String -> Int -> OscShape -> IO (OscPattern -> IO ())
+stream client server name address port shape
+ = do patternM <- start client server name address port shape
+ return $ \p -> do swapMVar patternM p
+ return ()
onTick :: UDP -> OscShape -> MVar (OscPattern) -> BpsChange -> Int -> IO ()
onTick s shape patternM change ticks
View
4 test.smooth
@@ -1,5 +1,5 @@
d <- dirtstream "dirt0"
-d $ sample (every 1 (0.1 <~) "[drum/0 ~ sn/1 ~ ~, ~ sn/1 sn/2 ~ sn/4 sn/3]")
+d $ sample (every 1 (0.1 <~) "<4> [drum/0 ~ sn/1 ~ ~, ~ sn/1 sn/2 ~ sn/4 sn/3]")
~~ pan "1"
-d silence
+d silence
Please sign in to comment.
Something went wrong with that request. Please try again.