To give the user more direct control in playing the audio file, you can use the audio-dialog command to display an audio control panel.
Like the play-audio command, the audio-dialog command resembles a jump. This command has the following parts:
A word, phrase, or bitmap formatted as double underline text that serves as the activation point for the command
The audio-dialog command formatted as hidden text
The syntax for the audio-dialog command is as follows:
!HAudioDialog(hwndContext, qchPath, "audiofile", "window-title")
Type the command exactly as shown here, except for audiofile and window-title.
The audiofile is the name of the audio file you want to play. It must be enclosed in double quotes (“ ”). It should include a path relative to the project directory. Any backslashes (\) in the path must appear as double backslashes (\\) in the command.
The window-title is the text you want displayed in the window's title bar. It must be enclosed in double quotes (“ ”).
·To code an audio-dialog command:
1.Display the topic from which you want to display the audio control panel.
2.Select the text or bitmap reference you want to serve as the activation point (for example, the USA Tour sample application title uses the USSOUND.BMP bitmap to identify audio hot spots).
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-dialog command.
6.From the Format menu, choose Character again and clear the Hidden check box.
In the following example, the HAudioDialog command plays the file DRUMROLL.WAV and displays “Drum Roll” as the window title:
!HAudioDialog(hwndContext, qchPath, "sounds\\drumroll.wav", "Drum Roll")
The referenced .WAV file includes the path from the project directory. Notice that double backslashes (\\) must be given for each backslash (\) in the path. This appears in the sample Word topic file as follows:
You must now register the audio-dialog command by placing the following entry in the [CONFIG] section of the title's project file:
[CONFIG]
RegisterRoutine("mvauddlg", "HAudioDialog", "USSS")
Be sure you type the entry exactly as shown here. You only need one entry, regardless of the number of audio-dialog commands you use.
Once activated, the audio-dialog command plays the audio file and displays the control panel, as shown in the following illustration:
The buttons on the control panel control playback for the audio segment. See “Audio Controls,” later in this chapter, for more information.