IAPCSpeech::PlaySound

This method plays a prerecorded speech sound file.

Syntax

HRESULT IAPCSpeech::PlaySound ( LPCWSTR lpcwSound, HMODULE hModule, DWORD dwSound, DWORD dwReserved );

Parameters

lpcwSound
Long pointer to a string that specifies the sound file to play.
hModule
Handle of the executable file that contains the resource to be loaded.
dwSound
Specifies the flag for playing the sound.

The following values are defined:
SND_APPLICATION SND_NODEFAULT
SND_ALIAS SND_NOSTOP
SND_ALIAS_ID SND_NOWAIT
SND_ASYNC SND_PURGE
SND_FILENAME SND_RESOURCE
SND_LOOP SND_SYNC
SND_MEMORY  

For more information about these flags, see the Windows CE PlaySound function.

dwReserved
If this parameter is nonzero, the application receives a WM_SPCH_SNDDONE message when the wave file is finished playing. If it is set to zero, no message is sent.

Return Values

An appropriate HRESULT value is returned.

Remarks

Always use this method to play prerecorded speech. Besides playing the sound file, this method also attenuates the music and disables speech recognition during playback. This method uses the same waveform (WAV) output device as the text-to-speech (TTS) engine. If TTS is playing, IAPCSpeech::PlaySound stops TTS. TTS also stops the Windows CE PlaySound function if that function is in progress. For event sounds, use the Windows CE sndPlaySound function, which uses a different WAV output device than IAPCSpeech::PlaySound and TTS.

See Also

PlaySound, sndPlaySound