-- Zero delay filters (implemented in Csound by Steven Yi)
module Csound.Typed.Plugins.Zdf(
    -- One pole filters
    zdf1, zlp1, zhp1, zap1,

    -- Two pole filters
    zdf2, zlp, zbp, zhp, zdf2_notch, zbr,

    -- Ladder filter
    zladder,

    -- Four poles filters
    zdf4, zlp4, zbp4, zhp4,
    zdf_4pole_hp,

    -- Eq-filters
    peakEq, highShelf, lowShelf
) where

import Csound.Dynamic

import Csound.Typed.Types
import Csound.Typed.GlobalState
import qualified Csound.Typed.GlobalState.Elements as E(zdfPlugin)

-------------------------------------------------------------------------------
-- Haskell way (reorder arguments, split some funs)

-- zdf_1pole

zdf1 :: Sig -> Sig -> (Sig, Sig)
zdf1 :: Sig -> Sig -> (Sig, Sig)
zdf1 Sig
cfq Sig
asig = Sig -> Sig -> (Sig, Sig)
zdf_1pole Sig
asig Sig
cfq

zlp1 :: Sig -> Sig -> Sig
zlp1 :: Sig -> Sig -> Sig
zlp1 Sig
cfq Sig
asig = Sig
lows
    where (Sig
lows, Sig
_) = Sig -> Sig -> (Sig, Sig)
zdf_1pole Sig
asig Sig
cfq

zhp1 :: Sig -> Sig -> Sig
zhp1 :: Sig -> Sig -> Sig
zhp1 Sig
cfq Sig
asig = Sig
highs
    where (Sig
_, Sig
highs) = Sig -> Sig -> (Sig, Sig)
zdf_1pole Sig
asig Sig
cfq

-- zdf_allpass_1pole

zap1 :: Sig -> Sig -> Sig
zap1 :: Sig -> Sig -> Sig
zap1 Sig
cfq Sig
asig = Sig -> Sig -> Sig
zdf_allpass_1pole Sig
asig Sig
cfq

-- zdf_2pole

-- outs: lp, bp, hp
zdf2 :: Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf2 :: Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf2 Sig
cfq Sig
q Sig
asig = Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf_2pole Sig
asig Sig
cfq Sig
q

zlp :: Sig -> Sig -> Sig -> Sig
zlp :: Sig -> Sig -> Sig -> Sig
zlp Sig
cfq Sig
q Sig
asig = Sig
lows
    where (Sig
lows, Sig
_, Sig
_) = Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf2 Sig
cfq Sig
q Sig
asig

zbp :: Sig -> Sig -> Sig -> Sig
zbp :: Sig -> Sig -> Sig -> Sig
zbp Sig
cfq Sig
q Sig
asig = Sig
mids
    where (Sig
_, Sig
mids, Sig
_) = Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf2 Sig
cfq Sig
q Sig
asig

zhp :: Sig -> Sig -> Sig -> Sig
zhp :: Sig -> Sig -> Sig -> Sig
zhp Sig
cfq Sig
q Sig
asig = Sig
highs
    where (Sig
_, Sig
_, Sig
highs) = Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf2 Sig
cfq Sig
q Sig
asig

zdf2_notch :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig)
zdf2_notch :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig)
zdf2_notch Sig
cfq Sig
q Sig
asig = Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig)
zdf_2pole_notch Sig
asig Sig
cfq Sig
q

zbr :: Sig -> Sig -> Sig -> Sig
zbr :: Sig -> Sig -> Sig -> Sig
zbr Sig
cfq Sig
q Sig
asig = Sig
notch
    where (Sig
_, Sig
_, Sig
_, Sig
notch) = Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig)
zdf2_notch Sig
cfq Sig
q Sig
asig

-- ladder

zladder :: Sig -> Sig -> Sig -> Sig
zladder :: Sig -> Sig -> Sig -> Sig
zladder Sig
cfq Sig
q Sig
asig = Sig -> Sig -> Sig -> Sig
zdf_ladder Sig
asig Sig
cfq Sig
q

-- zdf_4pole

zdf4 ::  Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf4 :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf4 Sig
cfq Sig
q Sig
asig = Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf_4pole Sig
asig Sig
cfq Sig
q

zlp4 ::  Sig -> Sig -> Sig -> Sig
zlp4 :: Sig -> Sig -> Sig -> Sig
zlp4 Sig
cfq Sig
q Sig
asig = Sig
lows
    where (Sig
_, Sig
_, Sig
_, Sig
lows, Sig
_, Sig
_) = Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf4 Sig
cfq Sig
q Sig
asig

