How do I add sound to my app?

Question:
I have searched high and low and cannot seem to find a code example of how to add sound (attach a WAV file) to the opening of my application.

Answer:
You can use the following code:

Declare the following API calls:Function boolean sndPlaySoundA( & string SoundName, uint Flags ) Library "WINMM"Function uint waveOutGetNumDevs() Library "WINMM"

You can play a sound with the following code:

uint lui_NumDe vslui_NumDevs = WaveOutGetNumDevs()IF lui_NewDevs > 0 THEN  sndPlaySound( "filename.wav", modeofplay(INT) )END IFwhere: modeofplay0 - play synchronously1 - play asynchronously2 - don't use default sound if u can't find file3 - 1&28 - loop the sound until next sndPlaysound10- don't stop any correctly playing sound
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: