module Csound.Typed.Opcode.Network (
    
    
    
    remoteport, sockrecv, sockrecvs, strecv, socksend, socksends, stsend) where

import Control.Monad.Trans.Class
import Csound.Dynamic
import Csound.Typed

-- 

-- | 
-- Defines the port for use with the remote system.
--
-- Defines the port for use with the insremot, 
--       midremot, insglobal
--       and midglobal opcodes.
--
-- >  remoteport  iportnum
--
-- csound doc: <http://csound.com/docs/manual/remoteport.html>
remoteport ::  D -> SE ()
remoteport :: D -> SE ()
remoteport D
b1 = Dep () -> SE ()
forall a. Dep a -> SE a
SE (Dep () -> SE ()) -> Dep () -> SE ()
forall a b. (a -> b) -> a -> b
$ (E -> Dep ()
forall (m :: * -> *). Monad m => E -> DepT m ()
depT_ (E -> Dep ()) -> DepT GE E -> Dep ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) (DepT GE E -> Dep ()) -> DepT GE E -> Dep ()
forall a b. (a -> b) -> a -> b
$ GE E -> DepT GE E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> DepT GE E) -> GE E -> DepT GE E
forall a b. (a -> b) -> a -> b
$ E -> E
f (E -> E) -> GE E -> GE E
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> D -> GE E
unD D
b1
    where f :: E -> E
f E
a1 = Name -> Spec1 -> [E] -> E
opcs Name
"remoteport" [(Rate
Xr,[Rate
Ir])] [E
a1]

-- | 
-- Receives data from other processes using the low-level UDP or TCP protocols
--
-- Receives directly using the UDP (sockrecv and
--       sockrecvs) or TCP (strecv)
--       protocol onto a network. The data is not subject to any encoding or special
--       routing. The sockrecvs opcode receives a stereo signal
--       interleaved.
--
-- > asig  sockrecv  iport, ilength
-- > ksig  sockrecv  iport, ilength
--
-- csound doc: <http://csound.com/docs/manual/sockrecv.html>
sockrecv ::  D -> D -> Sig
sockrecv :: D -> D -> Sig
sockrecv D
b1 D
b2 = GE E -> Sig
Sig (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ E -> E -> E
f (E -> E -> E) -> GE E -> GE (E -> E)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> D -> GE E
unD D
b1 GE (E -> E) -> GE E -> GE E
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b2
    where f :: E -> E -> E
f E
a1 E
a2 = Name -> Spec1 -> [E] -> E
opcs Name
"sockrecv" [(Rate
Ar,[Rate
Ir,Rate
Ir]),(Rate
Kr,[Rate
Ir,Rate
Ir])] [E
a1,E
a2]

-- | 
-- Receives data from other processes using the low-level UDP or TCP protocols
--
-- Receives directly using the UDP (sockrecv and
--       sockrecvs) or TCP (strecv)
--       protocol onto a network. The data is not subject to any encoding or special
--       routing. The sockrecvs opcode receives a stereo signal
--       interleaved.
--
-- > asigl, asigr  sockrecvs  iport, ilength
--
-- csound doc: <http://csound.com/docs/manual/sockrecv.html>
sockrecvs ::  D -> D -> (Sig,Sig)
sockrecvs :: D -> D -> (Sig, Sig)
sockrecvs D
b1 D
b2 = GE (MultiOut [E]) -> (Sig, Sig)
forall a. Tuple a => GE (MultiOut [E]) -> a
pureTuple (GE (MultiOut [E]) -> (Sig, Sig))
-> GE (MultiOut [E]) -> (Sig, Sig)
forall a b. (a -> b) -> a -> b
$ E -> E -> MultiOut [E]
f (E -> E -> MultiOut [E]) -> GE E -> GE (E -> MultiOut [E])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> D -> GE E
unD D
b1 GE (E -> MultiOut [E]) -> GE E -> GE (MultiOut [E])
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b2
    where f :: E -> E -> MultiOut [E]
f E
a1 E
a2 = Name -> Specs -> [E] -> MultiOut [E]
mopcs Name
"sockrecvs" ([Rate
Ar,Rate
Ar],[Rate
Ir,Rate
Ir]) [E
a1,E
a2]

-- | 
-- Receives data from other processes using the low-level UDP or TCP protocols
--
-- Receives directly using the UDP (sockrecv and
--       sockrecvs) or TCP (strecv)
--       protocol onto a network. The data is not subject to any encoding or special
--       routing. The sockrecvs opcode receives a stereo signal
--       interleaved.
--
-- > asig  strecv  Sipaddr, iport
--
-- csound doc: <http://csound.com/docs/manual/sockrecv.html>
strecv ::  Str -> D -> Sig
strecv :: Str -> D -> Sig
strecv Str
b1 D
b2 = GE E -> Sig
Sig (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ E -> E -> E
f (E -> E -> E) -> GE E -> GE (E -> E)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Str -> GE E
unStr Str
b1 GE (E -> E) -> GE E -> GE E
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b2
    where f :: E -> E -> E
f E
a1 E
a2 = Name -> Spec1 -> [E] -> E
opcs Name
"strecv" [(Rate
Ar,[Rate
Sr,Rate
Ir])] [E
a1,E
a2]

-- | 
-- Sends data to other processes using the low-level UDP or TCP protocols
--
-- Transmits data directly using the UDP (socksend and
--       socksends) or TCP (stsend)
--       protocol onto a network. The data is not subject to any encoding or special
--       routing. The socksends opcode send a stereo signal interleaved.
--
-- >  socksend  asig, Sipaddr, iport, ilength
-- >  socksend  ksig, Sipaddr, iport, ilength
--
-- csound doc: <http://csound.com/docs/manual/socksend.html>
socksend ::  Sig -> Str -> D -> D -> SE ()
socksend :: Sig -> Str -> D -> D -> SE ()
socksend Sig
b1 Str
b2 D
b3 D
b4 = Dep () -> SE ()
forall a. Dep a -> SE a
SE (Dep () -> SE ()) -> Dep () -> SE ()
forall a b. (a -> b) -> a -> b
$ (E -> Dep ()
forall (m :: * -> *). Monad m => E -> DepT m ()
depT_ (E -> Dep ()) -> DepT GE E -> Dep ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) (DepT GE E -> Dep ()) -> DepT GE E -> Dep ()
forall a b. (a -> b) -> a -> b
$ GE E -> DepT GE E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> DepT GE E) -> GE E -> DepT GE E
forall a b. (a -> b) -> a -> b
$ E -> E -> E -> E -> E
f (E -> E -> E -> E -> E) -> GE E -> GE (E -> E -> E -> E)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
unSig Sig
b1 GE (E -> E -> E -> E) -> GE E -> GE (E -> E -> E)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Str -> GE E
unStr Str
b2 GE (E -> E -> E) -> GE E -> GE (E -> E)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b3 GE (E -> E) -> GE E -> GE E
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b4
    where f :: E -> E -> E -> E -> E
f E
a1 E
a2 E
a3 E
a4 = Name -> Spec1 -> [E] -> E
opcs Name
"socksend" [(Rate
Xr,[Rate
Ar,Rate
Sr,Rate
Ir,Rate
Ir])] [E
a1,E
a2,E
a3,E
a4]

-- | 
-- Sends data to other processes using the low-level UDP or TCP protocols
--
-- Transmits data directly using the UDP (socksend and
--       socksends) or TCP (stsend)
--       protocol onto a network. The data is not subject to any encoding or special
--       routing. The socksends opcode send a stereo signal interleaved.
--
-- >  socksends  asigl, asigr, Sipaddr, iport,
-- >         ilength
--
-- csound doc: <http://csound.com/docs/manual/socksend.html>
socksends ::  Sig -> Sig -> Str -> D -> D -> SE ()
socksends :: Sig -> Sig -> Str -> D -> D -> SE ()
socksends Sig
b1 Sig
b2 Str
b3 D
b4 D
b5 = Dep () -> SE ()
forall a. Dep a -> SE a
SE (Dep () -> SE ()) -> Dep () -> SE ()
forall a b. (a -> b) -> a -> b
$ (E -> Dep ()
forall (m :: * -> *). Monad m => E -> DepT m ()
depT_ (E -> Dep ()) -> DepT GE E -> Dep ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) (DepT GE E -> Dep ()) -> DepT GE E -> Dep ()
forall a b. (a -> b) -> a -> b
$ GE E -> DepT GE E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> DepT GE E) -> GE E -> DepT GE E
forall a b. (a -> b) -> a -> b
$ E -> E -> E -> E -> E -> E
f (E -> E -> E -> E -> E -> E) -> GE E -> GE (E -> E -> E -> E -> E)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
unSig Sig
b1 GE (E -> E -> E -> E -> E) -> GE E -> GE (E -> E -> E -> E)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
unSig Sig
b2 GE (E -> E -> E -> E) -> GE E -> GE (E -> E -> E)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Str -> GE E
unStr Str
b3 GE (E -> E -> E) -> GE E -> GE (E -> E)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b4 GE (E -> E) -> GE E -> GE E
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b5
    where f :: E -> E -> E -> E -> E -> E
