Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual FoxPro
Expertise: Beginner
Apr 4, 2000

Playing Sound Files in FoxPro Apps Quickly

Question:
I write language instruction programs and have been calling mplayer2 to allow students to hear the pronunciation saved in recorded sound files. But mplayer takes forever to load and play. So do all the other executable programs that I have, such as xrecord.

By contrast, Windows can play .wav files instantly. If I could load and play small .wav files that fast I could greatly improve my language program. (There must be some subfile of Windows that plays its sound files so quickly.)

What other .exe files are there that load and play very quickly under FoxPro? Using verbs in FoxPro is even slower than calling .exe files for some reason.

Answer:
Visual FoxPro lets you set the bell sound (using the SET BELL TO command) to a .wav file. You can then play the bell sound by executing the command:

??CHR(7)
For example, let's say that you have a .wav file called Stewart.wav. Here is the code that will cause the .wav file to play:
SET BELL ON
SET BELL TO "Stewart.wav",0
??CHR(7) && Rings the bell/plays the sound
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap