module Synthesizer.Dimensional.Abstraction.Homogeneous where
import qualified Synthesizer.State.Signal as Sig
import qualified Synthesizer.Dimensional.RatePhantom as RP
import qualified Synthesizer.Dimensional.Straight.Signal as SigS
import qualified Synthesizer.Dimensional.Amplitude.Signal as SigA
import qualified Synthesizer.Dimensional.Amplitude as Amp
processSamples :: C sig =>
(Sig.T y0 -> Sig.T y1) -> RP.T s sig y0 -> RP.T s sig y1
processSamples f =
RP.fromSignal . unwrappedProcessSamples f . RP.toSignal
processSampleList :: C sig =>
([y0] -> [y1]) ->
RP.T s sig y0 ->
RP.T s sig y1
processSampleList f =
processSamples (Sig.fromList . f . Sig.toList)
class C sig where
unwrappedProcessSamples :: (Sig.T y0 -> Sig.T y1) -> sig y0 -> sig y1
instance C Sig.T where
unwrappedProcessSamples f = f
instance C sig => C (SigS.T sig) where
unwrappedProcessSamples f =
SigS.processSamplesPrivate (unwrappedProcessSamples f)
instance (C sig, Amp.C amp) => C (SigA.T amp sig) where
unwrappedProcessSamples f =
(\(SigA.Cons amp sig) ->
SigA.Cons amp (unwrappedProcessSamples f sig))