Class: CB_AudioFile_API.SM2

CB_AudioFile_API.SM2

Class to manage an audio file using "SM2" (SoundManager 2). Used by the CB_AudioFile class internally and it shares most of its properties and methods. Recommended for internal usage only.


new CB_AudioFile_API.SM2(filePath [, audioId] [, options] [, callbackOk] [, callbackError]) → {CB_AudioFile_API.SM2}

The constructor is recommended to be called through a user-driven event (as onClick, onTouch, etc.) if the "autoPlay" option is set to true, as some web clients may need this at least the first time in order to be able to play the audio.

Parameters:
Name Type Argument Default Description
filePath string

The path of the audio file or a data URI. NOTE: Only some clients with some audio APIs will support data URIs.

audioId string <optional>
'CB_AUDIOFILE_SM2_' + CB_AudioFile_API.SM2._idUnique++

Desired identifier for the audio object. If not provided, an automatic unique ID will be calculated. Note that it is not case sensitive and it should be unique for each object.

options CB_AudioFile_API.SM2.OPTIONS <optional>
CB_AudioFile_API.SM2#DEFAULT_OPTIONS

Object with the desired options.

callbackOk function <optional>

Function with no parameters to be called when the audio has been loaded successfully, being "this" the CB_AudioFile_API.SM2 object itself.

callbackError function <optional>

Function to be called if the audio has not been loaded successfully. The first and unique parameter will be a string describing the error found (if could be determined), being "this" the CB_AudioFile_API.SM2 object itself.

Source:
To Do:
  • Do not allow to create one object with an "id" which has already been used (unless the value is undefined, null...). Note that the "id" is not case sensitive and it should be unique for each object.
  • Method getCopy and static method filterProperties (similar to the ones from CB_GraphicSprites and CB_GraphicSpritesScene).
Returns:

Returns a new CB_AudioFile_API.SM2 object.

Type
CB_AudioFile_API.SM2

Members


<constant> DEFAULT_OPTIONS :CB_AudioFile_API.SM2.OPTIONS

Keeps the default options when an object is created. Format: { autoLoad: boolean, autoPlay: boolean, loop: boolean, volume: number }.

Type:
Default Value:
Source:

<constant> DEFAULT_VOLUME :number

Keeps the default volume. If the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_DEFAULT property is true, this will keep the result of calling the CB_Speaker.getVolume function. Otherwise, it will use the value of the CB_Configuration.CrossBase.CB_Speaker_DEFAULT_VOLUME variable.

Type:
  • number
Default Value:
  • CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_DEFAULT ? CB_Speaker.getVolume() : CB_Configuration.CrossBase.CB_Speaker_DEFAULT_VOLUME
Source:

<readonly> filePath :string

Stores the path of the audio file or the data URI. NOTE: Only some clients with some audio APIs will support data URIs.

Type:
  • string
Source:

<readonly> id :string

Stores the identifier for the audio file.

Type:
  • string
Default Value:
  • 'CB_AUDIOFILE_SM2_' + CB_AudioFile_API.SM2._idUnique++
Source:

<readonly> lastStartAt :number

Stores the last "startAt" parameter value used by the CB_AudioFile_API.SM2#play or the CB_AudioFile_API.SM2#resume method.

Type:
  • number
Source:

<readonly> lastStopAt :number

Stores the last "stopAt" parameter value used by the CB_AudioFile_API.SM2#play or the CB_AudioFile_API.SM2#resume method.

Type:
  • number
Source:

<readonly> loop :boolean

Defines whether the file loops by default when the audio is played or not. Its value will be modified automatically whenever the CB_AudioFile_API.SM2#play method is called, getting the value from the "loop" parameter (but only if contains a boolean).

Type:
  • boolean
Default Value:
Source:

<readonly> onStopFunction :function

Function to call when the audio stops.

Type:
  • function
Source:

<readonly> pauseTime :number

Stores the time (in milliseconds) when the audio has been paused.

Type:
  • number
Source:

<readonly> paused :boolean

Tells whether the audio is paused or not.

Type:
  • boolean
Default Value:
  • false
Source:

<readonly> soundObject :Object

