-- | File Input and Output
module CsoundExpr.Opcodes.Sigio.FileIO
    (fiopen,
     ficloseI,
     ficloseS,
     dumpk,
     dumpk2,
     dumpk3,
     dumpk4,
     fout,
     fouti,
     foutir,
     foutk,
     readk,
     readk2,
     readk3,
     readk4,
     fin,
     fini,
     fink,
     clear,
     vincr,
     fprints,
     fprintks)
where



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



-- | * opcode : fiopen
--  
--  
-- * syntax : 
--  
--  >   ihandle fiopen ifilename, imode
--  
--  
-- * description : 
--  
--  fiopen can be used to open a file in one of the specified modes.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fiopen.html>
 
fiopen :: Irate -> Irate -> Irate
fiopen i0filename i1mode = opcode "fiopen" args
  where args = [to i0filename, to i1mode]


-- | * opcode : ficlose
--  
--  
-- * syntax : 
--  
--  >   ficlose ihandle
--  >   ficlose Sfilename
--  
--  
-- * description : 
--  
--  ficlose can be used to close a file which was opened with
-- fiopen.
--  
--  
-- * url : <http://www.csounds.com/manual/html/ficlose.html>
 
ficloseI :: Irate -> SignalOut
ficloseI i0handle = outOpcode "ficlose" args
  where args = [to i0handle]


-- | * opcode : ficlose
--  
--  
-- * syntax : 
--  
--  >   ficlose ihandle
--  >   ficlose Sfilename
--  
--  
-- * description : 
--  
--  ficlose can be used to close a file which was opened with
-- fiopen.
--  
--  
-- * url : <http://www.csounds.com/manual/html/ficlose.html>
 
ficloseS :: String -> SignalOut
ficloseS s0filename = outOpcode "ficlose" args
  where args = [to s0filename]


-- | * opcode : dumpk
--  
--  
-- * syntax : 
--  
--  >   dumpk ksig, ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically writes an orchestra control-signal value to a named
-- external file in a specific format.
--  
--  
-- * url : <http://www.csounds.com/manual/html/dumpk.html>
 
dumpk :: (K k0) => k0 -> Irate -> Irate -> Irate -> SignalOut
dumpk k0sig i1filname i2format i3prd = outOpcode "dumpk" args
  where args = [to k0sig, to i1filname, to i2format, to i3prd]


-- | * opcode : dumpk2
--  
--  
-- * syntax : 
--  
--  >   dumpk2 ksig1, ksig2, ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically writes two orchestra control-signal values to a
-- named external file in a specific format.
--  
--  
-- * url : <http://www.csounds.com/manual/html/dumpk2.html>
 
dumpk2 ::
         (K k0, K k1) => k0 -> k1 -> Irate -> Irate -> Irate -> SignalOut
dumpk2 k0sig1 k1sig2 i2filname i3format i4prd
  = outOpcode "dumpk2" args
  where args
          = [to k0sig1, to k1sig2, to i2filname, to i3format, to i4prd]


-- | * opcode : dumpk3
--  
--  
-- * syntax : 
--  
--  >   dumpk3 ksig1, ksig2, ksig3, ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically writes three orchestra control-signal values to a
-- named external file in a specific format.
--  
--  
-- * url : <http://www.csounds.com/manual/html/dumpk3.html>
 
dumpk3 ::
         (K k0, K k1, K k2) =>
         k0 -> k1 -> k2 -> Irate -> Irate -> Irate -> SignalOut
dumpk3 k0sig1 k1sig2 k2sig3 i3filname i4format i5prd
  = outOpcode "dumpk3" args
  where args
          = [to k0sig1, to k1sig2, to k2sig3, to i3filname, to i4format,
             to i5prd]


-- | * opcode : dumpk4
--  
--  
-- * syntax : 
--  
--  >   dumpk4 ksig1, ksig2, ksig3, ksig4, ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically writes four orchestra control-signal values to a
-- named external file in a specific format.
--  
--  
-- * url : <http://www.csounds.com/manual/html/dumpk4.html>
 
