Package eu.bandm.sig.adlib
Class FloatClockedSignalSource
java.lang.Object
eu.bandm.sig.adlib.FloatClockedSignalSource
- All Implemented Interfaces:
CompilableControlFlow,CompilableDataFlow,FloatSignalSource,FloatSupplier,Realtime,SignalSource<Float>,Runnable,Supplier<Float>
- Direct Known Subclasses:
Apdsr,DataLineSource,FloatCounter,FloatDelay,FloatIntegralLimited,FloatOscillator,FloatPfg,FloatResonator,FloatRingBuffer,FloatSamplePlayer,FloatSlider,FloatSlopeLimiter,FloatTwoTablesOscillator,Monodic_FM,Monodic_Table,TApdsr
public abstract class FloatClockedSignalSource
extends Object
implements FloatSignalSource, SignalSource<Float>, Realtime
Abstract base class for objects that emit a signal of type
float, which attains new values only at clock events.
Note that object creation is not a clock event; whether instances of this class have a meaningful signal value depends on the particular subclass.
Subclasses must implement the method Realtime.run(), which should
set the field out to a new value.
ATTENTION: This implements SignalSource, which defines the method
get() for the boxed result.
But it is not a subclass of ClockedSignalSource, because
this would also add a boxed field named , which is not useful for the fast and
dedicated way of operation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.bandm.sig.adlib.FloatSignalSource
FloatSignalSource.CompilableFloatBinaryOperator, FloatSignalSource.FloatAddOperator, FloatSignalSource.FloatDivOperator, FloatSignalSource.FloatMultOperator, FloatSignalSource.FloatSubOperatorNested classes/interfaces inherited from interface eu.bandm.sig.adlib.SignalSource
SignalSource.AddOperator, SignalSource.CompilableBinaryOperator, SignalSource.Constant<A>, SignalSource.DivOperator, SignalSource.MultOperator, SignalSource.SubOperator -
Field Summary
FieldsFields inherited from interface eu.bandm.sig.adlib.FloatSignalSource
abs, add, clip, cos, div, E, exp, log, LOG2, metaGetAsFloat, mult, neg, PI, sin, sqrt, SQRT2, square, subFields inherited from interface eu.bandm.sig.adlib.Realtime
DEFAULT_AFAP_INTERRUPT_LATENCY, DEFAULT_SLEEP_TIME_MS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new instance with no specified initial value.protectedFloatClockedSignalSource(float init) Creates a new instance with the given initial value. -
Method Summary
Modifier and TypeMethodDescriptiondelayedBy(int length) Creates a wrapper that emits the same sequence of values as this object, but delayed by the given number of clock events.delayedWith(float... initialValues) Creates a wrapper that emits the same sequence of values as this object, but delayed by a given number of clock events, prepending the given initial values.protected final <V,L> void doCompileDataFlow(CompilationContext<V, L> context) final Floatget()Deprecated.final floatReturns the current value of the signal.static FloatClockedSignalSourceiterate(FloatUnaryOperator op, float initial) Creates a wrapper that emits the same signal values as this object, but produces a logging output as side effect on each clock event.logged(String name, PrintStream out) Creates a wrapper that emits the same signal values as this object, but produces a logging output as side effect on each clock event.static FloatClockedSignalSourcerandom(ToFloatFunction<Random> fun) static FloatClockedSignalSourcestatic FloatClockedSignalSourcestatic FloatClockedSignalSourcerepeat(float... table) Creates an object that emits a given sequence of values, proceeding cyclically at each clock event.static FloatClockedSignalSourceslide(float sampleFreq, float duration) Creates an object that emits a signal rising at clock events in equal steps from0to1, with a given slope.static FloatClockedSignalSourcesuppliedBy(float init, FloatSupplier step) static FloatClockedSignalSourcesuppliedBy(FloatSupplier supplier) switchOver(int countdown, FloatClockedSignalSource next) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.bandm.sig.adlib.FloatSignalSource
add, check, clocked, compileDataFlow, div, guard, logger, logger, map, mult, sub, zipWith, zipWithMethods inherited from interface eu.bandm.sig.adlib.Realtime
afap, afap, andThen, asAsynchronousSwingEvent, compileControlFlow, every, every, frequently, frequently, frequently, run, times, times
-
Field Details
-
out
protected float outThe current value.
-
-
Constructor Details
-
FloatClockedSignalSource
protected FloatClockedSignalSource()Creates a new instance with no specified initial value. -
FloatClockedSignalSource
protected FloatClockedSignalSource(float init) Creates a new instance with the given initial value.- Parameters:
init- the initial value.
-
-
Method Details
-
getAsFloat
public final float getAsFloat()Returns the current value of the signal.Any implementation of this method should be stateless; its invocation should not have any side effect on the emitter or the observer, except for real time passing until its completion.
- Specified by:
getAsFloatin interfaceFloatSignalSource- Specified by:
getAsFloatin interfaceFloatSupplier- Returns:
- the current value of
out.
-
get
Deprecated.Returns the current value of the signal.- Specified by:
getin interfaceFloatSignalSource- Specified by:
getin interfaceSignalSource<Float>- Specified by:
getin interfaceSupplier<Float>- Returns:
- the current value of
out.
-
suppliedBy
-
suppliedBy
-
delayedBy
Creates a wrapper that emits the same sequence of values as this object, but delayed by the given number of clock events. The prepended initial values are not specified.- Parameters:
length- the number of clock events to delay each signal value.- Returns:
- a wrapper that emits the same sequence of values as this
object, delayed by
(length)clock events. - Throws:
IllegalArgumentException- iflength < 0.
-
delayedWith
Creates a wrapper that emits the same sequence of values as this object, but delayed by a given number of clock events, prepending the given initial values.- Parameters:
initial- the number of clock events to delay each signal value.- Returns:
- a wrapper that emits the same sequence of values as this
object, but with
initialValuesprepended. - Throws:
IllegalArgumentException- ifinitialValues == null.
-
logged
Creates a wrapper that emits the same signal values as this object, but produces a logging output as side effect on each clock event.- Parameters:
name- the name to associate with the current signal value in logging output, ornullfor anonymous output.- See Also:
-
logged
Creates a wrapper that emits the same signal values as this object, but produces a logging output as side effect on each clock event.- Parameters:
name- the name to associate with the current signal value in logging output, ornullfor anonymous output.out- the output stream to use for logging.- Throws:
IllegalArgumentException- ifout == null.- See Also:
-
repeat
Creates an object that emits a given sequence of values, proceeding cyclically at each clock event.- Parameters:
table- an array of the values to attain cyclically- Returns:
- an object that attains the value
table[(n - 1) % table.length]at then-th clock event.
-
iterate
-
slide
Creates an object that emits a signal rising at clock events in equal steps from0to1, with a given slope.- Parameters:
sampleFreq- the number of clock events per time unit.duration- the length of the rise in time units.- Returns:
- an object that emits a signal that is
0at the first clock event, rises to1in(duration * sampleFreq)steps, and remains1afterwards.
-
switchOver
-
doCompileDataFlow
-
random
-
randomUniform
-
randomNormal
-