use super::Signal;
pub trait SignalMulAmp: Signal {
fn mul_amp<O>(self, other: O) -> MulAmp<Self, O>
where
Self: Sized,
O: Signal,
{
MulAmp {
signal: self,
other,
}
}
}
impl<T> SignalMulAmp for T where T: Signal {}
#[derive(Clone)]
pub struct MulAmp<S, O>
where
S: Signal,
O: Signal,
{
signal: S,
other: O,
}
impl<S, O> Signal for MulAmp<S, O>
where
S: Signal,
O: Signal,
{
#[inline]
fn next(&mut self) -> f32 {
self.signal.next() * self.other.next()
}
}