- class IM a b where
- type family Opr2 a b
- opcode :: IM CsTree a => String -> [CsTree] -> a
- outOpcode :: String -> [CsTree] -> SignalOut
- operation :: IM CsTree a => [String] -> [CsTree] -> a
- infixOperation :: IM CsTree a => String -> [CsTree] -> a
- prefixOperation :: IM CsTree a => String -> [CsTree] -> a
- unaryInfixOperation :: IM CsTree a => String -> CsTree -> a
Documentation
Opr2
a
b
- defines output type of binary arithmetic operator
type instance Opr2 Irate Irate = Irate type instance Opr2 Irate Krate = Krate type instance Opr2 Irate Arate = Arate
type instance Opr2 Krate Irate = Krate type instance Opr2 Krate Krate = Krate type instance Opr2 Krate Arate = Arate
type instance Opr2 Arate Irate = Arate type instance Opr2 Arate Krate = Arate type instance Opr2 Arate Arate = Arate
opcode :: IM CsTree a => String -> [CsTree] -> aSource
Opcode constructor
Example :
ares oscil xamp, xcps, ift, [iphs] kres oscil kamp, kcps, ift, [iphs]
oscilA :: (X a0, X a1) => [Irate] -> a0 -> a1 -> Irate -> Arate oscilA inits xamp xcps ift = opcode "oscil" args where args = [to xamp, to xcps, to ift] ++ map to inits
oscilK :: (K a0, K a1) => [Irate] -> a0 -> a1 -> Irate -> Krate oscilK inits kamp kcps ift = opcode "oscil" args where args = [to kamp, to kcps, to ift] ++ map to inits
ares noise xamp, kbeta
noise :: (X a, K b) => a -> b -> SideEffect Ares noise xamp kbeta = opcode "noise" args where args = [to xamp, to kbeta]
outOpcode :: String -> [CsTree] -> SignalOutSource
Constructor for opcode that doesn't produce any value
Example :
outs asig1, asig2
outs :: Arate -> Arate -> SignalOut outs asig1 asig2 = outOpcode "outs" args where args = [to asig1, to asig2]
operation :: IM CsTree a => [String] -> [CsTree] -> aSource
operation constructor
names can be anywhere between arguments
operation names args
in csound code becomes
names !! 0 ++ show (args !! 0) ++ names !! 1 ++ show (args !! 1) ++ ...
infixOperation :: IM CsTree a => String -> [CsTree] -> aSource
Infix operation constructor
Example :
xres = xsig1 + xsig2
add :: (X a, X b, X (Opr2 a b)) => a -> b -> Opr2 a b add a b = infixOperation "+" [to a, to b]
prefixOperation :: IM CsTree a => String -> [CsTree] -> aSource
Prefix operation constructor
Example :
xres = sin(xsig)
csSin :: X a => a -> a csSin a = prefixOperation "sin" [to a]
unaryInfixOperation :: IM CsTree a => String -> CsTree -> aSource