Stores the "SMSound" object (returned by the createSound method) of the audio, used by the "SM2" (SoundManager 2).

Type:
  • Object
Source:

<readonly> status :integer

Tells whether the file is unloaded (CB_AudioFile.UNLOADED), loading (CB_AudioFile.LOADING), unchecked (CB_AudioFile.UNCHECKED), checking (CB_AudioFile.CHECKING), loaded (CB_AudioFile.LOADED), failed (CB_AudioFile.FAILED) or aborted (CB_AudioFile.ABORTED).

Type:
  • integer
Default Value:
Source:

<readonly> stopped :boolean

Tells whether the audio is stopped or not.

Type:
  • boolean
Default Value:
  • true
Source:

<readonly> volume :number

Stores the volume of this audio. Accepted values go from 0 to MAX_VOLUME, where MAX_VOLUME is 100 if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is false or otherwise MAX_VOLUME is the returning value of the CB_Speaker.getVolume function.

Type:
  • number
Default Value:
Source:

<readonly> volumeBeforeMute :number

Stores the volume of this audio before it was muted (to restore it later). Valid values go from 0 to MAX_VOLUME, where MAX_VOLUME is 100 if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is false or otherwise MAX_VOLUME is the returning value of the CB_Speaker.getVolume function.

Type:
  • number
Default Value:
Source:

Methods


checkPlaying( [callbackOk] [, callbackError] [, ignoreStatus] [, ignoreQueue] [, useCache]) → {boolean}

Checks whether the audio can be played or not. Recommended to be called through a user-driven event (as onClick, onTouch, etc.), as some web clients may need this at least the first time in order to be able to play the audio. Also recommended to use before calling the CB_AudioFile_API.SM2#play method the first time. The checking action will only be performed if the value of the CB_AudioFile_API.SM2#status property belongs to the CB_AudioFile.UNCHECKED or to the CB_AudioFile.CHECKING value. After checking, if the audio can be played, the CB_AudioFile_API.SM2#status of the object will get the value of CB_AudioFile.LOADED. Otherwise, if it cannot be played, the CB_AudioFile_API.SM2#status property will get the value of {CB_AudioFile.FAILED}.

Parameters:
Name Type Argument Default Description
callbackOk function <optional>

Function with no parameters to be called when the audio has been checked successfully, being "this" the CB_AudioFile_API.SM2 object itself.

callbackError function <optional>

Function to be called if the audio has not been checked successfully. The first and unique parameter will be a string describing the error found (if it could be determined), being "this" the CB_AudioFile_API.SM2 object itself.

ignoreStatus boolean <optional>
false

If set to false and the CB_AudioFile_API.SM2#status property does not belong neither to the "UNCHECKED" status (defined in the CB_AudioFile.UNCHECKED constant) nor to the "CHECKING" status (defined in the CB_AudioFile.CHECKING constant), it will fail calling the "callbackError" function (if any). If set to true, it will try to perform the checking action regardless the status of the audio.

ignoreQueue boolean <optional>
false

If set to false and there is already the maximum number of audio files being checked (defined internally), the function will exit and it will call itself automatically again and again until the checking process can be performed (when its queue turn has been reached). This is done for performance purposes.

useCache boolean <optional>
false

This parameter will be ignored in this audio API.

Source:
Returns:

Returns false if the checking could not be performed and failed. If it returns true, it can mean either the checking has been processed successfully or it will fail in the future, so it is recommended to ignore the returning value and use the callback functions instead.

Type
boolean

destructor( [stopSound] [, keepStoppedUnaltered] [, avoidOnStop] [, forceOnStop])

Destroys the audio file object and frees memory. Sets its current CB_AudioFile_API.SM2#status property to ABORTED (CB_AudioFile.ABORTED value).

Parameters:
Name Type Argument Default Description
stopSound boolean <optional>
false

If set to true, it will also call the CB_AudioFile_API.SM2#stop method.

keepStoppedUnaltered boolean <optional>
false

Used internally as the "keepStoppedUnaltered" parameter to call the CB_AudioFile_API.SM2#stop method. If the "stopSound" parameter is not set to true, this parameter will be ignored as the "stop" method will not be called.

