audio.findFreeChannel()

Description:

Will look for an available channel for playback. You can provide a start channel number as parameter which will start searching from that channel and increase upward to the highest channel. The search does not include reserved channels.

Syntax:

audio.findFreeChannel(  [ startChannel ]  )

Example:

local availableChannel = audio.findFreeChannel()
audio.play( laserSound, { channel=availableChannel } )

Parameters:

startChannel
integer: The channel number you want to start looking at. Search will increase upwards from this channel. 0 or no parameter start at the lowest possible value.

Returns:

The channel number of an available channel or 0 if none could be found.

Remarks:
Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Build 2011.222
  • Windows:
    Build 2011.222
  • iOS:
    Build 2011.222
  • Android:
    Build 2011.222