module Csound.Typed.InnerOpcodes(
    changed
) where

import Csound.Typed.Types.Prim
import Csound.Dynamic

-- | This opcode outputs a trigger signal that informs when any one of its k-rate 
-- arguments has changed. Useful with valuator widgets or MIDI controllers.
--
-- > ktrig changed kvar1 [, kvar2,..., kvarN]
--
-- doc: <http://www.csounds.com/manual/html/changed.html>
changed :: [Sig] -> Sig
changed :: [Sig] -> Sig
changed = GE E -> Sig
Sig (GE E -> Sig) -> ([Sig] -> GE E) -> [Sig] -> Sig
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([E] -> E) -> GE [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 [E] -> E
f (GE [E] -> GE E) -> ([Sig] -> GE [E]) -> [Sig] -> GE E
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sig -> GE E) -> [Sig] -> GE [E]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM Sig -> GE E
forall a. Val a => a -> GE E
toGE
    where f :: [E] -> E
f = Name -> Spec1 -> [E] -> E
opcs Name
"changed" [(Rate
Kr, Rate -> [Rate]
forall a. a -> [a]
repeat Rate
Kr)]