zbp4 ::  Sig -> Sig -> Sig -> Sig
zbp4 :: Sig -> Sig -> Sig -> Sig
zbp4 Sig
cfq Sig
q Sig
asig = Sig
mids
    where (Sig
_, Sig
_, Sig
_, Sig
_, Sig
mids, Sig
_) = Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf4 Sig
cfq Sig
q Sig
asig

zhp4 ::  Sig -> Sig -> Sig -> Sig
zhp4 :: Sig -> Sig -> Sig -> Sig
zhp4 Sig
cfq Sig
q Sig
asig = Sig
highs
    where (Sig
_, Sig
_, Sig
_, Sig
_, Sig
_, Sig
highs) = Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf4 Sig
cfq Sig
q Sig
asig

-- zdf_peak_eq
peakEq :: Sig -> Sig -> Sig -> Sig -> Sig
peakEq :: Sig -> Sig -> Sig -> Sig -> Sig
peakEq Sig
kcf Sig
kres Sig
kdB Sig
ain = Sig -> Sig -> Sig -> Sig -> Sig
zdf_peak_eq Sig
ain Sig
kcf Sig
kres Sig
kdB

-- zdf_high_shelf_eq
highShelf :: Sig -> Sig -> Sig -> Sig
highShelf :: Sig -> Sig -> Sig -> Sig
highShelf Sig
kcf Sig
kres Sig
ain = Sig -> Sig -> Sig -> Sig
zdf_high_shelf_eq Sig
ain Sig
kcf Sig
kres

-- zdf_low_shelf_eq
lowShelf :: Sig -> Sig -> Sig -> Sig
lowShelf :: Sig -> Sig -> Sig -> Sig
lowShelf Sig
kcf Sig
kres Sig
ain = Sig -> Sig -> Sig -> Sig
zdf_low_shelf_eq Sig
ain Sig
kcf Sig
kres

-------------------------------------------------------------------------------
-- Steven implementation

