TorqueScript Reference

- Main Page
- Related Pages
- Modules
- Classes

Functions
Audio
Function Categories

## Functions
String | alGetListener3f (ALEnum)
Integer | alGetListeneri (ALEnum)
String | alGetString (ALEnum)
void | alListener3f (ALEnum, x, y, z)
Integer | alxCreateSource (audio-assetId)
Integer | alxGetAudioLength (audio-assetId)
Float | alxGetChannelVolume (channelID)
Float | alxGetListenerf (ALEnum)
String | alxGetSource3f (handle, ALEnum)
Float | alxGetSourcef (handle, ALEnum)
Integer | alxGetSourcei (handle, ALEnum)
Float | alxGetStreamDuration (handle)
Float | alxGetStreamPosition (handle)
Boolean | alxIsPlaying (handle)
void | alxListenerf (AlEnum, value)
Boolean | alxPause (handle)
Integer | alxPlay (audio-assetId)
Boolean | alxSetChannelVolume (channelD, volume)
void | alxSource3f (handle, ALEnum, x, y, z)
void | alxSourcef (handle, ALEnum, value)
void | alxSourcei (handle, ALEnum, value)
void | alxStop (handle)
void | alxStopAll ()
void | alxUnpause (handle)
Boolean | OpenALInitDriver ()
void | OpenALRegisterExtensions ()
void | OpenALShutdownDriver ()

## Detailed Description

## Function Documentation

String alGetListener3f | ( | ALEnum |  | ) |

Use the al*GetListener* function to get the current value of a listener parameter, as specified by ALEnum. Depending on the ALEnum you need to acquire, be sure to use the correct version (i.e. correct return type) of al*GetListener*.

Parameters

  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.

Returns
  Returns a float (alxGetListenerf), a vector of three floats (alGetListener3f), or an integer value respectively (alGetListeneri).

See also
  alxGetSource*

Integer alGetListeneri | ( | ALEnum |  | ) |

Use the al*GetListener* function to get the current value of a listener parameter, as specified by ALEnum. Depending on the ALEnum you need to acquire, be sure to use the correct version (i.e. correct return type) of al*GetListener*.

Parameters

  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.

Returns
  Returns a float (alxGetListenerf), a vector of three floats (alGetListener3f), or an integer value respectively (alGetListeneri).

See also
  alxGetSource*

String alGetString | ( | ALEnum |  | ) |

Use the alGetString function to get the string equivalent to the specified OpenAL enumerated value.

Parameters

  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.

Returns
  Returns a string corresponding to the passed ALEnum

void alListener3f | ( | ALEnum | ,
|  | x | ,
|  | y | ,
|  | z |
| ) |  |

Use the al*Listener* function to set a listener parameter(s) as specified by the OpenAL enumerated type ALEnum.

Parameters

  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.
  x,y,z | XYZ floating-point coordinates.

Returns
  No return value.

See also
  al*GetListener*, alxSource*

Integer alxCreateSource | ( | audio- | assetId | ) |

Create a source from the specified asset Id.

Parameters

  audio-assetId | The asset Id to create the source from.

Returns
  The handle of the created source or 0 on error.

Integer alxGetAudioLength | ( | audio- | assetId | ) |

Use the alxGetAudioLength function to get the play-length of a specified resource sound file in milliseconds.

Parameters

  audio-assetId | The asset Id that specifies the audio file to check.

Returns
  Returns play-length of the audio file specified by audio-assetId in milliseconds.

See also
  alxGetStreamDuration, alxGetStreamPosition

Float alxGetChannelVolume | ( | channelID |  | ) |

Use the alxGetChannelVolume function to get the volume setting for a specified channel.

Parameters

  channelID | An integer value, equal to or greater than 0, corresponding to a valid audio channel.

Returns
  Returns volume [ 0.0, 1.0 ] for channel specified by channelID.

See also
  alxSetChannelVolume

Float alxGetListenerf | ( | ALEnum |  | ) |

Use the al*GetListener* function to get the current value of a listener parameter, as specified by ALEnum. Depending on the ALEnum you need to acquire, be sure to use the correct version (i.e. correct return type) of al*GetListener*.

Parameters

  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.

Returns
  Returns a float (alxGetListenerf), a vector of three floats (alGetListener3f), or an integer value respectively (alGetListeneri).

See also
  alxGetSource*

String alxGetSource3f | ( | handle | ,
|  | ALEnum |
| ) |  |

Use the alxGetSource* function to get the current value of a source parameter, as specified by ALEnum. Depending on the ALEnum you need to acquire, be sure to use the correct version (i.e. correct return type) of alxGetSource*.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.
  ALEnum | A string containing an OpenAL enumerated type name.

Returns
  Returns current value of parameter specified by ALEnum for source identified by handle.

See also
  alxSource*, al*GetListener*

Float alxGetSourcef | ( | handle | ,
|  | ALEnum |
| ) |  |

Use the alxGetSource* function to get the current value of a source parameter, as specified by ALEnum. Depending on the ALEnum you need to acquire, be sure to use the correct version (i.e. correct return type) of alxGetSource*.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.
  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.

Returns
  Returns current value of parameter specified by ALEnum for source identified by handle.

See also
  alxSource*, al*GetListener*

