player
Class JAFramesPlayer

java.lang.Object
  extended by player.JAFramesPlayer
All Implemented Interfaces:
AvatarEventHandler
Direct Known Subclasses:
JALoadingPlayer

public class JAFramesPlayer
extends java.lang.Object
implements AvatarEventHandler

A JAFramesPlayer provides a Java ARP avatar canvas together with the capability of playing sequences of CAS animation frames on that avatar.


Field Summary
static int SZ_CAM_DATA
          Length of the camera-settings data array.
 
Constructor Summary
JAFramesPlayer(JAOptions jopts, JACanvasEmbedder embedder)
          Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options and canvas-embedder, but with no avatar-event handler, no player-event handler, no speed provider, and with the player's cyclic-play and "single-sign" flags both initially false.
JAFramesPlayer(JAOptions jopts, JACanvasEmbedder embedder, AvatarEventHandler aehdlr, JAPlayerEventHandler pehdlr, SpeedProvider sp)
          Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, avatar-event handler, player-event handler, speed provider, and with the player's cyclic-play and "single-sign" flags both initially false.
JAFramesPlayer(JAOptions jopts, JACanvasEmbedder embedder, AvatarEventHandler aehdlr, JAPlayerEventHandler pehdlr, SpeedProvider sp, boolean cyclic, boolean onesign)
          Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, avatar-event handler, player-event handler, speed provider, and with the given initial settings of the player's cyclic-play and "single-sign" flags.
 
Method Summary
 void avatarIsLoaded(java.lang.String avatar)
          Handler for the avatar-loaded event generated by our view: sets up a camera controller for the view, and forwards the event to this player's own handler if it has one.
 void avatarIsUnloaded(java.lang.String avatar)
          Handler for the avatar-unloaded event generated by our view: updates the preferences with the camera settings, and forwards the event to this player's own handler if it has one.
 void awaitPlayerInactive()
          Delays until this player is inactive.
 void clearAnimation()
          Detaches its current animation, if any, from this player.
 int countFrames()
          Returns the number of frames in the currently loaded animation, or 0 if there is none.
 int countSigns()
          Returns the number of signs in the currently loaded animation, or -1 if there are none.
 void createStandardCameraChangeMonitor()
          Creates a standard camera change monitor implementation attached to this player.
 AnimatedSign currentSign()
          Returns the current sign for this player's animation scan, or null if the player currently has no animation scan.
 void ensureAnimationIsComplete()
          Ensures that if this player has an animation then the animation is completely loaded.
 void framePlayFinishes()
          Responds to the completion of a single frame play operation.
 void framePlayStarts()
          Responds to the start of a single frame play operation.
 SiGMLAnimation getAnimation()
          Returns the animation currently associated with this player if there is one, or null otherwise.
 FrameIndexScanAccess getFrameIndexAccess()
           
 boolean hasAnimationData()
          Returns a flag value indicating whether or not this player has a playable animation loaded.
 SignStatusRecord makeSignStatusRecord()
          Returns a new SignStatusRecord associated with this player's animation scan if it has one; otherwise returns null.
 boolean playerIsActive()
          Indicates whether this player is currently active.
 void requestSwitchAvatar(java.lang.String avatar)
          Initiates loading of the specified avatar into this player's JA view.
 void resumePlaying()
          Resumes the playing of this player's animation after an earlier suspension, or logs a message if there was no earlier suspension.
 void sequencePlayFinishes()
          Responds to the completion of a sequence play operation.
 void sequencePlayStarts()
          Responds to the start of a sequence play operation.
 void setAnimation(SiGMLAnimation anim)
          Sets the given animation sequence to be the current one for this player.
 void setCyclicPlay(boolean cyclic)
          Sets this player's cyclic-play flag to the given value.
 void setSingleSignPlay(boolean single)
          Sets this player's single-sign flag to the given value.
 void showFrame(int F)
          Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so.
 void showFrame(int f, SignStatusRecord ss)
          Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so; the given status record is updated accordingly.
 void startPlaying()
          Starts playing this player's current animation.
 void stopPlaying()
          Aborts this player's current animation, if any.
 void suspendPlaying()
          Suspends this player's current animation, if any.
 void terminate()
          Terminates this player and its display.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SZ_CAM_DATA

public static final int SZ_CAM_DATA
Length of the camera-settings data array.

See Also:
Constant Field Values
Constructor Detail

JAFramesPlayer

public JAFramesPlayer(JAOptions jopts,
                      JACanvasEmbedder embedder)
Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options and canvas-embedder, but with no avatar-event handler, no player-event handler, no speed provider, and with the player's cyclic-play and "single-sign" flags both initially false.


