-- | Zak Patch System
module CsoundExpr.Opcodes.Zak.Top
    (zacl,
     zakinit,
     zamod,
     zar,
     zarg,
     zaw,
     zawm,
     zkcl,
     zkmod,
     zkr,
     zkw,
     zkwm,
     zir,
     ziw,
     ziwm)
where



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



-- | * opcode : zacl
--  
--  
-- * syntax : 
--  
--  >   zacl kfirst, klast
--  
--  
-- * description : 
--  
--  Clears one or more variables in the za space.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zacl.html>
 
zacl :: (K k0, K k1) => k0 -> k1 -> SignalOut
zacl k0first k1last = outOpcode "zacl" args
  where args = [to k0first, to k1last]


-- | * opcode : zakinit
--  
--  
-- * syntax : 
--  
--  >   zakinit isizea, isizek
--  
--  
-- * description : 
--  
--  Establishes zak space. Must be called only once.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zakinit.html>
 
zakinit :: Irate -> Irate -> SignalOut
zakinit i0sizea i1sizek = outOpcode "zakinit" args
  where args = [to i0sizea, to i1sizek]


-- | * opcode : zamod
--  
--  
-- * syntax : 
--  
--  >   ares zamod asig, kzamod
--  
--  
-- * description : 
--  
--  Modulates one a-rate signal by a second one.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zamod.html>
 
zamod :: (K k0) => Arate -> k0 -> Arate
zamod a0sig k1zamod = opcode "zamod" args
  where args = [to a0sig, to k1zamod]


-- | * opcode : zar
--  
--  
-- * syntax : 
--  
--  >   ares zar kndx
--  
--  
-- * description : 
--  
--  Reads from a location in za space at a-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zar.html>
 
zar :: (K k0) => k0 -> Arate
zar k0ndx = opcode "zar" args
  where args = [to k0ndx]


-- | * opcode : zarg
--  
--  
-- * syntax : 
--  
--  >   ares zarg kndx, kgain
--  
--  
-- * description : 
--  
--  Reads from a location in za space at a-rate, adds some gain.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zarg.html>
 
zarg :: (K k0, K k1) => k0 -> k1 -> Arate
zarg k0ndx k1gain = opcode "zarg" args
  where args = [to k0ndx, to k1gain]


-- | * opcode : zaw
--  
--  
-- * syntax : 
--  
--  >   zaw asig, kndx
--  
--  
-- * description : 
--  
--  Writes to a za variable at a-rate without mixing.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zaw.html>
 
zaw :: (K k0) => Arate -> k0 -> SignalOut
zaw a0sig k1ndx = outOpcode "zaw" args
  where args = [to a0sig, to k1ndx]


-- | * opcode : zawm
--  
--  
-- * syntax : 
--  
--  >   zawm asig, kndx [, imix]
--  
--  
-- * description : 
--  
--  Writes to a za variable at a-rate with mixing.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zawm.html>
 
zawm :: (K k0) => [Irate] -> Arate -> k0 -> SignalOut
zawm i0init a1sig k2ndx = outOpcode "zawm" args
  where args = [to a1sig, to k2ndx] ++ map to i0init


-- | * opcode : zkcl
--  
--  
-- * syntax : 
--  
--  >   zkcl kfirst, klast
--  
--  
-- * description : 
--  
--  Clears one or more variables in the zk space.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zkcl.html>
 
zkcl :: (K k0, K k1) => k0 -> k1 -> SignalOut
zkcl k0first k1last = outOpcode "zkcl" args
  where args = [to k0first, to k1last]


-- | * opcode : zkmod
--  
--  
-- * syntax : 
--  
--  >   kres zkmod ksig, kzkmod
--  
--  
-- * description : 
--  
--  Facilitates the modulation of one signal by another.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zkmod.html>
 
zkmod :: (K k0, K k1) => k0 -> k1 -> Krate
zkmod k0sig k1zkmod = opcode "zkmod" args
  where args = [to k0sig, to k1zkmod]


-- | * opcode : zkr
--  
--  
-- * syntax : 
--  
--  >   kres zkr kndx
--  
--  
-- * description : 
--  
--  Reads from a location in zk space at k-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zkr.html>
 
zkr :: (K k0) => k0 -> Krate
zkr k0ndx = opcode "zkr" args
  where args = [to k0ndx]


-- | * opcode : zkw
--  
--  
-- * syntax : 
--  
--  >   zkw ksig, kndx
--  
--  
-- * description : 
--  
--  Writes to a zk variable at k-rate without mixing.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zkw.html>
 
zkw :: (K k0, K k1) => k0 -> k1 -> SignalOut
zkw k0sig k1ndx = outOpcode "zkw" args
  where args = [to k0sig, to k1ndx]


-- | * opcode : zkwm
--  
--  
-- * syntax : 
--  
--  >   zkwm ksig, kndx [, imix]
--  
--  
-- * description : 
--  
--  Writes to a zk variable at k-rate with mixing.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zkwm.html>
 
zkwm :: (K k0, K k1) => [Irate] -> k0 -> k1 -> SignalOut
zkwm i0init k1sig k2ndx = outOpcode "zkwm" args
  where args = [to k1sig, to k2ndx] ++ map to i0init


-- | * opcode : zir
--  
--  
-- * syntax : 
--  
--  >   ir zir indx
--  
--  
-- * description : 
--  
--  Reads from a location in zk space at i-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/zir.html>
 
zir :: Irate -> Irate
zir i0ndx = opcode "zir" args
  where args = [to i0ndx]


-- | * opcode : ziw
--  
--  
-- * syntax : 
--  
--  >   ziw isig, indx
--  
--  
-- * description : 
--  
--  Writes to a zk variable at i-rate without mixing.
--  
--  
-- * url : <http://www.csounds.com/manual/html/ziw.html>
 
ziw :: Irate -> Irate -> SignalOut
ziw i0sig i1ndx = outOpcode "ziw" args
  where args = [to i0sig, to i1ndx]


-- | * opcode : ziwm
--  
--  
-- * syntax : 
--  
--  >   ziwm isig, indx [, imix]
--  
--  
-- * description : 
--  
--  Writes to a zk variable to an i-rate variable with mixing.
--  
--  
-- * url : <http://www.csounds.com/manual/html/ziwm.html>
 
ziwm :: [Irate] -> Irate -> Irate -> SignalOut
ziwm i0init i1sig i2ndx = outOpcode "ziwm" args
  where args = [to i1sig, to i2ndx] ++ map to i0init