Changing the Movie Tempo

Movie files include a tempo channel that specifies the movie-playback rate. The tempo can change with each frame. The Movie Player can change the tempo setting for a movie loaded into memory. The tempo setting remains until the Movie Player encounters a change-tempo command in the tempo channel.

Use the following functions to set and get the tempo setting:

mmpSetTempo

Sets a new tempo value for the movie.

mmpGetTempo

Returns a frames-per-second tempo value for the movie.

The syntax of mmpSetTempo is as follows:

BOOL mmpSetTempo(idMovie, nTempo)

Pass the movie ID of the Movie Player instance to idMovie and one of the following integer values to nTempo:

Tempo Value Description

1 through 60 Sets the tempo to nTempo frames per second.
-1 through -120 Specifies a delay for the current frame. The Movie Player waits -nTempo seconds before advancing the frame.
MMPTEMPO_MOUSEWAIT Specifies a wait for the current frame. The Movie Player waits for the stage window to receive a mouse click or keystroke before advancing the frame.

For example, the following code fragment increases the play rate by 10 frames per second:

#define MAX_TEMPO 60
int nCurrent;

nCurrent = mmpGetTempo(idMovie);                                // Get current tempo setting
nCurrent = min(nCurrent+10, MAX_TEMPO);

if(!mmpSetTempo(idMovie, nCurrent))
{
    // Error occurred.
 }