JAFramesPlayer

public JAFramesPlayer(JAOptions jopts,
                      JACanvasEmbedder embedder,
                      AvatarEventHandler aehdlr,
                      JAPlayerEventHandler pehdlr,
                      SpeedProvider sp)
Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, avatar-event handler, player-event handler, speed provider, and with the player's cyclic-play and "single-sign" flags both initially false.


JAFramesPlayer

public JAFramesPlayer(JAOptions jopts,
                      JACanvasEmbedder embedder,
                      AvatarEventHandler aehdlr,
                      JAPlayerEventHandler pehdlr,
                      SpeedProvider sp,
                      boolean cyclic,
                      boolean onesign)
Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, avatar-event handler, player-event handler, speed provider, and with the given initial settings of the player's cyclic-play and "single-sign" flags.

Method Detail

getFrameIndexAccess

public FrameIndexScanAccess getFrameIndexAccess()

setCyclicPlay

public void setCyclicPlay(boolean cyclic)
Sets this player's cyclic-play flag to the given value.


setSingleSignPlay

public void setSingleSignPlay(boolean single)
Sets this player's single-sign flag to the given value.


requestSwitchAvatar

public void requestSwitchAvatar(java.lang.String avatar)
Initiates loading of the specified avatar into this player's JA view.


avatarIsLoaded

public void avatarIsLoaded(java.lang.String avatar)
Handler for the avatar-loaded event generated by our view: sets up a camera controller for the view, and forwards the event to this player's own handler if it has one.

Specified by:
avatarIsLoaded in interface AvatarEventHandler

avatarIsUnloaded

public void avatarIsUnloaded(java.lang.String avatar)
Handler for the avatar-unloaded event generated by our view: updates the preferences with the camera settings, and forwards the event to this player's own handler if it has one.

Specified by:
avatarIsUnloaded in interface AvatarEventHandler

createStandardCameraChangeMonitor

public void createStandardCameraChangeMonitor()
Creates a standard camera change monitor implementation attached to this player. The presence of this change monitor causes this player to log camera settings changes to the console.


clearAnimation

public void clearAnimation()
Detaches its current animation, if any, from this player.


setAnimation

public void setAnimation(SiGMLAnimation anim)
Sets the given animation sequence to be the current one for this player.


getAnimation

public SiGMLAnimation getAnimation()
Returns the animation currently associated with this player if there is one, or null otherwise.


ensureAnimationIsComplete

public void ensureAnimationIsComplete()
Ensures that if this player has an animation then the animation is completely loaded.


makeSignStatusRecord

public SignStatusRecord makeSignStatusRecord()
Returns a new SignStatusRecord associated with this player's animation scan if it has one; otherwise returns null.


countFrames

public int countFrames()
Returns the number of frames in the currently loaded animation, or 0 if there is none.


countSigns

public int countSigns()
Returns the number of signs in the currently loaded animation, or -1 if there are none.


hasAnimationData

public boolean hasAnimationData()
Returns a flag value indicating whether or not this player has a playable animation loaded.


currentSign

public AnimatedSign currentSign()
Returns the current sign for this player's animation scan, or null if the player currently has no animation scan.


terminate

public void terminate()
               throws java.lang.InterruptedException
Terminates this player and its display.

Throws:
java.lang.InterruptedException

awaitPlayerInactive

public void awaitPlayerInactive()
                         throws java.lang.InterruptedException
Delays until this player is inactive.

Throws:
java.lang.InterruptedException

showFrame

public void showFrame(int F)
Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so.


showFrame

public void showFrame(int f,
                      SignStatusRecord ss)
Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so; the given status record is updated accordingly.


stopPlaying

public void stopPlaying()
Aborts this player's current animation, if any.


suspendPlaying

public void suspendPlaying()
Suspends this player's current animation, if any.


startPlaying

public void startPlaying()
Starts playing this player's current animation.


resumePlaying

public void resumePlaying()
Resumes the playing of this player's animation after an earlier suspension, or logs a message if there was no earlier suspension.


playerIsActive

public boolean playerIsActive()
Indicates whether this player is currently active.


sequencePlayStarts

public void sequencePlayStarts()
Responds to the start of a sequence play operation.


sequencePlayFinishes

public void sequencePlayFinishes()
Responds to the completion of a sequence play operation.


framePlayStarts

public void framePlayStarts()
Responds to the start of a single frame play operation.


framePlayFinishes

public void framePlayFinishes()
Responds to the completion of a single frame play operation.