Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuStopWatch Class Reference

Stop watch class for the vuVolume project. More...

#include <vuStopWatch.h>

Collaboration diagram for vuStopWatch:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuStopWatch (int time_in_ms=0)
 Default constructor,.
virtual ~vuStopWatch ()
 destructor
void Start (int time_in_ms=0)
 This function will initialize the time of the stop watch to time_in_ms and will start the watch (as if it started at time "time_in_ms").
int Time ()
 This function will return the current time that this watch is at.
void Pause ()
 This function will pause the watch so that until the watch is resumed, it's time will not be changed.
void Resume ()
 This function will resume the watch so that if the watch is paused, it will be unpaused.
int TotalTime ()
 This returns the total time that the stop watch has been running since the last call to the function, Start ();.
void setIsReversing (bool isit)
 This will set the watch to be running in reverse if isit is true, and forward otherwise.
void setIsRewinding (bool isit)
 This will start the watch to be rewinding if isit is true, and not rewinding otherwise.
void setIsFastForwarding (bool isit)
 This will start the watch to be fast forwarding if isit is true, and not fast forwarding otherwise.
void setIsLooping (bool isit)
 This will start the watch to be looping if isit is true and not looping otherwise.
void setIsBouncing (bool isit)
 This will start the watch to be bouncing if isit is true and not bouncing otherwise.
bool IsReversing ()
 This will return true if the watch is reversing, false otherwise.
bool IsRewinding ()
 This will return true if the watch is rewinding, false otherwise.
bool IsFastForwarding ()
 This will return true if the watch is fast forwarding, false otherwise.
bool IsLooping ()
 This will return true if the watch is looping, false otherwise.
bool IsBouncing ()
 This will return true if the watch is bouncing, and false otherwise.
void setFastSpeed (float mul)
 This will set the fast speeds to be mul * normal rate.
float getFastSpeed ()
 This will return the current value of the fast speed of this watch.
void setMaxTime (int maxtime_in_ms)
 This will set the maximum tim that this watch should reach.
int getMaxTime ()
 This will return the value of the maximum time that this watch can reach, in milliseconds.

Private Attributes

void * m_timer_1
 This is the main timer, it will keep track of the time that the watch should be outpouting (but this time may need to be modified if the watch is reversing, rewinding or fast forwarding, by a multiple of the second watch.
void * m_timer_2
 This is the secondary timer.
void * m_timer_3
 This is to keep track of the total time since the last call to Start.
bool mb_reversing
 This is true if the timer is reversing,false otherwise.
bool mb_fastforwarding
 This is true if the timer is fast forwarding, false otherwise.
bool mb_rewinding
 This is true if the timer is rewinding, false otherwise.
bool mb_looping
 This is true if the timer is looping, false otherwise.
bool mb_bouncing
 This is true if the timer is bouncing, false otherwise.
int m_maxtime
 This is the maximum time that the timer can reach, in milliseconds.
float m_fastspeed
 This is the speed multip[lier that will be applied to the time when it is fastforwarding or rewinding.

Detailed Description

Stop watch class for the vuVolume project.

This was written so that I

would have a stop watch that I could tell to fast forward and rewind easily for the Key Frame animator. (that way I could remove some of the code from that giant object and have something that might be useful later on).

This work's with time values in milliseconds, and is based on two wxStopWatches (though we may want to replace these with a more accurate vuHWTimers later on if they ecome more accurate in Linux).

If this watch is rewinding, then successive calls to the watch will return smaller and smaller values, if it's fast forwarding, then larger and larger faster than normal speed... etc.

Definition at line 29 of file vuStopWatch.h.


Constructor & Destructor Documentation

vuStopWatch::vuStopWatch int  time_in_ms = 0  ) 
 

Default constructor,.

This will set the start the StopWatch at time time_in_ms in milliseconds.

Definition at line 5 of file vuStopWatch.cpp.

References m_timer_1, m_timer_2, m_timer_3, setIsBouncing(), setIsFastForwarding(), setIsLooping(), setIsReversing(), setIsRewinding(), and Start().

Here is the call graph for this function:

vuStopWatch::~vuStopWatch  )  [virtual]
 

destructor

Definition at line 22 of file vuStopWatch.cpp.


Member Function Documentation

float vuStopWatch::getFastSpeed  ) 
 

This will return the current value of the fast speed of this watch.

Definition at line 382 of file vuStopWatch.cpp.

Referenced by Time().

int vuStopWatch::getMaxTime  ) 
 

This will return the value of the maximum time that this watch can reach, in milliseconds.

Definition at line 398 of file vuStopWatch.cpp.

Referenced by Time().

bool vuStopWatch::IsBouncing  ) 
 

This will return true if the watch is bouncing, and false otherwise.

Definition at line 370 of file vuStopWatch.cpp.

Referenced by Time().

bool vuStopWatch::IsFastForwarding  ) 
 

This will return true if the watch is fast forwarding, false otherwise.

Definition at line 358 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::PlayNextFrame(), vuKeyFramerDialog::PlayNextImage(), and Time().

bool vuStopWatch::IsLooping  ) 
 

This will return true if the watch is looping, false otherwise.

Definition at line 364 of file vuStopWatch.cpp.

Referenced by Time().

bool vuStopWatch::IsReversing  ) 
 

This will return true if the watch is reversing, false otherwise.

Definition at line 346 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::OnVideoReverse(), vuKeyFramerDialog::PlayNextFrame(), vuKeyFramerDialog::PlayNextImage(), and Time().

bool vuStopWatch::IsRewinding  ) 
 

This will return true if the watch is rewinding, false otherwise.

Definition at line 352 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::PlayNextFrame(), vuKeyFramerDialog::PlayNextImage(), and Time().

void vuStopWatch::Pause  ) 
 

This function will pause the watch so that until the watch is resumed, it's time will not be changed.

Definition at line 240 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::OnPause(), vuKeyFramerDialog::OnVideoPause(), vuKeyFramerDialog::setIsPaused(), and vuKeyFramerDialog::setIsVideoPaused().

void vuStopWatch::Resume  ) 
 

This function will resume the watch so that if the watch is paused, it will be unpaused.

Definition at line 250 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::OnPause(), vuKeyFramerDialog::OnVideoPause(), vuKeyFramerDialog::setIsPaused(), vuKeyFramerDialog::setIsPlaying(), and vuKeyFramerDialog::setIsVideoPaused().

void vuStopWatch::setFastSpeed float  mul  ) 
 

This will set the fast speeds to be mul * normal rate.

ie, if mul = 2.0, then the watch will gain one second for every second that it is running.

Definition at line 376 of file vuStopWatch.cpp.

References m_fastspeed.

void vuStopWatch::setIsBouncing bool  isit  ) 
 

This will start the watch to be bouncing if isit is true and not bouncing otherwise.

When a watch is bouncing, if the time is greater than the maximum time, the time will be set to the maximum time and the direction will be reversed.

If the time is less than 0, then the time will be set to zero and the direction will be changed to the forward direction.

Definition at line 337 of file vuStopWatch.cpp.

References mb_bouncing, and setIsLooping().

Referenced by vuKeyFramerDialog::OnKFBounce(), vuKeyFramerDialog::OnKFLoop(), vuKeyFramerDialog::OnVideoBounce(), vuKeyFramerDialog::OnVideoLoop(), vuKeyFramerDialog::setIsKFBouncing(), setIsLooping(), vuKeyFramerDialog::setIsVideoBouncing(), and vuStopWatch().

Here is the call graph for this function:

void vuStopWatch::setIsFastForwarding bool  isit  ) 
 

This will start the watch to be fast forwarding if isit is true, and not fast forwarding otherwise.

Definition at line 311 of file vuStopWatch.cpp.

References mb_fastforwarding, setIsReversing(), and setIsRewinding().

Referenced by vuKeyFramerDialog::OnFastForward(), vuKeyFramerDialog::OnVideoFastForward(), vuKeyFramerDialog::setIsFastForwarding(), setIsReversing(), setIsRewinding(), vuKeyFramerDialog::setIsVideoFastForwarding(), Time(), and vuStopWatch().

Here is the call graph for this function:

void vuStopWatch::setIsLooping bool  isit  ) 
 

This will start the watch to be looping if isit is true and not looping otherwise.

When a watch is looping, if the time is greater than the maximum time, the time will be reduced to zero (if it is moving in a forward direction).

If it is not moving in a forward direction, when the time is less than zero, it will be set to be the maximum time.

Definition at line 328 of file vuStopWatch.cpp.

References mb_looping, and setIsBouncing().

Referenced by vuKeyFramerDialog::OnKFBounce(), vuKeyFramerDialog::OnKFLoop(), vuKeyFramerDialog::OnVideoBounce(), vuKeyFramerDialog::OnVideoLoop(), setIsBouncing(), vuKeyFramerDialog::setIsKFLooping(), vuKeyFramerDialog::setIsVideoLooping(), and vuStopWatch().

Here is the call graph for this function:

void vuStopWatch::setIsReversing bool  isit  ) 
 

This will set the watch to be running in reverse if isit is true, and forward otherwise.

Definition at line 268 of file vuStopWatch.cpp.

References mb_reversing, setIsFastForwarding(), and setIsRewinding().

Referenced by vuKeyFramerDialog::OnFastForward(), vuKeyFramerDialog::OnRewind(), vuKeyFramerDialog::OnVideoReverse(), setIsFastForwarding(), vuKeyFramerDialog::setIsKFReversing(), setIsRewinding(), vuKeyFramerDialog::setIsVideoReversing(), Time(), and vuStopWatch().

