|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.fmj.ejmf.toolkit.media.AbstractClock
public class AbstractClock
The AbstractClock provides an abstract implementation of the javax.media.Clock interface. All methods are implemented except for setStopTime() and getStopTime(). These methods will invariably require implementation-specific functionality and therefore are left to the subclasses to implement. From the book: Essential JMF, Gordon, Talley (ISBN 0130801046). Used with permission.
AbstractController
,
StopTimeMonitor
Field Summary |
---|
Fields inherited from interface javax.media.Clock |
---|
RESET |
Constructor Summary | |
---|---|
AbstractClock()
Constructs an AbstractClock. |
Method Summary | |
---|---|
long |
getMediaNanoseconds()
Get the media time in nanoseconds. |
protected Time |
getMediaStartTime()
Get the media time the media is scheduled to start (if the Clock is stopped), or the media time at which the Clock started (if the Clock is started). |
Time |
getMediaTime()
Calculates the current media time based on the current time-base time, the time-base start time, the media start time, and the rate. |
float |
getRate()
Get the current temporal scale factor. |
Time |
getStopTime()
Get the last value successfully set by setStopTime. |
Time |
getSyncTime()
Gets the time until the Clock's media synchronizes with its time-base. |
TimeBase |
getTimeBase()
Get the TimeBase that this Clock is using. |
protected Time |
getTimeBaseStartTime()
Get the time-base time the media is scheduled to start (if the Clock is stopped), or the time-base time at which the Clock started (if the Clock is started). |
Time |
mapToTimeBase(Time t)
Given a media time, returns the corresponding time-base time. |
void |
setMediaTime(Time t)
Sets the media time. |
float |
setRate(float rate)
Set the temporal scale factor. |
void |
setStopTime(Time mediaStopTime)
Set the media time at which you want the Clock to stop. |
void |
setTimeBase(TimeBase timebase)
Set the TimeBase for this Clock . |
void |
stop()
Stop the Clock. |
void |
syncStart(Time t)
syncStart the AbstractClock at the previously- specified time-base start time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractClock()
Method Detail |
---|
public void setTimeBase(TimeBase timebase) throws IncompatibleTimeBaseException
TimeBase
for this Clock
.
This method can only be called on a Stopped
Clock
. A ClockStartedError
is
thrown if setTimeBase
is called on a
Started Clock
.
A Clock
has a default TimeBase
that
is determined by the implementation. To reset a
Clock
to its default TimeBase
,
call setTimeBase(null)
.
setTimeBase
in interface Clock
timebase
- The new TimeBase
or
null
to reset the
Clock
to its default
TimeBase
.
IncompatibleTimeBaseException
- Thrown if the Clock
can't use the
specified TimeBase
.public TimeBase getTimeBase()
getTimeBase
in interface Clock
public void setMediaTime(Time t)
setMediaTime
in interface Clock
t
- The media time to set
ClockStartedError
- If the Clock is Started.protected Time getMediaStartTime()
protected Time getTimeBaseStartTime()
public Time getMediaTime()
getMediaTime
in interface Clock
public long getMediaNanoseconds()
getMediaNanoseconds
in interface Clock
public Time getSyncTime()
getSyncTime
in interface Clock
public Time mapToTimeBase(Time t) throws ClockStoppedException
mapToTimeBase
in interface Clock
t
- A media time to be mapped to a time-base time.
ClockStoppedException
- If the clock has not started.public float setRate(float rate)
The setRate
method returns the actual rate set
by the Clock
. Clocks
should set
their rate as close to the requested value as possible, but
are not required to set the rate to the exact value of any
argument other than 1.0. A Clock
is only
guaranteed to set its rate exactly to 1.0.
setRate
in interface Clock
rate
- The temporal scale factor (rate) to set.
ClockStartedError
- If the Clock is Started.public float getRate()
Clock's
media time and its
TimeBase
.
For example, a rate of 2.0 indicates that media time
will pass twice as fast as the TimeBase
time
once the Clock
starts. Similarly, a negative
rate indicates that the Clock
runs in the
opposite direction of its TimeBase
. All
Clocks
are guaranteed to support a rate of
1.0, the default rate. Clocks
are not
required to support any other rate.
getRate
in interface Clock
public void setStopTime(Time mediaStopTime)
Clock
to stop. The Clock
will
stop when its media time passes the stop-time. To
clear the stop time, set it to: Clock.RESET
.
You can always call setStopTime
on a
Stopped Clock
.
On a Started Clock
, the stop-time can
only be set once. A StopTimeSetError
is
thrown if setStopTime
is called and the
media stop-time has already been set.
setStopTime
in interface Clock
mediaStopTime
- The time at which you want the
Clock
to stop, in media
time.public Time getStopTime()
getStopTime
in interface Clock
public void syncStart(Time t)
Synchronous method -- return when transition complete
syncStart
in interface Clock
public void stop()
stop
in interface Clock
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |