Package org.opensourcephysics.media.core
Class StepperClipControl
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.ClipControl
org.opensourcephysics.media.core.StepperClipControl
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
This is a ClipControl that displays every step in a video clip.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Field Summary
Fields inherited from class org.opensourcephysics.media.core.ClipControl
clip, loadedStepNumber, looping, PROPERTY_CLIPCONTROL_FRAMEDURATION, PROPERTY_CLIPCONTROL_LOOPING, PROPERTY_CLIPCONTROL_PLAYING, PROPERTY_CLIPCONTROL_RATE, PROPERTY_CLIPCONTROL_STEPNUMBER, rate, savedFrameDuration, stepNumber, timeSource, timeStretch, video, videoFrameNumber, videoVisible
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StepperClipControl
(VideoClip videoClip) Constructs a StepperClipControl object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
back()
Steps back one step.void
dispose()
Empty dispose method.static XML.ObjectLoader
Returns an XML.ObjectLoader to save and load data for this class.double
Gets the average frame duration in milliseconds (for calculations).double
Gets the measured play rate.double
getStepTime
(int stepNumber) Gets the start time of the specified step measured from step 0.double
getTime()
Gets the current video time in milliseconds measured from step 0.boolean
Gets the playing status.void
play()
Plays the clip.void
Responds to property change events.void
setFrameDuration
(double duration) Sets the frame duration.void
setLooping
(boolean loops) Turns on/off looping.void
setRate
(double newRate) Sets the play rate.void
setStepNumber
(int n0) Sets the step number.protected void
setStepNumberLater
(int frame, int step) void
step()
Steps forward one step.void
stop()
Stops at the next step.Methods inherited from class org.opensourcephysics.media.core.ClipControl
getControl, getFrameNumber, getRate, getStepNumber, getTimeSource, getVideoClip, isLooping, isTimeSource, setFrameNumber, setTimeSource
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
StepperClipControl
Constructs a StepperClipControl object.- Parameters:
videoClip
- the video clip
-
-
Method Details
-
play
public void play()Plays the clip.- Overrides:
play
in classClipControl
-
stop
public void stop()Stops at the next step.- Overrides:
stop
in classClipControl
-
step
public void step()Steps forward one step.- Overrides:
step
in classClipControl
-
back
public void back()Steps back one step.- Overrides:
back
in classClipControl
-
setStepNumber
public void setStepNumber(int n0) Sets the step number.- Overrides:
setStepNumber
in classClipControl
- Parameters:
n
- the desired step number
-
setStepNumberLater
protected void setStepNumberLater(int frame, int step) -
setRate
public void setRate(double newRate) Sets the play rate.- Overrides:
setRate
in classClipControl
- Parameters:
newRate
- the desired rate
-
getMeanFrameDuration
public double getMeanFrameDuration()Gets the average frame duration in milliseconds (for calculations).- Specified by:
getMeanFrameDuration
in classClipControl
- Returns:
- the frame duration in milliseconds
-
setFrameDuration
public void setFrameDuration(double duration) Sets the frame duration.- Specified by:
setFrameDuration
in classClipControl
- Parameters:
duration
- the desired frame duration in milliseconds
-
setLooping
public void setLooping(boolean loops) Turns on/off looping.- Overrides:
setLooping
in classClipControl
- Parameters:
loops
-true
to turn looping on
-
isPlaying
public boolean isPlaying()Gets the playing status.- Specified by:
isPlaying
in classClipControl
- Returns:
true
if playing
-
getTime
public double getTime()Gets the current video time in milliseconds measured from step 0.- Specified by:
getTime
in classClipControl
- Returns:
- the current time
-
getStepTime
public double getStepTime(int stepNumber) Gets the start time of the specified step measured from step 0.- Specified by:
getStepTime
in classClipControl
- Parameters:
stepNumber
- the step number- Returns:
- the step time
-
propertyChange
Responds to property change events.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classClipControl
- Parameters:
e
- the property change event
-
getMeasuredRate
public double getMeasuredRate()Description copied from class:ClipControl
Gets the measured play rate. Default is the set rate. StepperClipControl overrides to report true measured rate.- Overrides:
getMeasuredRate
in classClipControl
- Returns:
- the measured rate
-
getLoader
Returns an XML.ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
dispose
public void dispose()Description copied from class:ClipControl
Empty dispose method.- Overrides:
dispose
in classClipControl
-