-- | Phasors
module CsoundExpr.Opcodes.Siggen.Phasors
    (phasorA,
     phasorK,
     phasorbnkA,
     phasorbnkK,
     syncphasor)
where



import CsoundExpr.Base.Types
import CsoundExpr.Base.MultiOut
import CsoundExpr.Base.SideEffect
import CsoundExpr.Base.UserDefined



-- | * opcode : phasor
--  
--  
-- * syntax : 
--  
--  >   ares phasor xcps [, iphs]
--  >   kres phasor kcps [, iphs]
--  
--  
-- * description : 
--  
--  Produce a normalized moving phase value.
--  
--  
-- * url : <http://www.csounds.com/manual/html/phasor.html>
 
phasorA :: (X x0) => [Irate] -> x0 -> Arate
phasorA i0init x1cps = opcode "phasor" args
  where args = [to x1cps] ++ map to i0init


-- | * opcode : phasor
--  
--  
-- * syntax : 
--  
--  >   ares phasor xcps [, iphs]
--  >   kres phasor kcps [, iphs]
--  
--  
-- * description : 
--  
--  Produce a normalized moving phase value.
--  
--  
-- * url : <http://www.csounds.com/manual/html/phasor.html>
 
phasorK :: (K k0) => [Irate] -> k0 -> Krate
phasorK i0init k1cps = opcode "phasor" args
  where args = [to k1cps] ++ map to i0init


-- | * opcode : phasorbnk
--  
--  
-- * syntax : 
--  
--  >   ares phasorbnk xcps, kndx, icnt [, iphs]
--  >   kres phasorbnk kcps, kndx, icnt [, iphs]
--  
--  
-- * description : 
--  
--  Produce an arbitrary number of normalized moving phase values,
-- accessable by an index.
--  
--  
-- * url : <http://www.csounds.com/manual/html/phasorbnk.html>
 
phasorbnkA :: (X x0, K k0) => [Irate] -> x0 -> k0 -> Irate -> Arate
phasorbnkA i0init x1cps k2ndx i3cnt = opcode "phasorbnk" args
  where args = [to x1cps, to k2ndx, to i3cnt] ++ map to i0init


-- | * opcode : phasorbnk
--  
--  
-- * syntax : 
--  
--  >   ares phasorbnk xcps, kndx, icnt [, iphs]
--  >   kres phasorbnk kcps, kndx, icnt [, iphs]
--  
--  
-- * description : 
--  
--  Produce an arbitrary number of normalized moving phase values,
-- accessable by an index.
--  
--  
-- * url : <http://www.csounds.com/manual/html/phasorbnk.html>
 
phasorbnkK :: (K k0, K k1) => [Irate] -> k0 -> k1 -> Irate -> Krate
phasorbnkK i0init k1cps k2ndx i3cnt = opcode "phasorbnk" args
  where args = [to k1cps, to k2ndx, to i3cnt] ++ map to i0init


-- | * opcode : syncphasor
--  
--  
-- * syntax : 
--  
--  >   aphase, asyncout syncphasor xcps, asyncin, [, iphs]
--  
--  
-- * description : 
--  
--  Produces a moving phase value between zero and one and an extra
-- impulse output ("sync out") whenever its phase value crosses or
-- is reset to zero. The phase can be reset at any time by an
-- impulse on the "sync in" parameter.
--  
--  
-- * url : <http://www.csounds.com/manual/html/syncphasor.html>
 
syncphasor :: (X x0) => [Irate] -> x0 -> Arate -> MultiOut
syncphasor i0init x1cps a2syncin = opcode "syncphasor" args
  where args = [to x1cps, to a2syncin] ++ map to i0init