Here is the call graph for this function:

void vuStopWatch::setIsRewinding bool  isit  ) 
 

This will start the watch to be rewinding if isit is true, and not rewinding otherwise.

Definition at line 290 of file vuStopWatch.cpp.

References mb_rewinding, setIsFastForwarding(), and setIsReversing().

Referenced by vuKeyFramerDialog::OnRewind(), vuKeyFramerDialog::OnVideoRewind(), setIsFastForwarding(), setIsReversing(), vuKeyFramerDialog::setIsRewinding(), vuKeyFramerDialog::setIsVideoRewinding(), Time(), and vuStopWatch().

Here is the call graph for this function:

void vuStopWatch::setMaxTime int  maxtime_in_ms  ) 
 

This will set the maximum tim that this watch should reach.

max_time_in_ms is in milliseconds.

Definition at line 388 of file vuStopWatch.cpp.

References m_maxtime.

Referenced by vuKeyFramerDialog::PlayFromImages(), vuKeyFramerDialog::PlayFunc(), and vuKeyFramerDialog::PlayNextFrame().

void vuStopWatch::Start int  time_in_ms = 0  ) 
 

This function will initialize the time of the stop watch to time_in_ms and will start the watch (as if it started at time "time_in_ms").

Note that the time_in_ms is the value in milliseconds of the time that it should start at.

Definition at line 30 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::BurstPlay(), vuKeyFramerDialog::PlayFromImages(), vuKeyFramerDialog::PlayInTime(), vuKeyFramerDialog::PlayNextFrame(), vuKeyFramerDialog::PlayNextImage(), and vuStopWatch().

int vuStopWatch::Time  ) 
 

This function will return the current time that this watch is at.

This time will be returned in milliseconds.

Definition at line 50 of file vuStopWatch.cpp.

References getFastSpeed(), getMaxTime(), IsBouncing(), IsFastForwarding(), IsLooping(), IsReversing(), IsRewinding(), setIsFastForwarding(), setIsReversing(), and setIsRewinding().

Referenced by vuKeyFramerDialog::PlayNextFrame(), and vuKeyFramerDialog::PlayNextImage().

Here is the call graph for this function:

int vuStopWatch::TotalTime  ) 
 

This returns the total time that the stop watch has been running since the last call to the function, Start ();.

Definition at line 260 of file vuStopWatch.cpp.

Referenced by vuKeyFramerDialog::PlayNextFrame(), and vuKeyFramerDialog::PlayNextImage().


Member Data Documentation

float vuStopWatch::m_fastspeed [private]
 

This is the speed multip[lier that will be applied to the time when it is fastforwarding or rewinding.

Definition at line 170 of file vuStopWatch.h.

Referenced by setFastSpeed().

int vuStopWatch::m_maxtime [private]
 

This is the maximum time that the timer can reach, in milliseconds.

Definition at line 169 of file vuStopWatch.h.

Referenced by setMaxTime().

void* vuStopWatch::m_timer_1 [private]
 

This is the main timer, it will keep track of the time that the watch should be outpouting (but this time may need to be modified if the watch is reversing, rewinding or fast forwarding, by a multiple of the second watch.

Definition at line 148 of file vuStopWatch.h.

Referenced by vuStopWatch().

void* vuStopWatch::m_timer_2 [private]
 

This is the secondary timer.

It will be reset on every call to Time (), and will be used to work out how the first watch and the output time should be changed.

Definition at line 152 of file vuStopWatch.h.

Referenced by vuStopWatch().

void* vuStopWatch::m_timer_3 [private]
 

This is to keep track of the total time since the last call to Start.

Definition at line 155 of file vuStopWatch.h.

Referenced by vuStopWatch().

bool vuStopWatch::mb_bouncing [private]
 

This is true if the timer is bouncing, false otherwise.

Definition at line 165 of file vuStopWatch.h.

Referenced by setIsBouncing().

bool vuStopWatch::mb_fastforwarding [private]
 

This is true if the timer is fast forwarding, false otherwise.

Definition at line 161 of file vuStopWatch.h.

Referenced by setIsFastForwarding().

bool vuStopWatch::mb_looping [private]
 

This is true if the timer is looping, false otherwise.

Definition at line 164 of file vuStopWatch.h.

Referenced by setIsLooping().

bool vuStopWatch::mb_reversing [private]
 

This is true if the timer is reversing,false otherwise.

Definition at line 159 of file vuStopWatch.h.

Referenced by setIsReversing().

bool vuStopWatch::mb_rewinding [private]
 

This is true if the timer is rewinding, false otherwise.

Definition at line 162 of file vuStopWatch.h.

Referenced by setIsRewinding().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:22:06 2004 for vuVolume by  doxygen 1.3.9.1