Contents | Index | < Browse | Browse >
Sound Effects
Standard mono IFF Samples, up to 64k in length, can now be loaded and
used as sound effects or reminders. The commands that handle them,
are similar to the image handling commands :
- LOADSOUND FileName Alias - will load the sample and name it "Alias"
- FREESOUND Alias - will free the above sample
- PLAYSOUND Alias - will play the sound once
- SETSOUND Alias VOLUME/SPEED value
Will set the VOLUME (1-64) or the SPEED (124-1000) ie the pitch.
Sounds can be used as effects on all types of gadgets, and on other
events like window open/close, RMB and xOnKey. There are 2 ways you
can do this.
1.- You can define the sound effects globally, and these will be
used in all guis:
> SET SndOpen/SndClose/SndGad/SndRMB/SndKey Alias
The easiest way to set these is from the Gui4Cli.gc gui (called
from the main Gui4Cli requester in the WB tools menu)
2.- Or, you can define a different sound for every gadget, or key
or window etc, using the Attribute system, with:
> SETATTR mygui.gc/1 SOUND mysound <or> ATTR SOUND mysound
The sound will be played every time the event is triggered.
An attribute, if defined, will take precedence over a global sound.
Note that with ATTR, sounds can also be attached to xONOPEN, xONCLOSE,
xRMB and xONKEY events.
Example: (set the sound globally for all windows opening)
FreeSound MySound ; free the old alias (if any)
LoadSound DH0:SomeSound MySound ; load new sample under same alias
Set SndOpen MySound ; set the sound
Example: (set a different sound for a specific window opening)
xOnLoad ; load the sound in the xOnLoad event
LoadSound DH0:SomeSound MySound
xOnOpen ; Set the attribute for this window opening
ATTR SOUND MySound
xOnQuit ; free sound on exit
FreeSound MySound