dumpk4 ::
         (K k0, K k1, K k2, K k3) =>
         k0 -> k1 -> k2 -> k3 -> Irate -> Irate -> Irate -> SignalOut
dumpk4 k0sig1 k1sig2 k2sig3 k3sig4 i4filname i5format i6prd
  = outOpcode "dumpk4" args
  where args
          = [to k0sig1, to k1sig2, to k2sig3, to k3sig4, to i4filname,
             to i5format, to i6prd]


-- | * opcode : fout
--  
--  
-- * syntax : 
--  
--  >   fout ifilename, iformat, aout1 [, aout2, aout3,...,aoutN]
--  
--  
-- * description : 
--  
--  fout outputs N a-rate signals to a specified file of N channels.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fout.html>
 
fout :: String -> Irate -> [Arate] -> SignalOut
fout s0filename i1format a2outN = outOpcode "fout" args
  where args = [to s0filename, to i1format] ++ map to a2outN


-- | * opcode : fouti
--  
--  
-- * syntax : 
--  
--  >   fouti ihandle, iformat, iflag, iout1 [, iout2, iout3,....,ioutN]
--  
--  
-- * description : 
--  
--  fouti output N i-rate signals to a specified file of N channels.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fouti.html>
 
fouti :: Irate -> Irate -> Irate -> [Irate] -> SignalOut
fouti i0handle i1format i2flag i3outN = outOpcode "fouti" args
  where args = [to i0handle, to i1format, to i2flag] ++ map to i3outN


-- | * opcode : foutir
--  
--  
-- * syntax : 
--  
--  >   foutir ihandle, iformat, iflag, iout1 [, iout2, iout3,....,ioutN]
--  
--  
-- * description : 
--  
--  foutir output N i-rate signals to a specified file of N
-- channels.
--  
--  
-- * url : <http://www.csounds.com/manual/html/foutir.html>
 
foutir :: Irate -> Irate -> Irate -> [Irate] -> SignalOut
foutir i0handle i1format i2flag i3outN = outOpcode "foutir" args
  where args = [to i0handle, to i1format, to i2flag] ++ map to i3outN


-- | * opcode : foutk
--  
--  
-- * syntax : 
--  
--  >   foutk ifilename, iformat, kout1 [, kout2, kout3,....,koutN]
--  
--  
-- * description : 
--  
--  foutk outputs N k-rate signals to a specified file of N
-- channels.
--  
--  
-- * url : <http://www.csounds.com/manual/html/foutk.html>
 
foutk :: (K k0) => String -> Irate -> [k0] -> SignalOut
foutk s0filename i1format k2outN = outOpcode "foutk" args
  where args = [to s0filename, to i1format] ++ map to k2outN


-- | * opcode : readk
--  
--  
-- * syntax : 
--  
--  >   kres readk ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically reads an orchestra control-signal value from a
-- named external file in a specific format.
--  
--  
-- * url : <http://www.csounds.com/manual/html/readk.html>
 
readk :: Irate -> Irate -> Irate -> Krate
readk i0filname i1format i2prd = opcode "readk" args
  where args = [to i0filname, to i1format, to i2prd]


-- | * opcode : readk2
--  
--  
-- * syntax : 
--  
--  >   kr1, kr2 readk2 ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically reads two orchestra control-signal values from an
-- external file.
--  
--  
-- * url : <http://www.csounds.com/manual/html/readk2.html>
 
readk2 :: Irate -> Irate -> Irate -> MultiOut
readk2 i0filname i1format i2prd = opcode "readk2" args
  where args = [to i0filname, to i1format, to i2prd]


-- | * opcode : readk3
--  
--  
-- * syntax : 
--  
--  >   kr1, kr2, kr3 readk3 ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically reads three orchestra control-signal values from an
-- external file.
--  
--  
-- * url : <http://www.csounds.com/manual/html/readk3.html>
 
readk3 :: Irate -> Irate -> Irate -> MultiOut
readk3 i0filname i1format i2prd = opcode "readk3" args
  where args = [to i0filname, to i1format, to i2prd]


