-- | MIDI/Score Interoperability opcodes
module CsoundExpr.Opcodes.Midi.Interop
    (midichannelaftertouch,
     midichn,
     midicontrolchange,
     mididefault,
     midinoteoff,
     midinoteoncps,
     midinoteonkey,
     midinoteonoct,
     midinoteonpch,
     midipitchbend,
     midipolyaftertouch,
     midiprogramchange)
where



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



-- | * opcode : midichannelaftertouch
--  
--  
-- * syntax : 
--  
--  >   midichannelaftertouch xchannelaftertouch [, ilow] [, ihigh]
--  
--  
-- * description : 
--  
--  midichannelaftertouch is designed to simplify writing
-- instruments that can be used interchangeably for either score or
-- MIDI input, and to make it easier to adapt instruments originally
-- written for score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midichannelaftertouch.html>
 
midichannelaftertouch :: (X x0) => [Irate] -> x0 -> SignalOut
midichannelaftertouch i0init x1channelaftertouch
  = outOpcode "midichannelaftertouch" args
  where args = [to x1channelaftertouch] ++ map to i0init


-- | * opcode : midichn
--  
--  
-- * syntax : 
--  
--  >   ichn midichn
--  
--  
-- * description : 
--  
--  midichn returns the MIDI channel number (1 - 16) from which the
-- note was activated. In the case of score notes, it returns 0.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midichn.html>
 
midichn :: Irate
midichn = opcode "midichn" args
  where args = []


-- | * opcode : midicontrolchange
--  
--  
-- * syntax : 
--  
--  >   midicontrolchange xcontroller, xcontrollervalue [, ilow] [, ihigh]
--  
--  
-- * description : 
--  
--  midicontrolchange is designed to simplify writing instruments
-- that can be used interchangeably for either score or MIDI input,
-- and to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midicontrolchange.html>
 
midicontrolchange ::
                    (X x0, X x1) => [Irate] -> x0 -> x1 -> SignalOut
midicontrolchange i0init x1controller x2controllervalue
  = outOpcode "midicontrolchange" args
  where args
          = [to x1controller, to x2controllervalue] ++ map to i0init


-- | * opcode : mididefault
--  
--  
-- * syntax : 
--  
--  >   mididefault xdefault, xvalue
--  
--  
-- * description : 
--  
--  mididefault is designed to simplify writing instruments that can
-- be used interchangeably for either score or MIDI input, and to
-- make it easier to adapt instruments originally written for score
-- input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/mididefault.html>
 
mididefault :: (X x0, X x1) => x0 -> x1 -> SignalOut
mididefault x0default x1value = outOpcode "mididefault" args
  where args = [to x0default, to x1value]


-- | * opcode : midinoteoff
--  
--  
-- * syntax : 
--  
--  >   midinoteoff xkey, xvelocity
--  
--  
-- * description : 
--  
--  midinoteoff is designed to simplify writing instruments that can
-- be used interchangeably for either score or MIDI input, and to
-- make it easier to adapt instruments originally written for score
-- input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midinoteoff.html>
 
midinoteoff :: (X x0, X x1) => x0 -> x1 -> SignalOut
midinoteoff x0key x1velocity = outOpcode "midinoteoff" args
  where args = [to x0key, to x1velocity]


-- | * opcode : midinoteoncps
--  
--  
-- * syntax : 
--  
--  >   midinoteoncps xcps, xvelocity
--  
--  
-- * description : 
--  
--  midinoteoncps is designed to simplify writing instruments that
-- can be used interchangeably for either score or MIDI input, and
-- to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midinoteoncps.html>
 
midinoteoncps :: (X x0, X x1) => x0 -> x1 -> SignalOut
midinoteoncps x0cps x1velocity = outOpcode "midinoteoncps" args
  where args = [to x0cps, to x1velocity]


-- | * opcode : midinoteonkey
--  
--  
-- * syntax : 
--  
--  >   midinoteonkey xkey, xvelocity
--  
--  
-- * description : 
--  
--  midinoteonkey is designed to simplify writing instruments that
-- can be used interchangeably for either score or MIDI input, and
-- to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midinoteonkey.html>
 
midinoteonkey :: (X x0, X x1) => x0 -> x1 -> SignalOut
midinoteonkey x0key x1velocity = outOpcode "midinoteonkey" args
  where args = [to x0key, to x1velocity]


-- | * opcode : midinoteonoct
--  
--  
-- * syntax : 
--  
--  >   midinoteonoct xoct, xvelocity
--  
--  
-- * description : 
--  
--  midinoteonoct is designed to simplify writing instruments that
-- can be used interchangeably for either score or MIDI input, and
-- to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midinoteonoct.html>
 
midinoteonoct :: (X x0, X x1) => x0 -> x1 -> SignalOut
midinoteonoct x0oct x1velocity = outOpcode "midinoteonoct" args
  where args = [to x0oct, to x1velocity]


-- | * opcode : midinoteonpch
--  
--  
-- * syntax : 
--  
--  >   midinoteonpch xpch, xvelocity
--  
--  
-- * description : 
--  
--  midinoteonpch is designed to simplify writing instruments that
-- can be used interchangeably for either score or MIDI input, and
-- to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midinoteonpch.html>
 
midinoteonpch :: (X x0, X x1) => x0 -> x1 -> SignalOut
midinoteonpch x0pch x1velocity = outOpcode "midinoteonpch" args
  where args = [to x0pch, to x1velocity]


-- | * opcode : midipitchbend
--  
--  
-- * syntax : 
--  
--  >   midipitchbend xpitchbend [, ilow] [, ihigh]
--  
--  
-- * description : 
--  
--  midipitchbend is designed to simplify writing instruments that
-- can be used interchangeably for either score or MIDI input, and
-- to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midipitchbend.html>
 
midipitchbend :: (X x0) => [Irate] -> x0 -> SignalOut
midipitchbend i0init x1pitchbend = outOpcode "midipitchbend" args
  where args = [to x1pitchbend] ++ map to i0init


-- | * opcode : midipolyaftertouch
--  
--  
-- * syntax : 
--  
--  >   midipolyaftertouch xpolyaftertouch, xcontrollervalue [, ilow] [, ihigh]
--  
--  
-- * description : 
--  
--  midipolyaftertouch is designed to simplify writing instruments
-- that can be used interchangeably for either score or MIDI input,
-- and to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midipolyaftertouch.html>
 
midipolyaftertouch ::
                     (X x0, X x1) => [Irate] -> x0 -> x1 -> SignalOut
midipolyaftertouch i0init x1polyaftertouch x2controllervalue
  = outOpcode "midipolyaftertouch" args
  where args
          = [to x1polyaftertouch, to x2controllervalue] ++ map to i0init


-- | * opcode : midiprogramchange
--  
--  
-- * syntax : 
--  
--  >   midiprogramchange xprogram
--  
--  
-- * description : 
--  
--  midiprogramchange is designed to simplify writing instruments
-- that can be used interchangeably for either score or MIDI input,
-- and to make it easier to adapt instruments originally written for
-- score input to work with MIDI input.
--  
--  
-- * url : <http://www.csounds.com/manual/html/midiprogramchange.html>
 
midiprogramchange :: (X x0) => x0 -> SignalOut
midiprogramchange x0program = outOpcode "midiprogramchange" args
  where args = [to x0program]