Loading and Unloading a Movie File

After getting a movie ID from mmpOpen, you can load a movie using mmpLoadFile. This function also establishes playback options for the movie file. The mmpLoadFile function has the following syntax:

BOOL mmpLoadFile(idMovie, lpszFileName, wOptions)

The idMovie parameter contains the movie ID returned from mmpOpen. If you start multiple instances of the Movie Player, you can load multiple movies simultaneously by calling mmpLoadFile to load a movie file into each Movie Player instance.

In the lpszFileName parameter, you can specify one of the following:

An LPSTR pointer to the movie filename.

A DWORD value in which the high-order word is set to zero and the low-order word is a file handle to an open file. The file pointer of the specified file must be positioned at the start of the RMMP chunk (at the first byte of the “RIFF” FOURCC code).

If the Movie Player fails to load the file, mmpLoadFile returns FALSE.

The following flags, passed in any combination to the wOptions parameter, specify load and playback options for the movie file:

Flag Description

MMP_DRAW_FRAME Draws the first frame to the stage window after loading the movie file. By default, the Movie Player does not display the first frame.
MMP_ERASE_FRAME Clears the stage window before loading the new movie file.
MMP_LOAD_REFERENCED Loads only those cast members referenced in the score. By default, the Movie Player loads all cast members.
MMP_LOAD_NOBUFFER Omits off-screen image buffer.
MMP_LOAD_NOSTATIC When the stage window is active, reduces the system colors to black and white, providing 18 more colors for use by the Movie Player.

To determine if the Movie Player currently has a movie file loaded, call mmpFileLoaded. This function has the following syntax:

BOOL mmpFileLoaded(idMovie)

This returns TRUE if the Movie Player instance identified by the given movie ID currently has a movie loaded.

Summary: Unloading the Movie File

To unload the movie file, you can call the mmpFreeFile function. This function has the following syntax:

BOOL mmpFreeFile(idMovie, wOptions)

This function frees memory associated with the movie file loaded in the Movie Player instance. The mmpFreeFile function returns TRUE if it successfully frees the memory. If the function returns FALSE, you should close the Movie Player instance.

To clear the stage window after clearing a file from memory, pass the MMP_ERASE_FRAME flag to the wOptions parameter. Without this flag, the last movie frame shown remains on screen.

The Movie Player automatically unloads the current movie file before attempting to load a new movie file. Also, you don't need to call mmpFreeFile when you close the Movie Player instance using mmpClose—the Movie Player auto-matically frees resources when the instance is closed.