-- | * opcode : readk4
--  
--  
-- * syntax : 
--  
--  >   kr1, kr2, kr3, kr4 readk4 ifilname, iformat, iprd
--  
--  
-- * description : 
--  
--  Periodically reads four orchestra control-signal values from an
-- external file.
--  
--  
-- * url : <http://www.csounds.com/manual/html/readk4.html>
 
readk4 :: Irate -> Irate -> Irate -> MultiOut
readk4 i0filname i1format i2prd = opcode "readk4" args
  where args = [to i0filname, to i1format, to i2prd]


-- | * opcode : fin
--  
--  
-- * syntax : 
--  
--  >   fin ifilename, iskipframes, iformat, ain1 [, ain2] [, ain3] [,...]
--  
--  
-- * description : 
--  
--  Read signals from a file at a-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fin.html>
 
fin :: String -> Irate -> Irate -> [Arate] -> SignalOut
fin s0filename i1skipframes i2format a3outN = outOpcode "fin" args
  where args
          = [to s0filename, to i1skipframes, to i2format] ++ map to a3outN


-- | * opcode : fini
--  
--  
-- * syntax : 
--  
--  >   fini ifilename, iskipframes, iformat, in1 [, in2] [, in3] [,...]
--  
--  
-- * description : 
--  
--  Read signals from a file at i-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fini.html>
 
fini :: String -> Irate -> Irate -> [Irate] -> SignalOut
fini s0filename i1skipframes i2format i3outN
  = outOpcode "fini" args
  where args
          = [to s0filename, to i1skipframes, to i2format] ++ map to i3outN


-- | * opcode : fink
--  
--  
-- * syntax : 
--  
--  >   fink ifilename, iskipframes, iformat, kin1 [, kin2] [, kin3] [,...]
--  
--  
-- * description : 
--  
--  Read signals from a file at k-rate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fink.html>
 
fink :: (K k0) => String -> Irate -> Irate -> [k0] -> SignalOut
fink s0filename i1skipframes i2format k3outN
  = outOpcode "fink" args
  where args
          = [to s0filename, to i1skipframes, to i2format] ++ map to k3outN


-- | * opcode : clear
--  
--  
-- * syntax : 
--  
--  >   clear avar1 [, avar2] [, avar3] [...]
--  
--  
-- * description : 
--  
--  clear zeroes a list of audio signals.
--  
--  
-- * url : <http://www.csounds.com/manual/html/clear.html>
 
clear :: [Arate] -> SignalOut
clear a0var = outOpcode "clear" args
  where args = map to a0var


-- | * opcode : vincr
--  
--  
-- * syntax : 
--  
--  >   vincr accum, aincr
--  
--  
-- * description : 
--  
--  vincr increments one audio variable with another signal, i.e. it
-- accumulates output.
--  
--  
-- * url : <http://www.csounds.com/manual/html/vincr.html>
 
vincr :: Arate -> Arate -> SignalOut
vincr a0ccum a1incr = outOpcode "vincr" args
  where args = [to a0ccum, to a1incr]


-- | * opcode : fprints
--  
--  
-- * syntax : 
--  
--  >   fprints "filename", "string" [, ival1] [, ival2] [...]
--  
--  
-- * description : 
--  
--  Similar to prints but prints to a file.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fprints.html>
 
fprints :: String -> String -> [Irate] -> SignalOut
fprints s0filename s1string i2valN = outOpcode "fprints" args
  where args = [to s0filename, to s1string] ++ map to i2valN


-- | * opcode : fprintks
--  
--  
-- * syntax : 
--  
--  >   fprintks "filename", "string", [, kval1] [, kval2] [...]
--  
--  
-- * description : 
--  
--  Similar to printks but prints to a file.
--  
--  
-- * url : <http://www.csounds.com/manual/html/fprintks.html>
 
fprintks :: (K k0) => String -> String -> [k0] -> SignalOut
fprintks s0filename s1string k2valN = outOpcode "fprintks" args
  where args = [to s0filename, to s1string] ++ map to k2valN