f E
a1 E
a2 E
a3 E
a4 E
a5 = Name -> Spec1 -> [E] -> E
opcs Name
"socksends" [(Rate
Xr,[Rate
Ar,Rate
Ar,Rate
Sr,Rate
Ir,Rate
Ir])] [E
a1,E
a2,E
a3,E
a4,E
a5]

-- | 
-- Sends data to other processes using the low-level UDP or TCP protocols
--
-- Transmits data directly using the UDP (socksend and
--       socksends) or TCP (stsend)
--       protocol onto a network. The data is not subject to any encoding or special
--       routing. The socksends opcode send a stereo signal interleaved.
--
-- >  stsend  asig, Sipaddr, iport
--
-- csound doc: <http://csound.com/docs/manual/socksend.html>
stsend ::  Sig -> Str -> D -> SE ()
stsend :: Sig -> Str -> D -> SE ()
stsend Sig
b1 Str
b2 D
b3 = Dep () -> SE ()
forall a. Dep a -> SE a
SE (Dep () -> SE ()) -> Dep () -> SE ()
forall a b. (a -> b) -> a -> b
$ (E -> Dep ()
forall (m :: * -> *). Monad m => E -> DepT m ()
depT_ (E -> Dep ()) -> DepT GE E -> Dep ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) (DepT GE E -> Dep ()) -> DepT GE E -> Dep ()
forall a b. (a -> b) -> a -> b
$ GE E -> DepT GE E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> DepT GE E) -> GE E -> DepT GE E
forall a b. (a -> b) -> a -> b
$ E -> E -> E -> E
f (E -> E -> E -> E) -> GE E -> GE (E -> E -> E)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
unSig Sig
b1 GE (E -> E -> E) -> GE E -> GE (E -> E)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Str -> GE E
unStr Str
b2 GE (E -> E) -> GE E -> GE E
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> D -> GE E
unD D
b3
    where f :: E -> E -> E -> E
f E
a1 E
a2 E
a3 = Name -> Spec1 -> [E] -> E
opcs Name
"stsend" [(Rate
Xr,[Rate
Ar,Rate
Sr,Rate
Ir])] [E
a1,E
a2,E
a3]