purpose: Install an .aiff file for playing with mglPlaySound
usage: mglInstallSound(soundName)
argument | value |
---|---|
soundName | aiff filename |
This will install sounds to be played using mglPlaySound. Note that if you just want to use systems sounds then you do not need to call this function directly, it will be called by mglOpen to install all your system sounds. Once the sound is installed you can play it with mglPlaySound
soundNum = mglInstallSound('/System/Library/Sounds/Submarine.aiff'); mglPlaySound(soundNum);
With no arguments, mglInstallSound uninstalls all sounds
mglInstallSound
You can also specify a directory of sound files to install:
mgInstallSound('soundDir');
which will install all sounds named *.aif or *.aiff. You can play the sounds by specifying the name of the file (without the file extension):
mglPlaySound('soundFileName');
purpose: Play a sound
usage: mglPlaySound(soundNum)
argument | value |
---|---|
soundNum | number of sound |
Plays a system sound. After calling mglOpen, all of the system sounds will be installed and you can play a specific one as follows:
mglOpen; global MGL; mglPlaySound(find(strcmp(MGL.soundNames,'Submarine')));
With no arguments mglPlaySound plays the system alert sound
mglPlaySound
Note that this function returns right after it starts playing the sound (it does not wait until the sound finishes playing).