Home

Downloads

FAQs

Sample Book

Features

Forum

 

Audio Tracks

Audiotracks are added using the audioTracks.xml file.

The file supplied with the source is shown below:-

<?xml version="1.0" encoding= "UTF-8" ?>
<audioFiles>

<track>
<id>Track1</id>
<path>Audio/Track1.mp3</path>
<songTitle>Background track</songTitle>
<isStream>false</isStream>
<initVol>20</initVol>
</track>


<track>
<id>Track2</id>
<path>Audio/Track2.mp3</path>
<songTitle>Busy background</songTitle>
<autoStart>true</autoStart>
<initVol>20</initVol>
<autoReplay>true</autoReplay>
<preLoad>true</preLoad>
<isStream>false</isStream>
</track>

<track>
<id>Track5</id>
<path>Audio/Track5.mp3</path>
<songTitle>Longish Background track</songTitle>
<isStream>false</isStream>
<initVol>50</initVol>
</track>

<track>
<id>Track6</id>
<path>Audio/Track1.mp3</path>
<songTitle>variation of track5</songTitle>
<isStream>false</isStream>
<initVol>50</initVol>
</track>

<track>
<id>Vocal1</id>
<path>Audio/Vocal1.mp3</path>
<songTitle>Male - I can see you</songTitle>
<isStream>false</isStream>
<initVol>50</initVol>
</track>

<track>
<id>Vocal2</id>
<path>Audio/Vocal2.mp3</path>
<songTitle>Female - I feel love</songTitle>
<isStream>false</isStream>
<initVol>50</initVol>
</track>

</audioFiles>

The parameters which can be placed inside the <track> and </track> tags are listed below

Parameter Default Comment
id none label used to reference the track
path none path (URL) to the mp3 audio file
songTitle none just a comment - not used in the code
isStream none true or false to identify if the audio is streamed from the given path (URL)
initVol none 0-100. The volume to set when the track is first played.
preLoad false set to true if the track must be loaded before the book opens.
autoStart false set to true if you want the track to start playing when it has loaded.
autoReplay false set to true if you want the track to start playing again after it has finished.
autoUnload false set to true if you want the track unloaded when it has completed playing.
autoNext none set to id of next track to start - you can create a round robin of audio tracks using this feature.

ActionScript control

Function Comment
_root.audioPlayTrack(Id,pos) Plays track Id. Will load track if not already loaded (potential delay) sets the start position if pos is specified. Pos is a number of seconds into the track. Call is ignored if track is playing.
_root.audioPauseTrack(Id) Pause track Id
_root.audioSetVolume(Id,Vol) set volume of track Id to vol
_root.audioResumeTrack(Id) resume playing track Id after Pause - otherwise plays from start.
_root.audioStopTrack(Id) stop playing track Id (ignored if Track.isPlaying is false)
_root.audioFade(Id,Vol) sets a target volume (Vol) - sound track volume is then incremented or decremented once every 10 millisec until it reaches the target level.
_root.audioRestoreVol(id) restores the volume of track id to the initVol setting in audioTracks.xml