-- | Miscellaneous opcodes
module CsoundExpr.Opcodes.Miscopcodes.Top
    (system,
     modmatrix)
where



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



-- | * opcode : system
--  
--  
-- * syntax : 
--  
--  >   ires system_i itrig, Scmd, [inowait]
--  >   kres system ktrig, Scmd, [knowait]
--  
--  
-- * description : 
--  
--  system and system_i call any external command understood by the
-- operating system, similarly to the C function system(). system_i
-- runs at i-time only, while system runs both at initialization and
-- performance time.
--  
--  
-- * url : <http://www.csounds.com/manual/html/system.html>
 
system :: (K k0, K k1) => [k0] -> k1 -> String -> Krate
system k0init k1trig s2cmd = opcode "system" args
  where args = [to k1trig, to s2cmd] ++ map to k0init


-- | * opcode : modmatrix
--  
--  
-- * syntax : 
--  
--  >   modmatrix iresfn, isrcmodfn, isrcparmfn, imodscale, inum_mod, 
--  >       inum_parm, kupdate
--  
--  
-- * description : 
--  
--  The opcode can be used to let a large number of k-rate modulator
-- variables modulate a large number of k-rate parameter variables,
-- with arbitrary scaling of each modulator-to-parameter connection.
-- Csound ftables are used to hold both the input (parameter)
-- variables, the modulator variables, and the scaling coefficients.
-- Output variables are written to another Csound ftable.
--  
--  
-- * url : <http://www.csounds.com/manual/html/modmatrix.html>
 
modmatrix ::
            (K k0) =>
            Irate ->
              Irate -> Irate -> Irate -> Irate -> Irate -> k0 -> SignalOut
modmatrix i0resfn i1srcmodfn i2srcparmfn i3modscale i4num_mod
  i5num_parm k6update = outOpcode "modmatrix" args
  where args
          = [to i0resfn, to i1srcmodfn, to i2srcparmfn, to i3modscale,
             to i4num_mod, to i5num_parm, to k6update]