Skip to content

Commit

Permalink
Added variant of evalSupply taking Int as random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
8c6794b6 committed May 23, 2014
1 parent f1f0920 commit c22b143
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hsc3-supply/src/lib/Sound/SC3/Supply.hs
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ module Sound.SC3.Supply
, runSupply
, runSupplyIO
, evalSupply
, supply

-- * Lifting functions
, liftS2
@@ -231,6 +232,10 @@ runSupplyIO = getStdRandom . runSupply
evalSupply :: Supply -> StdGen -> UGen
evalSupply d g = evalState (unDemand d) g

-- | Evaluate demand ugen with given seed.
supply :: Int -> Supply -> UGen
supply i s = evalState (unDemand s) (mkStdGen i)

liftS2 :: (Int -> a -> b -> c)
-> Demand a -> Demand b -> Demand c
liftS2 f a b = f <$> seed <*> a <*> b

0 comments on commit c22b143

Please sign in to comment.