avoidOnStop boolean <optional>
false

Used internally as the "avoidOnStop" parameter to call the CB_AudioFile_API.SM2#stop method. If the "stopSound" parameter is not set to true, this parameter will be ignored as the "stop" method will not be called.

forceOnStop boolean <optional>
false

Used internally as the "forceOnStop" parameter to call the CB_AudioFile_API.SM2#stop method. If the "stopSound" parameter is not set to true, this parameter will be ignored as the "stop" method will not be called.

Source:

getCurrentTime() → {number}

Gets the current time (in milliseconds) which belongs to the position where the audio is currently playing or where it has been paused. Note that some audio APIs and clients could give wrong values.

Source:
Returns:

Returns the current time (in milliseconds). Note that some audio APIs and clients could give wrong values.

Type
number

getDuration() → {number}

Tells the duration of the audio (in milliseconds). Note that some clients might not calculate the duration correctly and, in this case, a zero (0) value would be returned.

Source:
Returns:

Returns the duration of the audio (in milliseconds). Note that some clients might not calculate the duration correctly and, in this case, a zero (0) value would be returned.

Type
number

getProgress() → {number}

Returns a number representing the percentage of the loading progress for the audio file (from 0 to 100, being 100 a complete loading progress). The way to calculate it internally may differ from one audio API to another and it is not totally reliable.

Source:
Returns:

Returns a number representing the percentage of the loading progress for the audio file (from 0 to 100, being 100 a complete loading progress). The way to calculate it internally may differ from one audio API to another and it is not totally reliable.

Type
number

load( [filePath] [, autoPlay] [, callbackOk] [, callbackError] [, forceReload]) → {CB_AudioFile_API.SM2|null}

Loads the desired audio file with the desired options. Recommended to be called through a user-driven event (as onClick, onTouch, etc.), as some web clients may need this at least the first time in order to be able to play the audio. This method will be called automatically by the constructor if the "autoLoad" option was set to true in its given "options" parameter.
When this method is called, if the CB_AudioFile_API.SM2#status property already has the "LOADED" status (defined in the CB_AudioFile.LOADED constant) and the "forceReload" parameter is not set to true, it will exit calling the given "callbackOk" function (if any) immediately. Otherwise, regardless the status, the status will be set to "LOADING" (defined in the CB_AudioFile.LOADING constant). After it, it will reach the "UNCHECKED" (defined in the CB_AudioFile.UNCHECKED constant). If the "autoPlay" parameter is not set to true, this will be the final status (and it will be necessary to call the CB_AudioFile_API.SM2#checkPlaying method after it). After it and only if the "autoPlay" is set to true, as the CB_AudioFile_API.SM2#checkPlaying method will be called internally, it will have the "CHECKING" status (defined in the CB_AudioFile.CHECKING constant) and finally the "LOADED" status (defined in the CB_AudioFile.LOADED constant) if all goes well.

Parameters:
Name Type Argument Default Description
filePath string <optional>
CB_AudioFile_API.SM2#filePath

The path of the audio file or a data URI. NOTE: Only some clients with some audio APIs will support data URIs.

autoPlay string <optional>
false

If set to true, it will start playing the audio automatically (by calling the CB_AudioFile_API.SM2#play method internally). If set to true and the CB_AudioFile_API.SM2#status property reaches to the "UNCHECKED" status (defined in the CB_AudioFile.UNCHECKED constant), it will also call internally the CB_AudioFile_API.SM2#checkPlaying method.

callbackOk function <optional>

Function with no parameters to be called when the audio has been loaded successfully, being "this" the CB_AudioFile_API.SM2 object itself.

callbackError function <optional>

Function to be called if the audio has not been loaded successfully. The first and unique parameter will be a string describing the error found (if it could be determined), being "this" the CB_AudioFile_API.SM2 object itself.

forceReload boolean <optional>
false

If set to false, the "filePath" has not been changed from the previously used and the CB_AudioFile_API.SM2#status property belongs to the "LOADED" status (defined in the CB_AudioFile.LOADED constant), it will exit the method without loading the audio file again (calling the "callbackOk" function, if any).

Source:
Returns:

Returns the audio API object (if it was possible to create) or null otherwise.

Type
CB_AudioFile_API.SM2 | null

mute( [onMute]) → {number}

Mutes the audio file.

Parameters:
Name Type Argument Description
onMute function <optional>

Callback function which will be called if it has been possible to mute the audio file (or at least it was possible to try it).

Source:
Returns:

Returns the current volume (from 0 to the maximum value, where the maximum value will be the returning value of calling the CB_Speaker.getVolume function if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is set to true or it will be 100 otherwise). If all goes well, the returning value should be zero (0). Note that, even when it returns a zero (0) value, this does not always mean that the mute has been applied successfully.

Type
number

onStop(callbackFunction [, keepOldFunction]) → {boolean}

Sets a function to execute when the audio file stops playing or removes it.

Parameters:
Name Type Argument Default Description
callbackFunction function | null

The function (event listener) that we want to execute when the event is fired. No parameters will be received, being "this" the CB_AudioFile_API.SM2 object. If a null value is used, the event will be removed.

keepOldFunction boolean <optional>
true

Defines whether we want to keep any possible previous event listener or not.

Source:
Returns:

Returns whether the event has been set or not (removed).

Type
boolean

pause( [onPause] [, keepPausedUnaltered]) → {boolean}

Pauses the audio when it is being played.

Parameters:
Name Type Argument Default Description
onPause function <optional>

Function without parameters to be called when the audio is paused successfully, being "this" the CB_AudioFile_API.SM2 object.

keepPausedUnaltered boolean <optional>
false

If set to true (not recommended), the CB_AudioFile_API.SM2#paused property will not be set to true and it will remain with its current value.

Source:
Returns:

It returns false if the audio is already paused or it is stopped or if it cannot be paused. Returns true otherwise.

Type
boolean

play( [startAt] [, stopAt] [, loop] [, avoidDelayedPlay] [, allowedRecursiveDelay] [, onPlayStart] [, onLoadError] [, isResume] [, isLooping] [, startPlayingTime]) → {boolean|integer}

Plays the audio.

Parameters:
Name Type Argument Default Description
startAt number <optional>
0 | CB_AudioFile_API.SM2#lastStartAt | stopAt

Time in milliseconds where we want the audio to start at. If not provided or it is not a valid number, it will use zero (0) as default which belongs to the beginning of the audio. If the value provided is greater than the "stopAt" provided, it will use the value set in the CB_AudioFile_API.SM2#lastStartAt property (which belongs to the "startAt" value the last time that this method was called). If, even using the CB_AudioFile_API.SM2#lastStartAt value is still greather than the "stopAt" provided, it will use the same value as the "stopAt" which means it will not play and will stop immediately.

stopAt number <optional>
CB_AudioFile_API.SM2#getDuration()

Time in milliseconds where we want the audio to stop at. If not provided or it is not a valid number, it will use the returning value of the CB_AudioFile_API.SM2#getDuration method (which should belong to the total duration of the audio, if it was calculated correctly).

loop boolean <optional>
CB_AudioFile_API.SM2#loop

Sets whether we want to play the audio looping (starting again and again) or just play it once. Note that at the end of each loop the "onStop" function defined (through the CB_AudioFile_API.SM2#onStop method) will not be called.

avoidDelayedPlay boolean <optional>
false

If set to false (recommended) and the audio failed previously or was aborted (destroyed), it will try to load it correctly again automatically and play it after that if possible (this can take some time so the audio could start playing after a delay). Otherwise, if set to true and the audio failed or was aborted (destroyed), the audio will not play at all and the "stop" method will be called immediately.

allowedRecursiveDelay boolean <optional>
CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_ALLOWED_RECURSIVE_DELAY_DEFAULT

The maximum amount of time (in milliseconds) of delay that we accept before start playing the audio. If the amount of time is overcome, the audio will not play at all and the CB_AudioFile_API.SM2#stop method will be called immediately. Used only when the "avoidDelayedPlay" parameter is set to false and the audio needs to be loaded because it failed previously or was aborted (destroyed).

onPlayStart function <optional>

Function to be called when the audio starts playing successfully. The function will be called with the following parameters (in order): "startAt", "stopAt", "startAtNextLoop", "loop", "avoidDelayedPlay", "allowedRecursiveDelay" and "startPlayingTime", being "this" the CB_AudioFile_API.SM2 object. If the audio is looping, this will be called only once when the audio starts playing the first time and it will not be called next loops.

onLoadError function <optional>

Function to be called if the audio cannot be played successfully. The first and unique parameter will be a string describing the error found (if it could be determined), being "this" the CB_AudioFile_API.SM2 object.

isResume boolean <optional>
false

If set to true (not recommended) and it is a looping audio, the next loop will use the value of the CB_AudioFile_API.SM2#lastStartAt property as the "startAt" parameter when it calls this method again automatically (internally). Recommended for internal usage only.

isLooping boolean <optional>
false

Used to determine whether this method was called automatically again by itself because it is looping the audio. Recommended for internal usage only.

startPlayingTime integer <optional>

Contains the time when the audio should start playing. Recommended for internal usage only.

Source:
Returns:

It returns false if the duration is 0 ("startAt" and "stopAt" are the same number), returns "-1" if the audio cannot be played and an error is detected or returns true otherwise. Note that even when it returns true there can be a non-detectable error and maybe the audio is not played.

Type
boolean | integer

resume( [loop] [, avoidDelayedPlay] [, allowedRecursiveDelay] [, onPlayStart] [, onLoadError]) → {boolean|integer}

Resumes the audio (after being paused), starting from the same point it was paused previously.

Parameters:
Name Type Argument Default Description
loop boolean <optional>
CB_AudioFile_API.SM2#loop

Sets whether we want to play the audio looping (starting again and again) or just play it once. Note that at the end of each loop the "onStop" function defined (through the CB_AudioFile_API.SM2#onStop method) will not be called.

avoidDelayedPlay boolean <optional>
false

If set to false (recommended) and the audio failed previously or was aborted (destroyed), it will try to load it correctly again automatically and play it after that if possible (this can take some time so the audio could start playing after a delay). Otherwise, if set to true and the audio failed or was aborted (destroyed), the audio will not play at all and the CB_AudioFile_API.SM2#stop method will be called immediately.

allowedRecursiveDelay boolean <optional>
CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_ALLOWED_RECURSIVE_DELAY_DEFAULT

The maximum amount of time (in milliseconds) of delay that we accept before start playing the audio. If the amount of time is overcome, the audio will not play at all and the CB_AudioFile_API.SM2#stop method will be called immediately. Used only when the "avoidDelayedPlay" parameter is set to false and the audio needs to be loaded because it failed previously or was aborted (destroyed).

onPlayStart function <optional>

Function to be called when the audio starts playing successfully. The function will be called with the following parameters (in order): "startAt", "stopAt", "startAtNextLoop", "loop", "avoidDelayedPlay", "allowedRecursiveDelay" and "startPlayingTime", being "this" the CB_AudioFile_API.SM2 object. If the audio is looping, this will be called only once when the audio starts playing the first time and it will not be called next loops.

onLoadError function <optional>

Function to be called if the audio cannot be played successfully. It will not be called if the audio is not paused or is stopped. The first and unique parameter will be a string describing the error found (if it could be determined), being "this" the CB_AudioFile_API.SM2 object.

Source:
Returns:

Returns the returning value of the CB_AudioFile_API.SM2#play method which is called internally. It returns false if the audio is not paused or it is stopped, returns "-1" if the audio cannot be played and an error is detected or returns true otherwise. Note that even when it returns true there can be a non-detectable error and maybe the audio is not played.

Type
boolean | integer

setVolume( [volume] [, forceSetVolumeProperty] [, onSetVolume] [, saveForUnmute]) → {number}

Sets the desired volume for the audio file (from 0 to the maximum value, where the maximum value will be the returning value of calling the CB_Speaker.getVolume function if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is set to true or it will be 100 otherwise).

Parameters:
Name Type Argument Default Description
volume number <optional>
CB_Speaker.getVolume() | CB_Configuration.CrossBase.CB_Speaker_DEFAULT_VOLUME

Desired volume (from 0 to the maximum value, where the maximum value will be the returning value of calling the CB_Speaker.getVolume function if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is set to true or it will be 100 otherwise).

forceSetVolumeProperty boolean <optional>
false

If set to true (not recommended), it will change the CB_AudioFile_API.SM2#volume property even when the volume failed to be changed.

onSetVolume function <optional>

Callback function which will be called if it has been possible to set the volume (or at least it was possible to try it). It will not receive any parameters, being "this" the CB_AudioFile_API.SM2 object.

saveForUnmute boolean <optional>
false

If set to true (not recommended), it will save internally the current volume before setting it so it will restore the same volume again after calling the CB_AudioFile_API.SM2#unmute method. Internal usage only recommended.

Source:
Returns:

Returns the current volume (from 0 to the maximum value, where the maximum value will be the returning value of calling the CB_Speaker.getVolume function if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is set to true or it will be 100 otherwise).

Type
number

stop( [keepStoppedUnaltered] [, avoidOnStop] [, forceOnStop]) → {boolean}

Stops the audio.

Parameters:
Name Type Argument Default Description
keepStoppedUnaltered boolean <optional>
false

If set to true (not recommended), the CB_AudioFile_API.SM2#stopped property will not be set to true and it will remain with its current value.

avoidOnStop boolean <optional>
false

If set to false and there is an "onStop" function defined (through the CB_AudioFile_API.SM2#onStop method), it will be called after stopping the audio (or after trying to do it, at least) but only if either the "forceOnStop" parameter is set to true or if the "keepStoppedUnaltered" parameter is set to false and the audio was not already stopped before. If set to true, the "onStop" function (if any) will not be called at all.

forceOnStop boolean <optional>
false

If it is set to true and the "avoidOnStop" parameter is set to false and there is an "onStop" function defined (through the CB_AudioFile_API.SM2#onStop method), it will be called regardless the audio was stopped before or not. If set to false, the "onStop" function (if any) will only be called if the "keepStoppedUnaltered" parameter is set to false and the audio was not already stopped before. This parameter will be ignored if the "avoidOnStop" parameter is set to true.

Source:
Returns:

It returns false if the stopping action cannot be performed at all (this could happen when the audio has not been loaded properly, for example). Returns true otherwise (this only means that it has been tried to be stopped but it could not be successfully).

Type
boolean

unmute( [onUnmute]) → {number}

Restores audio after muting it (unmutes it).

Parameters:
Name Type Argument Description
onUnmute function <optional>

Callback function which will be called if it has been possible to unmute the audio file (or at least it was possible to try it). It will not receive any parameters, being "this" the CB_AudioFile_API.SM2 object.

Source:
Returns:

Returns the current volume (from 0 to the maximum value, where the maximum value will be the returning value of calling the CB_Speaker.getVolume function if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is set to true or it will be 100 otherwise).

Type
number

Type Definitions


OPTIONS

Object with the options for an audio file. The format is the following one: { autoLoad: boolean, autoPlay: boolean, loop: boolean, volume: number }.

Type:
  • Object
Properties:
Name Type Argument Default Description
autoLoad boolean <optional>
CB_AudioFile_API.SM2#DEFAULT_OPTIONS.autoLoad

If set to false, it will not call the CB_AudioFile_API.SM2#load method internally when the constructor is called (not recommended).

autoPlay boolean <optional>
CB_AudioFile_API.SM2#DEFAULT_OPTIONS.autoPlay

Value which will be used as the "autoPlay" parameter when calling the CB_AudioFile_API.SM2#load method internally, only when the "autoLoad" is set to true (when the constructor is called).

loop boolean <optional>
CB_AudioFile_API.SM2#DEFAULT_OPTIONS.loop

Value that will be used for the CB_AudioFile_API.SM2#loop property.

volume number <optional>
CB_AudioFile_API.SM2#DEFAULT_OPTIONS.volume

The desired volume (from 0 to the maximum value, where the maximum value will be the returning value of calling the CB_Speaker.getVolume function if the CB_Configuration.CrossBase.CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM property is set to true or it will be 100 otherwise) that will be used for the CB_AudioFile_API.SM2#volume property.

Source: