Package eu.bandm.sighkn
Class FloatSamplePlayer
java.lang.Object
eu.bandm.sig.adlib.FloatClockedSignalSource
eu.bandm.sighkn.FloatSamplePlayer
- All Implemented Interfaces:
CompilableControlFlow
,CompilableDataFlow
,FloatSignalSource
,FloatSupplier
,Realtime
,SignalSource<Float>
,Runnable
,Supplier<Float>
Pitch calculation:
With "increment==1.0", this code plays one array position in one run-step. The increment must be adjusted according the "recorded pitch" and the "recording sampling rate".
ATTENTION: "phase" is realized as "double" value.
(Backward mode and pingpong mode can be realized by data transformation, currently not supported.)
With "increment==1.0", this code plays one array position in one run-step. The increment must be adjusted according the "recorded pitch" and the "recording sampling rate".
ATTENTION: "phase" is realized as "double" value.
(Backward mode and pingpong mode can be realized by data transformation, currently not supported.)
addSegment (null na. duration) -> play pause of given duration addSegment (float[] 1 na na -> play segment once addSegment (float[] -1 start end -> loop infinite addSegment (float[] n start end -> loop n times, then play tail (or next segment) end_loop(n) --> overwrite loopCount with "n" clear() --> hard delete allCf FloatPfg
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.bandm.sig.adlib.FloatSignalSource
FloatSignalSource.CompilableFloatBinaryOperator, FloatSignalSource.FloatAddOperator, FloatSignalSource.FloatDivOperator, FloatSignalSource.FloatMultOperator, FloatSignalSource.FloatSubOperator
Nested 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
Modifier and TypeFieldDescriptionprotected boolean
protected final float @Opt [][]
protected final float[]
duration of delay.protected final float
protected final int[]
protected final FloatSignalSource
protected int
protected final int[]
-1 for infinitely often; will be changed dynamically later.protected final float
protected double
protected final int
protected int
protected final int[]
start index into data array.protected double
protected final int[]
protected final int
protected int
Fields inherited from class eu.bandm.sig.adlib.FloatClockedSignalSource
out
Fields 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, sub
Fields inherited from interface eu.bandm.sig.adlib.Realtime
DEFAULT_AFAP_INTERRUPT_LATENCY, DEFAULT_SLEEP_TIME_MS
-
Constructor Summary
ConstructorDescriptionFloatSamplePlayer
(float freq, int qSize, int width, FloatSignalSource increment) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_add
(float[] data, float delay, int from, int to, int loopcount) protected boolean
_add
(float[] data, int loopcount) protected void
_noDC()
protected void
checkLoopCount
(int n) void
clear()
void
clear
(float out) protected void
complete()
void
dump()
void
end_loop()
void
end_loop
(int n) Used to replace an infinite loop count with only "n" remaining loops.boolean
play_loop
(float[] data) boolean
play_loop
(float[] data, int from, int to) boolean
play_ntimes
(float[] data, int loopcount) boolean
play_ntimes
(float[] data, int from, int to, int loopcount) boolean
play_once
(float[] data) boolean
play_once
(float[] data, int from, int to) boolean
play_pause
(float duration) void
run()
GLO IN phase points to the next sample to be output, relative to the start of the currently played range.void
set
(float out) void
set_noDC
(boolean n) Setting to "true" means not to output a constant "direct current" value !=0f in pauses and after data end.Methods inherited from class eu.bandm.sig.adlib.FloatClockedSignalSource
delayedBy, delayedWith, doCompileDataFlow, get, getAsFloat, iterate, logged, logged, random, randomNormal, randomUniform, repeat, slide, suppliedBy, suppliedBy, switchOver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.sig.adlib.FloatSignalSource
add, check, clocked, compileDataFlow, div, guard, logger, logger, map, mult, sub, zipWith, zipWith
Methods inherited from interface eu.bandm.sig.adlib.Realtime
afap, afap, andThen, asAsynchronousSwingEvent, compileControlFlow, every, every, frequently, frequently, frequently, times, times
-
Field Details
-
qSize
protected final int qSize -
width
protected final int width -
freq
protected final float freq -
period
protected final float period -
increment
-
_noDC
protected boolean _noDC -
data
-
delay
protected final float[] delayduration of delay. -
start
protected final int[] startstart index into data array. -
from
protected final int[] from -
to
protected final int[] to -
loopcount
protected final int[] loopcount-1 for infinitely often; will be changed dynamically later. -
write
protected int write -
read
protected int read -
index
protected int index -
phase
protected double phase -
time
protected double time
-
-
Constructor Details
-
FloatSamplePlayer
-
-
Method Details
-
run
public void run()GLO IN phase points to the next sample to be output, relative to the start of the currently played range. -
clear
public void clear() -
set
public void set(float out) -
clear
public void clear(float out) -
set_noDC
public void set_noDC(boolean n) Setting to "true" means not to output a constant "direct current" value !=0f in pauses and after data end. -
_noDC
protected void _noDC() -
complete
protected void complete() -
play_pause
public boolean play_pause(float duration) -
play_once
public boolean play_once(float[] data) -
play_once
public boolean play_once(float[] data, int from, int to) -
play_loop
public boolean play_loop(float[] data) -
play_loop
public boolean play_loop(float[] data, int from, int to) -
play_ntimes
public boolean play_ntimes(float[] data, int loopcount) -
play_ntimes
public boolean play_ntimes(float[] data, int from, int to, int loopcount) -
end_loop
public void end_loop() -
end_loop
public void end_loop(int n) Used to replace an infinite loop count with only "n" remaining loops. -
checkLoopCount
protected void checkLoopCount(int n) -
_add
protected boolean _add(float[] data, int loopcount) -
_add
protected boolean _add(float[] data, float delay, int from, int to, int loopcount) -
dump
public void dump()
-