module Synthesizer.Dimensional.Amplitude.Control (
constant, constantVector,
piecewiseConstantGeneric,
piecewiseConstantStorable,
) where
import qualified Synthesizer.Dimensional.Signal.Private as SigA
import qualified Synthesizer.PiecewiseConstant.Signal as PC
import qualified Synthesizer.PiecewiseConstant.Generic as PCG
import qualified Synthesizer.PiecewiseConstant.Storable as PCSt
import qualified Synthesizer.State.Control as Ctrl
import qualified Synthesizer.Generic.Signal as SigG
import qualified Synthesizer.Storable.Signal as SigSt
import Foreign.Storable (Storable)
import qualified Number.DimensionTerm as DN
import qualified Algebra.DimensionTerm as Dim
import qualified Algebra.Absolute as Absolute
import NumericPrelude.Base as P
import Prelude ()
constant :: (Absolute.C y, Dim.C u) =>
DN.T u y
-> SigA.R s u y y
constant =
uncurry constantVector .
DN.absSignum
constantVector ::
DN.T u y
-> yv
-> SigA.R s u y yv
constantVector y yv =
SigA.fromBody y (Ctrl.constant yv)
piecewiseConstantGeneric ::
(SigG.Write sig y) =>
SigA.T rate amp (PC.T y) ->
SigA.T rate amp (sig y)
piecewiseConstantGeneric =
SigA.processBody PCG.toSignal
piecewiseConstantStorable ::
(Storable y) =>
SigA.T rate amp (PC.T y) ->
SigA.T rate amp (SigSt.T y)
piecewiseConstantStorable =
SigA.processBody PCSt.toSignal