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 all
Cf FloatPfg-
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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final float @Opt [][]protected final float[]duration of delay.protected final floatprotected final int[]protected final FloatSignalSourceprotected intprotected final int[]-1 for infinitely often; will be changed dynamically later.protected final floatprotected doubleprotected final intprotected intprotected final int[]start index into data array.protected doubleprotected final int[]protected final intprotected intFields inherited from class eu.bandm.sig.adlib.FloatClockedSignalSource
outFields 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
ConstructorsConstructorDescriptionFloatSamplePlayer(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 voidcheckLoopCount(int n) voidclear()voidclear(float out) protected voidcomplete()voiddump()voidend_loop()voidend_loop(int n) Used to replace an infinite loop count with only "n" remaining loops.booleanplay_loop(float[] data) booleanplay_loop(float[] data, int from, int to) booleanplay_ntimes(float[] data, int loopcount) booleanplay_ntimes(float[] data, int from, int to, int loopcount) booleanplay_once(float[] data) booleanplay_once(float[] data, int from, int to) booleanplay_pause(float duration) voidrun()GLO IN phase points to the next sample to be output, relative to the start of the currently played range.voidset(float out) voidset_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, switchOverMethods 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, 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()
-