Integer alxGetSourcei | ( | handle | ,
|  | ALEnum |
| ) |  |

Use the alxGetSource* function to get the current value of a source parameter, as specified by ALEnum. Depending on the ALEnum you need to acquire, be sure to use the correct version (i.e. correct return type) of alxGetSource*.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.
  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.

Returns
  Returns current value of parameter specified by ALEnum for source identified by handle.

See also
  alxSource*, al*GetListener*

Float alxGetStreamDuration | ( | handle |  | ) |

Use the alxGetStreamDuration function to determine the length of a previously set up sound in seconds.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.

Returns
  Returns -1 for invalid handle, and 0.0 to N.M for valid handle indicating length of scheduled sound in seconds.

See also
  alxGetStreamPosition

Float alxGetStreamPosition | ( | handle |  | ) |

Use the alxGetStreamPosition function to get the current play position for a playing sound. Note, this value is a percentage equivalent to the percent of the sound that as already played.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.

Returns
  Returns -1 for invalid handle, and 0.0 to 1.0 for valid handle indicating what percentage of the sound file has been played.

See also
  alxGetStreamDuration

Boolean alxIsPlaying | ( | handle |  | ) |

Use the alxIsPlaying function to determine if the sound associated with a previously set-up sound handle is playing or not.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.

Returns
  Returns 1 if specified handle is being played, 0 otherwise.

See also
  alxPlay, alxStop, alxStopAll

void alxListenerf | ( | AlEnum | ,
|  | value |
| ) |  |

Use the al*Listener* function to set a listener parameter(s) as specified by the OpenAL enumerated type ALEnum.

Parameters

  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.
  value | An ALEnum type specific value corresponding to the new value for this enumerated parameters.

Returns
  No return value.

See also
  al*GetListener*, alxSource*

Boolean alxPause | ( | handle |  | ) |

Use the alxPause function to pause a currently playing sound as specified by handle.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.

Returns
  No return value.

See also
  alxIsPlaying, alxPlay, alxStopAll

Integer alxPlay | ( | audio- | assetId | ) |

Play the audio asset Id.

Parameters

  audio-assetId | The asset Id to play.

Returns
  The handle to the playing audio asset Id or 0 on error.

Boolean alxSetChannelVolume | ( | channelD | ,
|  | volume |
| ) |  |

Use the alxSetChannelVolume function to set a volume [ 0.0, 1.0 ] for the channel specified by channelID.

Parameters

  channelID | An integer value, equal to or greater than 0, corresponding to a valid audio channel.
  volume | A value between 0.0 and 1.0 specifying the new volume for the specified channel.

Returns
  Returns true on success and false on failure.

See also
  alxGetChannelVolume

void alxSource3f | ( | handle | ,
|  | ALEnum | ,
|  | x | ,
|  | y | ,
|  | z |
| ) |  |

Use the alxSource* function to set a source parameter(s) as specified by the OpenAL enumerated type ALEnum.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.
  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.
  x,y,z | XYZ floating-point coordinates.

Returns
  No return value.

See also
  alxGetSource*, al*Listener*

void alxSourcef | ( | handle | ,
|  | ALEnum | ,
|  | value |
| ) |  |

Use the alxSource* function to set a source parameter(s) as specified by the OpenAL enumerated type ALEnum.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.
  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.
  value | An ALEnum type specific value corresponding to the new value for this enumerated parameters.

Returns
  No return value.

See also
  alxGetSource*, al*Listener*

void alxSourcei | ( | handle | ,
|  | ALEnum | ,
|  | value |
| ) |  |

Use the alxSource* function to set a source parameter(s) as specified by the OpenAL enumerated type ALEnum.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.
  ALEnum | A string containing an OpenAL enumerated type name. See (above) table of ALEnum values for legal values.
  value | An ALEnum type specific value corresponding to the new value for this enumerated parameters.

Returns
  No return value.

See also
  alxGetSource*, al*Listener*

void alxStop | ( | handle |  | ) |

Use the alxStop function to stop a currently playing sound as specified by handle.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.

Returns
  No return value.

See also
  alxIsPlaying, alxPlay, alxStopAll

void alxStopAll | ( |  | ) |

Use the alxStopAll function to stop all currently playing sounds associated with registered handles.

Returns
  No return.

See also
  alxIsPlaying, alxPlay, alxStop

void alxUnpause | ( | handle |  | ) |

Use the alxUnpause function to resume playing a currently paused sound as specified by handle.

Parameters

  handle | The ID (a non-negative integer) corresponding to a previously set up sound source.

Returns
  No return value.

See also
  alxIsPlaying, alxPlay, alxStopAll

Boolean OpenALInitDriver | ( |  | ) |

Use the OpenALInitDriver function to initialize the OpenAL driver. This must be done before all other OpenAL operations.

Returns
  Returns true on successful initialization, false otherwise.

See also
  OpenALShutdownDriver

void OpenALRegisterExtensions | ( |  | ) |

Note
  Currently does nothing (possibly deprecated)

void OpenALShutdownDriver | ( |  | ) |

Use the OpenALShutdownDriver function to stop/shut down the OpenAL driver. After this is called, you must restart the driver with OpenALInitDriver to execute any new sound operations.

Returns
  No return value.

See also
  OpenALInitDriver