![]() ![]()
|
Home PUBz Grafx Pax Tips & Trix Neo-Linx Neo-Talk NeoDezign Filez Search NeoDezign
|
![]() |
You can give your end-users the ability to play custom WAV files in your application. Let's say you have an alarm clock - reminder type program. It might display a text message or a pop-up graphic, and it plays a sound file to alert the user. Wouldn't it be nice to let them select a custom WAV file of their choice? All you need to do is create a special bit of code for the first time your program is ran and a dialog that lets the user select another WAV file. It all comes together by making some key choices before you compile your PUB and taking advantage of how NeoBook handles extracted files. Backup of Original When your program is ran the first time it will extract the WAV file as it is played. If you want to give the user the ability to Restore your original sound then, immediatly after the file has been extracted and played, use the following example code to make a backup copy of your original WAV file. FileExists
"[PubDir]mysound.wa_" "backupwav"
If the program has already been run and, the file "mysound.wa_" does in fact exist, then it will not be copied again. This will assure that "mysound.wav" will only be backed up once and you will have a secure copy of your original sound. Now,
you could simply package two sound files with your program, the actual
sound file and another one as a backup but, that would increase the size
of your Setup program. An additional soundfile -versus- 4 lines of code?
Select Custom Sound To give the user the ability to select their own wav file we can use the FileCopy command to overwrite the original wav file. Use an AddOn to open a FileOpen dialog box. (Use the parameters of your fav' AddOn) .///
launch addon and get WAV file
Restore Original Sound A simple button with one line of code... FileCopy "[PubDir]mysound.wa_" "[PubDir]mysound.wav"
In the Compiler Although the following information is fairly obvious and common knowledge to most everyone I still need to go over them. The options selected in the compiler are important to making it all work. NeoBook wants to use the same filename as the file that you compile with it. For instance, if we use "mysound.wav" in our PUB, compile it to an EXE, our program will only use a wav file named "mysound.wav". If in the Compiler we choose...
...then the wav file will always be visible by your program.
|
![]() |