|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jaer.JAERViewer.SyncPlayer
public class JAERViewer.SyncPlayer
Synchronized playback and control of such playback is not totally straightforward because of the bursty nature of AER - there are no frames to synchronize on and you obviously cannot sync on event number.
This class sychronizes multiple viewer players. It assumes one is the master (whichever the user controls) and coordinates viewers synchrnously so that all viewers can present a consistent view.
To achieve this, each viewer encapsulates its playback functionality on an AEPlayer inner class instance that is controlled either by the Viewer GUI (the user) or by JAERViewer through its own SyncPlayer. The Players share a common interface so this is achieved by returning the correct object within AEViewer depending on whether the views are synchronized.
The individual threads doing the rendering in each AEViewer are barricaded by the CyclicBarrier here. Each time an AEViewer asks for synchronized events, the call here to SyncPlayer blocks until all threads asking for events have gotten them. Then rendering in each thread happens normally.
Constructor Summary | |
---|---|
JAERViewer.SyncPlayer()
|
Method Summary | |
---|---|
void |
doSingleStep(AEViewer viewer)
|
AEFileInputStream |
getAEInputStream()
always returns null, bince this is a sync player for multiple viewers |
float |
getFractionalPosition()
|
AEPacketRaw |
getNextPacket()
|
AEPacketRaw |
getNextPacket(AEPlayerInterface player)
returns next packet of AE data to the caller, which is a particular AEPlayer inner class of AEViewer. |
int |
getSampleNumEvents()
|
int |
getSamplePeriodUs()
|
int |
getTime()
Return time in us in player |
boolean |
isChoosingFile()
returns true if user is choosing a file |
boolean |
isPaused()
returns true if the viewers are paused |
boolean |
isPlayingForwards()
|
void |
mark()
|
void |
openAEInputFileDialog()
this call shows a file chooser for index files: files containing information on which AE data files go together |
void |
pause()
pauses all players |
int |
position()
|
int |
position(AEFileInputStreamInterface stream)
|
void |
position(int event,
AEFileInputStreamInterface stream)
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
JAERViewer gets PropertyChangeEvent from the AEPlayer in the AEViewers. |
AEPacketRaw |
readPacketByNumber(int n)
|
AEPacketRaw |
readPacketByNumber(int n,
AEFileInputStreamInterface stream)
|
AEPacketRaw |
readPacketByTime(int dt)
|
AEPacketRaw |
readPacketByTime(int dt,
AEFileInputStreamInterface stream)
|
void |
resume()
resumes all players |
void |
rewind()
rewinds all players |
void |
setFractionalPosition(float frac)
|
void |
setPaused(boolean yes)
pauses/unpauses all viewers |
void |
setSampleNumEvents(int sampleNumEvents)
|
void |
setSamplePeriodUs(int samplePeriodUs)
|
void |
setTime(int time)
Sets all viewers to the same time. |
long |
size()
|
long |
size(AEFileInputStream stream)
|
void |
slowDown()
|
void |
speedUp()
|
void |
startPlayback(java.io.File indexFile)
this call starts playback on the supplied index file, starting playback in each viewer appropriately. |
void |
stopPlayback()
stops playback on all players |
void |
toggleDirection()
|
void |
unmark()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JAERViewer.SyncPlayer()
Method Detail |
---|
public boolean isChoosingFile()
PlayerInterface
isChoosingFile
in interface PlayerInterface
public void openAEInputFileDialog()
openAEInputFileDialog
in interface AEPlayerInterface
public void startPlayback(java.io.File indexFile) throws java.io.IOException
startPlayback
in interface PlayerInterface
indexFile
- the .index file containing the filenames to play
java.io.IOException
public void stopPlayback()
stopPlayback
in interface PlayerInterface
public void rewind()
rewind
in interface PlayerInterface
public void pause()
pause
in interface PlayerInterface
public void resume()
resume
in interface PlayerInterface
public boolean isPaused()
isPaused
in interface PlayerInterface
public void setPaused(boolean yes)
setPaused
in interface PlayerInterface
public AEPacketRaw getNextPacket(AEPlayerInterface player)
getNextPacket
in interface AEPlayerInterface
public void toggleDirection()
toggleDirection
in interface PlayerInterface
public void speedUp()
speedUp
in interface AEPlayerInterface
public void slowDown()
slowDown
in interface AEPlayerInterface
public boolean isPlayingForwards()
isPlayingForwards
in interface PlayerInterface
public float getFractionalPosition()
public void mark() throws java.io.IOException
mark
in interface PlayerInterface
java.io.IOException
public int position(AEFileInputStreamInterface stream)
public int position()
public void position(int event, AEFileInputStreamInterface stream)
public AEPacketRaw readPacketByNumber(int n) throws java.io.IOException
java.io.IOException
public AEPacketRaw readPacketByNumber(int n, AEFileInputStreamInterface stream) throws java.io.IOException
java.io.IOException
public AEPacketRaw readPacketByTime(int dt) throws java.io.IOException
java.io.IOException
public AEPacketRaw readPacketByTime(int dt, AEFileInputStreamInterface stream) throws java.io.IOException
java.io.IOException
public long size(AEFileInputStream stream)
public long size()
public void unmark()
unmark
in interface PlayerInterface
public void setFractionalPosition(float frac)
public void setTime(int time)
setTime
in interface PlayerInterface
time
- current playback time relative to start in uspublic int getTime()
PlayerInterface
getTime
in interface PlayerInterface
public AEPacketRaw getNextPacket()
getNextPacket
in interface AEPlayerInterface
public int getSamplePeriodUs()
getSamplePeriodUs
in interface AEPlayerInterface
public void setSamplePeriodUs(int samplePeriodUs)
public int getSampleNumEvents()
getSampleNumEvents
in interface AEPlayerInterface
public void setSampleNumEvents(int sampleNumEvents)
public AEFileInputStream getAEInputStream()
getAEInputStream
in interface AEPlayerInterface
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public void doSingleStep(AEViewer viewer)
|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |