public abstract class FloatClockedSignalSource extends Object implements FloatSignalSource, SignalSource<Float>, Realtime
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.
FloatSignalSource.CompilableFloatBinaryOperator, FloatSignalSource.FloatAddOperator, FloatSignalSource.FloatDivOperator, FloatSignalSource.FloatMultOperator, FloatSignalSource.FloatSubOperatorSignalSource.AddOperator, SignalSource.CompilableBinaryOperator, SignalSource.Constant<A>, SignalSource.DivOperator, SignalSource.MultOperator, SignalSource.SubOperator| Modifier and Type | Field and Description |
|---|---|
protected float |
out
The current value.
|
abs, add, clip, cos, div, E, exp, log, LOG2, metaGetAsFloat, mult, neg, PI, sin, sqrt, SQRT2, square, subDEFAULT_AFAP_INTERRUPT_LATENCY, DEFAULT_SLEEP_TIME_MS| Modifier | Constructor and Description |
|---|---|
protected |
FloatClockedSignalSource()
Creates a new instance with no specified initial value.
|
protected |
FloatClockedSignalSource(float init)
Creates a new instance with the given initial value.
|
| Modifier and Type | Method and Description |
|---|---|
FloatClockedSignalSource |
delayedBy(int length)
Creates a wrapper that emits the same sequence of values as this
object, but delayed by the given number of clock events.
|
FloatClockedSignalSource |
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 <V,L> void |
doCompileDataFlow(CompilationContext<V,L> context) |
Float |
get()
Deprecated.
|
float |
getAsFloat()
Returns the current value of the signal.
|
static FloatClockedSignalSource |
iterate(FloatUnaryOperator op,
float initial) |
Realtime |
logged(String name)
Creates a wrapper that emits the same signal values as this
object, but produces a logging output as side effect on each
clock event.
|
Realtime |
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 FloatClockedSignalSource |
random(ToFloatFunction<Random> fun) |
static FloatClockedSignalSource |
randomNormal() |
static FloatClockedSignalSource |
randomUniform() |
static FloatClockedSignalSource |
repeat(float... table)
Creates an object that emits a given sequence of values,
proceeding cyclically at each clock event.
|
static FloatClockedSignalSource |
slide(float sampleFreq,
float duration)
Creates an object that emits a signal rising at clock events in
equal steps from
0 to 1, with a given slope. |
static FloatClockedSignalSource |
suppliedBy(float init,
FloatSupplier step) |
static FloatClockedSignalSource |
suppliedBy(FloatSupplier supplier) |
FloatClockedSignalSource |
switchOver(int countdown,
FloatClockedSignalSource next) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, check, clip, clocked, compileDataFlow, constant, div, guard, logger, logger, lowerLogSpread, map, mult, project, project, project, sub, upperLogSpread, zipWith, zipWithadHoc, afap, afap, andThen, asAsynchronousSwingEvent, compileControlFlow, every, every, frequently, frequently, frequently, run, sequence, times, timesprotected FloatClockedSignalSource()
protected FloatClockedSignalSource(float init)
init - the initial value.public final float getAsFloat()
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.
getAsFloat in interface FloatSignalSourcegetAsFloat in interface FloatSupplierout.@Deprecated public final Float get()
get in interface FloatSignalSourceget in interface SignalSource<Float>get in interface Supplier<Float>out.public static FloatClockedSignalSource suppliedBy(FloatSupplier supplier)
public static FloatClockedSignalSource suppliedBy(float init, FloatSupplier step)
public FloatClockedSignalSource delayedBy(int length)
length - the number of clock events to delay each signal
value.(length) clock events.IllegalArgumentException - if length < 0.public FloatClockedSignalSource delayedWith(float... initialValues)
initial - the number of clock events to delay each signal
value.initialValues prepended.IllegalArgumentException - if initialValues == null.public Realtime logged(String name)
name - the name to associate with the current signal value
in logging output, or null for anonymous output.FloatSignalSource.logger(String)public Realtime logged(String name, PrintStream out)
name - the name to associate with the current signal value
in logging output, or null for anonymous output.out - the output stream to use for logging.IllegalArgumentException - if out == null.FloatSignalSource.logger(String, PrintStream)public static FloatClockedSignalSource repeat(float... table)
table - an array of the values to attain cyclicallytable[(n - 1) %
table.length] at the n-th clock event.public static FloatClockedSignalSource iterate(FloatUnaryOperator op, float initial)
public static FloatClockedSignalSource slide(float sampleFreq, float duration)
0 to 1, with a given slope.sampleFreq - the number of clock events per time unit.duration - the length of the rise in time units.0 at the
first clock event, rises to 1 in (duration *
sampleFreq) steps, and remains 1 afterwards.public FloatClockedSignalSource switchOver(int countdown, FloatClockedSignalSource next)
protected final <V,L> void doCompileDataFlow(CompilationContext<V,L> context)
public static FloatClockedSignalSource random(ToFloatFunction<Random> fun)
public static FloatClockedSignalSource randomUniform()
public static FloatClockedSignalSource randomNormal()