Creating Hot Spots for Audio Segments

Once you create an audio segment and move it into the appropriate subdirectory, you code a hot spot in the topic file to display the audio segment. This hot spot, instead of jumping to a topic or displaying a popup window, executes a Viewer command: the play audio command. This command plays an audio segment.

The play audio command has two parts:

A word, phrase, or bitmap reference formatted as double-underline text to work as the activation point for the command.

The play audio command formatted as hidden text.

·To code an audio command:

1.Display the topic from which you want to play the audio file.

2.Select the text or bitmap reference you want to use as the activation point.

3.From the Format menu, choose Character and select the Double Underline check box, then cancel the selection of the text or reference.

4.From the Format menu, choose Character again and clear the Double Underline check box, then select the Hidden check box.

5.Type the audio command (see the following section for more information on the format of this command).

6.From the Format menu, choose Character again and clear the Hidden check box.

The Play Audio Command

In its simplest form, the play audio command has the following syntax:

!HAudioCommand(hwndContext, qchPath,"audiofile", "play")

Everything in the command must be typed as shown, except for audiofile.

The audiofile is the name of the audio file you want played, enclosed by double quotes (“ ”). Make sure to include the path from the project directory to the audio segment. Any backslashes (\) in the path must appear as double backslashes (\\) in the command.

Summary: In the Topic File

The USA Tour sample application uses the following play audio command in the Land and People topic for Arizona:

Grand Canyon!HDisplayBmp(hwndContext, qchPath, "dibs\\az_nick.dib", "Grand Canyon");HAudioCommand(hwndContext, qchPath, "sounds\\echo.wav", "play") 

The HAudioCommand command plays an echoing call when the user clicks the text “Grand Canyon.” (Viewer also displays the AZ_NICK.DIB bitmap in an extended bitmap window while playing the call.) The file ECHO.WAV in the \VIEWER\USA\SOUNDS directory contains the call.

Notice that the reference to the WAV file includes the path from the project directory (\VIEWER\USA) to the sound file (SOUNDS\ECHO.WAV). Notice also that you must enter a double backslash (\\) for each single backslash (\) in the path, as shown in the following illustration:

Summary: Inside the Project File

You must now register the audio command by placing the following entry in the [CONFIG] section of the title's project file:

[CONFIG]
RegisterRoutine("mvaudio", "HAudioCommand", "USSS")

Make sure you type the entry exactly as shown in this example. You only need one entry regardless of how many audio commands you use in your title.

Summary: How It Displays

Viewer doesn't display anything when you simply play audio from a hot spot. The audio segment plays from beginning to end, even if the user jumps to a different topic while the audio segment is playing.