{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE NoIncoherentInstances #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE NoUndecidableInstances #-}
module Vivid.UGens.Demand (
inf
, dbrown
, demand
, dibrown
, diwhite
, drand
, dseq
, dser
, dshuf
, dwhite
, dxrand
) where
import Vivid.SC.SynthDef.Types (CalculationRate(..))
import Vivid.UGens.Args
import Vivid.SynthDef
import Vivid.SynthDef.FromUA
import qualified Data.ByteString.UTF8 as UTF8
import Data.Proxy
inf :: Float
inf :: Float
inf = Float
1Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/Float
0
dbrown :: Args '[] '["lo","hi","step","length"] a => a -> SDBody a Signal
dbrown :: a -> SDBody a Signal
dbrown = String
-> Args '[] '["lo", "hi", "step", "length"] a =>
a -> SDBody a Signal
forall a.
String
-> Args '[] '["lo", "hi", "step", "length"] a =>
a -> SDBody a Signal
demandBrownian String
"Dbrown"
demand :: Args '["trigger","reset","ugen"] '[] a => a -> SDBody a Signal
demand :: a -> SDBody a Signal
demand = String
-> CalculationRate
-> Vs '["trigger", "reset", "ugen"]
-> NoDefaults (SDBodyArgs a)
-> a
-> SDBody a Signal
forall (tags :: [Symbol]) optional userSupplied (args :: [Symbol]).
(GetSymbolVals (Vs tags), FromUA optional, FromUA userSupplied,
SDBodyArgs optional ~ SDBodyArgs userSupplied,
SDBodyArgs optional ~ args) =>
String
-> CalculationRate
-> Vs tags
-> optional
-> userSupplied
-> SDBody' args Signal
makeUGen
String
"Demand" CalculationRate
KR
(Vs '["trigger", "reset", "ugen"]
forall (a :: [Symbol]). Vs a
Vs::Vs '["trigger","reset","ugen"])
NoDefaults (SDBodyArgs a)
forall (args :: [Symbol]). NoDefaults args
NoDefaults
dibrown :: Args '[] '["lo","hi","step","length"] a => a -> SDBody a Signal
dibrown :: a -> SDBody a Signal
dibrown = String
-> Args '[] '["lo", "hi", "step", "length"] a =>
a -> SDBody a Signal
forall a.
String
-> Args '[] '["lo", "hi", "step", "length"] a =>
a -> SDBody a Signal
demandBrownian String
"Dibrown"
demandBrownian :: String -> (Args '[] '["lo","hi","step","length"] a => a -> SDBody a Signal)
demandBrownian :: String
-> Args '[] '["lo", "hi", "step", "length"] a =>
a -> SDBody a Signal
demandBrownian String
ugName = String
-> CalculationRate
-> Vs '["length", "lo", "hi", "step"]
-> (UA "lo" (SDBodyArgs a), UA "hi" (SDBodyArgs a),
UA "step" (SDBodyArgs a), UA "length" (SDBodyArgs a))
-> a
-> SDBody a Signal
forall (tags :: [Symbol]) optional userSupplied (args :: [Symbol]).
(GetSymbolVals (Vs tags), FromUA optional, FromUA userSupplied,
SDBodyArgs optional ~ SDBodyArgs userSupplied,
SDBodyArgs optional ~ args) =>
String
-> CalculationRate
-> Vs tags
-> optional
-> userSupplied
-> SDBody' args Signal
makeUGen
String
ugName CalculationRate
DR
(Vs '["length", "lo", "hi", "step"]
forall (a :: [Symbol]). Vs a
Vs::Vs '["length","lo","hi","step"])
(Float -> UA "lo" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "lo" as
lo_ (Float
0::Float), Float -> UA "hi" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "hi" as
hi_ (Float
1::Float), Float -> UA "step" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "step" as
step_ (Float
0.01::Float), Float -> UA "length" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "length" as
length_ Float
inf)
diwhite :: Args '[] '["lo","hi","length"] a => a -> SDBody a Signal
diwhite :: a -> SDBody a Signal
diwhite = String
-> Args '[] '["lo", "hi", "length"] a => a -> SDBody a Signal
forall a.
String
-> Args '[] '["lo", "hi", "length"] a => a -> SDBody a Signal
demandWhite String
"Diwhite"
drand :: (Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) => a -> [s] -> SDBody a Signal
drand :: a -> [s] -> SDBody a Signal
drand = String -> a -> [s] -> SDBody a Signal
forall a s.
(Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) =>
String -> a -> [s] -> SDBody a Signal
drawFromList String
"Drand"
dseq :: (Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) => a -> [s] -> SDBody a Signal
dseq :: a -> [s] -> SDBody a Signal
dseq = String -> a -> [s] -> SDBody a Signal
forall a s.
(Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) =>
String -> a -> [s] -> SDBody a Signal
drawFromList String
"Dseq"
drawFromList :: (Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) => String -> a -> [s] -> SDBody a Signal
drawFromList :: String -> a -> [s] -> SDBody a Signal
drawFromList String
ugName a
args [s]
sigs = do
[Signal]
sigs' <- (s -> SDBody a Signal)
-> [s]
-> StateT
([Int], SynthDef (SDBodyArgs a), VarSet (SDBodyArgs a))
Identity
[Signal]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM s -> SDBody a Signal
forall s (args :: [Symbol]).
ToSig s args =>
s -> SDBody' args Signal
toSig [s]
sigs
Signal
reps <- Float -> a -> Proxy "repeats" -> SDBody a Signal
forall as (aToLookUp :: Symbol) defaultVal (proxy :: Symbol -> *).
(FromUA as, KnownSymbol aToLookUp,
ToSig defaultVal (SDBodyArgs as)) =>
defaultVal -> as -> proxy aToLookUp -> SDBody as Signal
uaArgValWDefault (Float
1::Float) a
args (Proxy "repeats"
forall k (t :: k). Proxy t
Proxy::Proxy "repeats")
UGen -> SDBody a Signal
forall (args :: [Symbol]). UGen -> SDBody' args Signal
addUGen (UGen -> SDBody a Signal) -> UGen -> SDBody a Signal
forall a b. (a -> b) -> a -> b
$ UGenName -> CalculationRate -> [Signal] -> Int -> UGen
UGen (ByteString -> UGenName
UGName_S (ByteString -> UGenName) -> ByteString -> UGenName
forall a b. (a -> b) -> a -> b
$ String -> ByteString
UTF8.fromString String
ugName) CalculationRate
DR (Signal
repsSignal -> [Signal] -> [Signal]
forall a. a -> [a] -> [a]
:[Signal]
sigs') Int
1
dser :: (Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) => a -> [s] -> SDBody a Signal
dser :: a -> [s] -> SDBody a Signal
dser = String -> a -> [s] -> SDBody a Signal
forall a s.
(Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) =>
String -> a -> [s] -> SDBody a Signal
drawFromList String
"Dser"
dshuf :: (Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) => a -> [s] -> SDBody a Signal
dshuf :: a -> [s] -> SDBody a Signal
dshuf = String -> a -> [s] -> SDBody a Signal
forall a s.
(Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) =>
String -> a -> [s] -> SDBody a Signal
drawFromList String
"Dshuf"
dwhite :: Args '[] '["lo","hi","length"] a => a -> SDBody a Signal
dwhite :: a -> SDBody a Signal
dwhite = String
-> Args '[] '["lo", "hi", "length"] a => a -> SDBody a Signal
forall a.
String
-> Args '[] '["lo", "hi", "length"] a => a -> SDBody a Signal
demandWhite String
"Dwhite"
demandWhite :: String -> (Args '[] '["lo","hi","length"] a => a -> SDBody a Signal)
demandWhite :: String
-> Args '[] '["lo", "hi", "length"] a => a -> SDBody a Signal
demandWhite String
ugName = String
-> CalculationRate
-> Vs '["length", "lo", "hi"]
-> (UA "lo" (SDBodyArgs a), UA "hi" (SDBodyArgs a),
UA "length" (SDBodyArgs a))
-> a
-> SDBody a Signal
forall (tags :: [Symbol]) optional userSupplied (args :: [Symbol]).
(GetSymbolVals (Vs tags), FromUA optional, FromUA userSupplied,
SDBodyArgs optional ~ SDBodyArgs userSupplied,
SDBodyArgs optional ~ args) =>
String
-> CalculationRate
-> Vs tags
-> optional
-> userSupplied
-> SDBody' args Signal
makeUGen
String
ugName CalculationRate
DR
(Vs '["length", "lo", "hi"]
forall (a :: [Symbol]). Vs a
Vs::Vs '["length","lo","hi"])
(Float -> UA "lo" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "lo" as
lo_ (Float
0::Float), Float -> UA "hi" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "hi" as
hi_ (Float
1::Float), Float -> UA "length" (SDBodyArgs a)
forall s (as :: [Symbol]). ToSig s as => s -> UA "length" as
length_ Float
inf)
dxrand :: (Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) => a -> [s] -> SDBody a Signal
dxrand :: a -> [s] -> SDBody a Signal
dxrand = String -> a -> [s] -> SDBody a Signal
forall a s.
(Args '[] '["repeats"] a, ToSig s (SDBodyArgs a)) =>
String -> a -> [s] -> SDBody a Signal
drawFromList String
"Dxrand"