The code above contains two classes. The WavPlayer class wraps API declarations and acts as a factory for creating instances of the WavSound class.
On Init, an instance of WavSound opens specified WAV file, loads it in memory, and makes ready to be played.
Here is a code for testing WavPlayer and WavSound classes.
PUBLIC wp As WavPlayer
wp = CREATEOBJECT("WavPlayer")
wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Logoff Sound.wav")
wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Startup.wav")
wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Logon Sound.wav")
wp.LoadWavSound("C:\WINDOWS\Media\tada.wav")
wp.LoadWavSound("C:\WINDOWS\Media\notify.wav")
wp.LoadWavSound("C:\WINDOWS\Media\chord.wav")
wp.LoadWavSound("C:\WINDOWS\Media\Windows XP Shutdown.wav")
FOR nTimes=1 TO 1
FOR nIndex=1 TO wp.WavSounds.Count
wp.PlayWavSound(m.nIndex)
= INKEY(0.1)
NEXT
NEXT
Note that wp variable must not be released while the sounds are being played. For that reason it is declared PUBLIC.
API function mmioRead is declared twice with two different interfaces. In VFP versions 3 to 7, these declarations must be moved to LoadWaveFile method of WavSound class and placed each before corresponding call.
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
AceHTML Freeware
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.