Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
Signal analysis.
- diff :: forall a m. (Eq a, Monad m) => Wire m a (a, Time)
- avg :: forall m v. (Fractional v, Monad m, NFData v, Unbox v) => Int -> Wire m v v
- avgAll :: forall m v. (Fractional v, Monad m, NFData v) => Wire m v v
- avgFps :: forall a m. Monad m => Int -> Wire m a Double
- collect :: forall a m. (Ord a, Monad m) => Wire m a (Set a)
- lastSeen :: forall a m. (Ord a, Monad m) => Wire m a Time
- highPeak :: (Monad m, NFData a, Ord a) => Wire m a a
- lowPeak :: (Monad m, NFData a, Ord a) => Wire m a a
- peakBy :: forall a m. (Monad m, NFData a) => (a -> a -> Ordering) -> Wire m a a
Changes
diff :: forall a m. (Eq a, Monad m) => Wire m a (a, Time)Source
Emits an event, whenever the input signal changes. The event contains the last input value and the time elapsed since the last change.
Inhibits on no change.
Statistics
Average
avg :: forall m v. (Fractional v, Monad m, NFData v, Unbox v) => Int -> Wire m v vSource
Calculate the average of the signal over the given number of last samples. This wire has O(n) space complexity and O(1) time complexity.
If you need an average over all samples ever produced, consider using
avgAll
instead.
Never inhibits. Feedback by delay.
avgAll :: forall m v. (Fractional v, Monad m, NFData v) => Wire m v vSource
Calculate the average of the signal over all samples.
Please note that somewhat surprisingly this wire runs in constant
space and is generally faster than avg
, but most applications will
benefit from averages over only the last few samples.
Never inhibits. Feedback by delay.
avgFps :: forall a m. Monad m => Int -> Wire m a DoubleSource
Calculate the average number of frames per virtual second for the last given number of frames.
Please note that this wire uses the clock, which you give the network using the stepping functions in FRP.NetWire.Session. If this clock doesn't represent real time, then the output of this wire won't either.
Never inhibits.
Misc
collect :: forall a m. (Ord a, Monad m) => Wire m a (Set a)Source
Collects all the inputs ever received. This wire uses O(n) memory and runs in O(log n) time, where n is the number of inputs collected so far.
Never inhibits. Feedback by delay.
lastSeen :: forall a m. (Ord a, Monad m) => Wire m a TimeSource
Returns the time delta between now and when the input signal was last seen. This wire uses O(n) memory and runs in O(log n) time, where n is the number of inputs collected so far.
Inhibits, when a signal is seen for the first time.
Peak
highPeak :: (Monad m, NFData a, Ord a) => Wire m a aSource
Return the high peak.
Never inhibits. Feedback by delay.