-- 1-pole (6dB) lowpass/highpass filter
-- takes in a a-rate signal and cutoff value in frequency
--
-- xout alp, ahp
zdf_1pole :: Sig -> Sig -> (Sig, Sig)
zdf_1pole :: Sig -> Sig -> (Sig, Sig)
zdf_1pole Sig
asig Sig
cfq = GE [E] -> (Sig, Sig)
forall a. Tuple a => GE [E] -> a
toTuple (GE [E] -> (Sig, Sig)) -> GE [E] -> (Sig, Sig)
forall a b. (a -> b) -> a -> b
$ ((Int -> [E]) -> [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Int -> [E]) -> Int -> [E]
forall a b. (a -> b) -> a -> b
$ Int
2) (GE (Int -> [E]) -> GE [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    E -> E -> Int -> [E]
f (E -> E -> Int -> [E]) -> GE E -> GE (E -> Int -> [E])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> Int -> [E]) -> GE E -> GE (Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq
    where f :: E -> E -> Int -> [E]
f E
asig' E
cfq' = Name -> Specs -> [E] -> Int -> [E]
mopcs Name
"zdf_1pole" ([Rate
Ar, Rate
Ar], [Rate
Ar, Rate
Ar]) [E
asig', E
cfq']

-- 1-pole allpass filter
-- takes in an a-rate signal and corner frequency where input
-- phase is shifted -90 degrees
zdf_allpass_1pole :: Sig -> Sig -> Sig
zdf_allpass_1pole :: Sig -> Sig -> Sig
zdf_allpass_1pole Sig
asig Sig
cfq = GE E -> Sig
forall a. Val a => GE E -> a
fromGE (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    E -> E -> E
f (E -> E -> E) -> GE E -> GE (E -> E)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E) -> GE E -> GE E
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq
    where f :: E -> E -> E
f E
asig' E
cfq' = Name -> Spec1 -> [E] -> E
opcs Name
"zdf_allpass_1pole" [(Rate
Ar, [Rate
Ar, Rate
Ar])] [E
asig', E
cfq']

-- 2-pole (12dB) lowpass/highpass/bandpass filter
-- takes in a a-rate signal, cutoff value in frequency, and
-- Q factor for resonance
--
-- xout alp, abp, ahp
zdf_2pole :: Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf_2pole :: Sig -> Sig -> Sig -> (Sig, Sig, Sig)
zdf_2pole Sig
asig Sig
cfq Sig
q = GE [E] -> (Sig, Sig, Sig)
forall a. Tuple a => GE [E] -> a
toTuple (GE [E] -> (Sig, Sig, Sig)) -> GE [E] -> (Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ ((Int -> [E]) -> [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Int -> [E]) -> Int -> [E]
forall a b. (a -> b) -> a -> b
$ Int
3) (GE (Int -> [E]) -> GE [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    E -> E -> E -> Int -> [E]
f (E -> E -> E -> Int -> [E]) -> GE E -> GE (E -> E -> Int -> [E])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> Int -> [E]) -> GE E -> GE (E -> Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> Int -> [E]) -> GE E -> GE (Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
q
    where f :: E -> E -> E -> Int -> [E]
f E
asig' E
cfq' E
q' = Name -> Specs -> [E] -> Int -> [E]
mopcs Name
"zdf_2pole" ([Rate
Ar, Rate
Ar, Rate
Ar], [Rate
Ar, Rate
Ar, Rate
Ar]) [E
asig', E
cfq', E
q']

-- 2-pole (12dB) lowpass/highpass/bandpass/notch filter
-- takes in a a-rate signal, cutoff value in frequency, and
-- Q factor for resonance
--
-- xout alp, abp, ahp, anotch
zdf_2pole_notch :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig)
zdf_2pole_notch :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig)
zdf_2pole_notch Sig
asig Sig
cfq Sig
q = GE [E] -> (Sig, Sig, Sig, Sig)
forall a. Tuple a => GE [E] -> a
toTuple (GE [E] -> (Sig, Sig, Sig, Sig)) -> GE [E] -> (Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ ((Int -> [E]) -> [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Int -> [E]) -> Int -> [E]
forall a b. (a -> b) -> a -> b
$ Int
4) (GE (Int -> [E]) -> GE [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    E -> E -> E -> Int -> [E]
f (E -> E -> E -> Int -> [E]) -> GE E -> GE (E -> E -> Int -> [E])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> Int -> [E]) -> GE E -> GE (E -> Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> Int -> [E]) -> GE E -> GE (Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
q
    where f :: E -> E -> E -> Int -> [E]
f E
asig' E
cfq' E
q' = Name -> Specs -> [E] -> Int -> [E]
mopcs Name
"zdf_2pole_notch" ([Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar], [Rate
Ar, Rate
Ar, Rate
Ar]) [E
asig', E
cfq', E
q']

-- moog ladder
--
-- opcode zdf_ladder, a, akk
--
-- ain, kcf, kres   xin
zdf_ladder :: Sig -> Sig -> Sig -> Sig
zdf_ladder :: Sig -> Sig -> Sig -> Sig
zdf_ladder Sig
asig Sig
cfq Sig
res = GE E -> Sig
forall a. Val a => GE E -> a
fromGE (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    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
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> E) -> GE E -> GE (E -> E)
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> E) -> GE E -> GE E
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
res
    where f :: E -> E -> E -> E
f E
asig' E
cfq' E
res' = Name -> Spec1 -> [E] -> E
opcs Name
"zdf_ladder" [(Rate
Ar, [Rate
Ar, Rate
Ar, Rate
Ar])] [E
asig', E
cfq', E
res']

-- 4-pole
--
-- opcode zdf_4pole, aaaaaa, akk
--   ain, kcf, kres xin
--
-- xout alp2, abp2, ahp2, alp4, abl4, abp4
zdf_4pole :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf_4pole :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf_4pole Sig
asig Sig
cfq Sig
res = GE [E] -> (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. Tuple a => GE [E] -> a
toTuple (GE [E] -> (Sig, Sig, Sig, Sig, Sig, Sig))
-> GE [E] -> (Sig, Sig, Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ ((Int -> [E]) -> [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Int -> [E]) -> Int -> [E]
forall a b. (a -> b) -> a -> b
$ Int
6) (GE (Int -> [E]) -> GE [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    E -> E -> E -> Int -> [E]
f (E -> E -> E -> Int -> [E]) -> GE E -> GE (E -> E -> Int -> [E])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> Int -> [E]) -> GE E -> GE (E -> Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> Int -> [E]) -> GE E -> GE (Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
res
    where f :: E -> E -> E -> Int -> [E]
f E
asig' E
cfq' E
res' = Name -> Specs -> [E] -> Int -> [E]
mopcs Name
"zdf_4pole" ([Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar], [Rate
Ar, Rate
Ar, Rate
Ar]) [E
asig', E
cfq', E
res']

-- 4-pole
--
-- opcode zdf_4pole_hp, aaaaaa, akk
--   ain, kcf, kres xin
--
-- xout alp2, abp2, ahp2, alp4, abl4, abp4
zdf_4pole_hp :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf_4pole_hp :: Sig -> Sig -> Sig -> (Sig, Sig, Sig, Sig, Sig, Sig)
zdf_4pole_hp Sig
asig Sig
cfq Sig
res = GE [E] -> (Sig, Sig, Sig, Sig, Sig, Sig)
forall a. Tuple a => GE [E] -> a
toTuple (GE [E] -> (Sig, Sig, Sig, Sig, Sig, Sig))
-> GE [E] -> (Sig, Sig, Sig, Sig, Sig, Sig)
forall a b. (a -> b) -> a -> b
$ ((Int -> [E]) -> [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Int -> [E]) -> Int -> [E]
forall a b. (a -> b) -> a -> b
$ Int
6) (GE (Int -> [E]) -> GE [E]) -> GE (Int -> [E]) -> GE [E]
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    E -> E -> E -> Int -> [E]
f (E -> E -> E -> Int -> [E]) -> GE E -> GE (E -> E -> Int -> [E])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> Int -> [E]) -> GE E -> GE (E -> Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> Int -> [E]) -> GE E -> GE (Int -> [E])
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
res
    where f :: E -> E -> E -> Int -> [E]
f E
asig' E
cfq' E
res' = Name -> Specs -> [E] -> Int -> [E]
mopcs Name
"zdf_4pole_hp" ([Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar, Rate
Ar], [Rate
Ar, Rate
Ar, Rate
Ar]) [E
asig', E
cfq', E
res']

-- ;; TODO - implement
-- opcode zdf_peak_eq, a, akkk
-- ain, kcf, kres, kdB xin
zdf_peak_eq :: Sig -> Sig -> Sig -> Sig -> Sig
zdf_peak_eq :: Sig -> Sig -> Sig -> Sig -> Sig
zdf_peak_eq Sig
ain Sig
kcf Sig
kres Sig
kdB = GE E -> Sig
forall a. Val a => GE E -> a
fromGE (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    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
forall a. Val a => a -> GE E
toGE Sig
ain GE (E -> E -> E -> E) -> GE E -> GE (E -> E -> E)
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
kcf GE (E -> E -> E) -> GE E -> GE (E -> E)
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
kres GE (E -> E) -> GE E -> GE E
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
kdB
    where f :: E -> E -> E -> E -> E
f E
ain' E
kcf' E
kres' E
kdB' = Name -> Spec1 -> [E] -> E
opcs Name
"zdf_peak_eq" [(Rate
Ar, [Rate
Ar, Rate
Kr, Rate
Kr, Rate
Kr])] [E
ain', E
kcf', E
kres', E
kdB']

-- opcode zdf_high_shelf_eq, a, akk
--  ain, kcf, kdB xin
zdf_high_shelf_eq :: Sig -> Sig -> Sig -> Sig
zdf_high_shelf_eq :: Sig -> Sig -> Sig -> Sig
zdf_high_shelf_eq Sig
asig Sig
cfq Sig
res = GE E -> Sig
forall a. Val a => GE E -> a
fromGE (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    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
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> E) -> GE E -> GE (E -> E)
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> E) -> GE E -> GE E
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
res
    where f :: E -> E -> E -> E
f E
asig' E
cfq' E
res' = Name -> Spec1 -> [E] -> E
opcs Name
"zdf_high_shelf_eq" [(Rate
Ar, [Rate
Ar, Rate
Kr, Rate
Kr])] [E
asig', E
cfq', E
res']

-- opcode zdf_low_shelf_eq, a, akk
--  ain, kcf, kdB xin
zdf_low_shelf_eq :: Sig -> Sig -> Sig -> Sig
zdf_low_shelf_eq :: Sig -> Sig -> Sig -> Sig
zdf_low_shelf_eq Sig
asig Sig
cfq Sig
res = GE E -> Sig
forall a. Val a => GE E -> a
fromGE (GE E -> Sig) -> GE E -> Sig
forall a b. (a -> b) -> a -> b
$ do
    UdoPlugin -> GE ()
addUdoPlugin UdoPlugin
E.zdfPlugin
    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
forall a. Val a => a -> GE E
toGE Sig
asig GE (E -> E -> E) -> GE E -> GE (E -> E)
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
cfq GE (E -> E) -> GE E -> GE E
forall a b. GE (a -> b) -> GE a -> GE b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Sig -> GE E
forall a. Val a => a -> GE E
toGE Sig
res
    where f :: E -> E -> E -> E
f E
asig' E
cfq' E
res' = Name -> Spec1 -> [E] -> E
opcs Name
"zdf_low_shelf_eq" [(Rate
Ar, [Rate
Ar, Rate
Kr, Rate
Kr])] [E
asig', E
cfq', E
res']