@FunctionalInterface public interface FloatSignalSource extends SignalSource<Float>, FloatSupplier, CompilableDataFlow
float
. The current value of the signal can be observed in real
time, by invoking getAsFloat()
.Modifier and Type | Interface and Description |
---|---|
static class |
FloatSignalSource.CompilableFloatBinaryOperator |
static class |
FloatSignalSource.FloatAddOperator |
static class |
FloatSignalSource.FloatDivOperator |
static class |
FloatSignalSource.FloatMultOperator |
static class |
FloatSignalSource.FloatSubOperator |
SignalSource.AddOperator, SignalSource.CompilableBinaryOperator, SignalSource.Constant<A>, SignalSource.DivOperator, SignalSource.MultOperator, SignalSource.SubOperator
Modifier and Type | Field and Description |
---|---|
static FloatUnaryOperator |
abs |
static FloatBinaryOperator |
add |
static FloatUnaryOperator |
clip |
static FloatUnaryOperator |
cos |
static FloatBinaryOperator |
div |
static float |
E |
static FloatUnaryOperator |
exp |
static FloatUnaryOperator |
log |
static float |
LOG2 |
static Method |
metaGetAsFloat |
static FloatBinaryOperator |
mult |
static FloatUnaryOperator |
neg |
static float |
PI |
static FloatUnaryOperator |
sin |
static FloatUnaryOperator |
sqrt |
static float |
SQRT2 |
static FloatUnaryOperator |
square |
static FloatBinaryOperator |
sub |
Modifier and Type | Method and Description |
---|---|
default FloatSignalSource |
add(FloatSignalSource other) |
default FloatSignalSource |
check(String where,
float min,
float max) |
static float |
clip(float x) |
default FloatClockedSignalSource |
clocked(Realtime... slaves)
Creates a wrapper that emits clocked snapshots of values of the
signal emitted by this object.
|
default <V,L> void |
compileDataFlow(CompilationContext<V,L> context) |
static FloatSignalSource |
constant(float value)
Creates an object that emits a constant signal.
|
default FloatSignalSource |
div(FloatSignalSource other) |
default Float |
get()
Deprecated.
The default implementation boxes every value of type
float into an object of class Float . |
float |
getAsFloat()
Returns the current value of the signal.
|
default BooleanSignalSource |
guard(FloatPredicate pred) |
default Realtime |
logger(String name)
Creates a proxy that reacts to clock events by printing the
signal value emitted by this object.
|
default Realtime |
logger(String name,
PrintStream out)
Creates a proxy that reacts to clock events by printing the
signal value emitted by this object.
|
static FloatUnaryOperator |
lowerLogSpread(float halfValue,
float maxValue)
A function that maps the interval [0, 1] logarithmically to some
interval of the form [±∞, a].
|
default FloatSignalSource |
map(FloatUnaryOperator op)
Creates a wrapper that emits a signal obtained by applying a
given function to the current value of the signal emitted by this
object.
|
default FloatSignalSource |
mult(FloatSignalSource other) |
static FloatSignalSource[] |
project(float... array) |
static FloatSignalSource |
project(float[] array,
int index)
Creates a signal source that yields the current value of a
specified array element.
|
static float |
project(float value,
float min,
float max,
float outmin,
float outmax)
Projects the position of the input value between min and max to the
same position between outmin and outmax.
|
default FloatSignalSource |
sub(FloatSignalSource other) |
static FloatUnaryOperator |
upperLogSpread(float minValue,
float halfValue)
A function that maps the interval [0, 1] logarithmically to some
interval of the form [a, ±∞].
|
default FloatSignalSource |
zipWith(FloatBinaryOperator op,
FloatSignalSource other)
Creates a wrapper that emits a signal obtained by applying a
given function to the current values of the signals emitted by
this object and another object.
|
default FloatSignalSource |
zipWith(FloatTernaryOperator op,
FloatSignalSource second,
FloatSignalSource third) |
static final float PI
static final float LOG2
static final float E
static final float SQRT2
static final FloatUnaryOperator neg
static final FloatUnaryOperator abs
static final FloatUnaryOperator square
static final FloatUnaryOperator sqrt
static final FloatUnaryOperator sin
static final FloatUnaryOperator cos
static final FloatUnaryOperator exp
static final FloatUnaryOperator log
static final FloatUnaryOperator clip
static final FloatBinaryOperator add
static final FloatBinaryOperator sub
static final FloatBinaryOperator mult
static final FloatBinaryOperator div
static final Method metaGetAsFloat
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 FloatSupplier
@Deprecated default Float get()
float
into an object of class Float
.static FloatSignalSource constant(float value)
constant
in interface SignalSource<Float>
value
- the desired signal value.value
.default FloatClockedSignalSource clocked(Realtime... slaves)
this.getAsFloat()
at the immediately preceding clock
event.default FloatSignalSource map(FloatUnaryOperator op)
The function value is computed each time the result signal is
observed. If the invocation of the function is costly or
otherwise time-sensitive, it is recommended to protect it with a
clocked(eu.bandm.sig.adlib.Realtime...)
wrapper, and trigger computations by explicit
clock events.
op
- the function to apply to each value.op.applyAsFloat(this.getAsFloat())
.IllegalArgumentException
- if op == null
.default BooleanSignalSource guard(FloatPredicate pred)
default FloatSignalSource zipWith(FloatBinaryOperator op, FloatSignalSource other)
The function value is computed each time the result signal is
observed. If the invocation of the function is costly or
otherwise time-sensitive, it is recommended to protect it with a
clocked(eu.bandm.sig.adlib.Realtime...)
wrapper, and trigger computations by explicit
clock events.
op
- the function to apply to each value.other
- the emitter of the other signal.op.applyAsFloat(this.getAsFloat(), other.getAsFloat())
.IllegalArgumentException
- if op == null
or other == null
.default FloatSignalSource zipWith(FloatTernaryOperator op, FloatSignalSource second, FloatSignalSource third)
default FloatSignalSource check(String where, float min, float max)
static float clip(float x)
default Realtime logger(String name)
name
- the name to associate with the current signal value
in logging output, or null
for anonymous output.FloatClockedSignalSource.logged(String)
default Realtime logger(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
.logger(String, PrintStream)
static float project(float value, float min, float max, float outmin, float outmax)
static FloatUnaryOperator upperLogSpread(float minValue, float halfValue)
minValue
- the function value at 0
.halfValue
- the function value at 0.5
.static FloatUnaryOperator lowerLogSpread(float halfValue, float maxValue)
halfValue
- the function value at 0.5
.maxValue
- the function value at 1
.default <V,L> void compileDataFlow(CompilationContext<V,L> context)
compileDataFlow
in interface CompilableDataFlow
static FloatSignalSource project(float[] array, int index)
array
- the array containing the elementindex
- the index of the elementarray[index]
IllegalArgumentException
- if array == null
, or
index
is out of rangestatic FloatSignalSource[] project(float... array)
default FloatSignalSource add(FloatSignalSource other)
default FloatSignalSource sub(FloatSignalSource other)
default FloatSignalSource mult(FloatSignalSource other)
default FloatSignalSource div(FloatSignalSource other)