|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.frinika.audio.Voice
com.frinika.audio.voicetemplate.SynchronizedVoice
public abstract class SynchronizedVoice
A voice that can be synchronized from an outside timing source. Useful for e.g. audio playback to be synchronized with a sequencer.
Field Summary | |
---|---|
protected VoiceServer |
voiceServer
|
Fields inherited from class com.frinika.audio.Voice |
---|
interrupts, nextVoice, startFramePos |
Constructor Summary | |
---|---|
SynchronizedVoice(VoiceServer voiceServer,
long initialFramePos)
Construct a new Synchronized Voice. |
Method Summary | |
---|---|
void |
fillBuffer(int startBufferPos,
int endBufferPos,
float[] buffer)
This is where the raw audio data should be produced. |
abstract void |
fillBufferSynchronized(int startBufferPos,
int endBufferPos,
float[] buffer)
|
protected long |
getFramePos()
Call this method from fillBufferSynchronized to get the framePos according to the external timing source |
protected int |
getMissedFrames()
Call this method from fillBufferSynchronized to get the number of missing frames (glitch) after an external sync notification NOTE: Your tolerance on missed frames should not be too low - since timing functions like System.currentTimeMillis might slide up to 50 ms on some systems. |
int |
getMissedFramesToleranceMillis()
Number of milliseconds of glitch before synchronization if enforced |
void |
setFramePos(long framePos)
The external timing source should regularly notify with the current frame position here |
void |
setMissedFramesToleranceMillis(int missedFramesToleranceMillis)
Set number of milliseconds of glitch before synchronization if enforced |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected VoiceServer voiceServer
Constructor Detail |
---|
public SynchronizedVoice(VoiceServer voiceServer, long initialFramePos)
voiceServer
- initialFramePos
- - the initial position of playback start - relative to audio clip startMethod Detail |
---|
public int getMissedFramesToleranceMillis()
public void setMissedFramesToleranceMillis(int missedFramesToleranceMillis)
missedFramesToleranceMillis
- public void setFramePos(long framePos)
framePos
- protected final long getFramePos()
protected final int getMissedFrames()
public final void fillBuffer(int startBufferPos, int endBufferPos, float[] buffer)
Voice
fillBuffer
in class Voice
public abstract void fillBufferSynchronized(int startBufferPos, int endBufferPos, float[] buffer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |