Sound

ADRIFT 5 Help ›› Creating Games ›› Text Boxes ››
Parent Previous Next

Sound

As with Graphics, you can insert an audio clip by selecting the Audio tab on the right hand side. This provides three main buttons, a channel selector, and a loop checkbox.



To add a sound, click the Play button.  This will bring up a file dialog box, where you can select a WAV, MP3 or MID file.  There are plans to allow OGG files in a future release.


Once you selected a sound, you can preview the sound by right-clicking on the Play button.


You can have the audio loop indefinitely by selecting the Loop checkbox.


ADRIFT can play multiple sounds at the same time.  Each individual sound that can be played must be on a separate "channel".  ADRIFT has 8 sound channels. This means you can have background music on a particular channel, and overlay different audio clips on other channels. By default, everything will be on channel 1.


To pause a sound file (for example, you might want to pause a piece of music when a particular piece of text is displayed), left click on the Pause button.  This will pause any piece of audio on the selected channel.  When you next select to play sound on this channel, assuming it is the same audio clip then it will resume where it left off.


To stop a sound file, left-click on the Stop button.  If this piece of music is played again, it will start from the beginning.


As with the Play button, you can right-click on the pause/stop buttons to stop a piece of audio from being previewed.


As with graphics, you can control exactly when the sound will be played using tags.  This is useful in case you want to play multiple sound effects in the same text box, or wish to play the sound after a wait command.  The syntax is:

<audio [play src="filename or url"/pause/stop] {channel=X} {loop=[Y/N]}>

Anything in [square brackets] is mandatory, {curly brackets} is optional, and different options are separated by / symbols.


So for example:

<audio play src="myfile.mp3" channel=2 loop=Y>

or

<audio pause channel=3>.

If channel is omitted, channel 1 will be used.


If you wish to hide this tab, you can do this in Settings, removing the tick against Enable Audio.