|
Sound
A broad range of functionality for creating rich game audio. More...
Classes | |
class | SFXAmbience |
A datablock that describes an ambient sound space. More... | |
class | SFXController |
A sound source that drives multi-source playback. More... | |
class | SFXDescription |
A description for how a sound should be played. More... | |
class | SFXEmitter |
An invisible 3D object that emits sound. More... | |
class | SFXEnvironment |
Description of a reverb environment. More... | |
class | SFXParameter |
A sound channel value that can be bound to multiple sound sources. More... | |
class | SFXPlayList |
A datablock describing a playback pattern of sounds. More... | |
class | SFXProfile |
Encapsulates a single sound file for playback by the sound system. More... | |
class | SFXSound |
A sound controller that directly plays a single sound file. More... | |
class | SFXSource |
Playback controller for a sound source. More... | |
class | SFXSpace |
A volume in space that defines an ambient sound zone. More... | |
class | SFXState |
A boolean switch used to modify playlist behavior. More... | |
class | SFXTrack |
Abstract base class for sound data that can be played back by the sound system. More... | |
Modules | |
FMOD | |
Functionality specific to the FMOD SFX implementation. | |
Enumerations | |
enum | SFXChannel { Volume, Pitch, Priority, PositionX, PositionY, PositionZ, RotationX, RotationY, RotationZ, VelocityX, VelocityY, VelocityZ, ReferenceDistance, MaxDistance, ConeInsideAngle, ConeOutsideAngle, ConeOutsideVolume, Cursor, Status, User0, User1, User2, User3 } |
Channels are individual properties of sound sources that may be animated over time. More... | |
enum | SFXDistanceModel { Linear, Logarithmic } |
Type of volume distance attenuation curve. More... | |
enum | SFXPlayListLoopMode { All, Single } |
Playlist behavior when description is set to loop. More... | |
enum | SFXPlayListRandomMode { NotRandom, StrictRandom, OrderedRandom } |
Randomization pattern to apply to playlist slot playback order. More... | |
enum | SFXPlayListReplayMode { IgnorePlaying, RestartPlaying, KeepPlaying, StartNew, SkipIfPlaying } |
Behavior when hitting the play stage of a slot that is still playing from a previous cycle. More... | |
enum | SFXPlayListStateMode { StopWhenDeactivated, PauseWhenDeactivated, IgnoreWhenDeactivated } |
Reaction behavior when a state is changed incompatibly on a slot that has already started playing. More... | |
enum | SFXPlayListTransitionMode { None, Wait, WaitAll, Stop, StopAll } |
Playlist behavior when transitioning in and out of invididual slots. More... | |
enum | SFXStatus { Playing, Stopped, Paused } |
Playback status of sound source. More... | |
Functions | |
bool | sfxCreateDevice (string provider, string device, bool useHardware, int maxBuffers) |
Try to create a new sound device using the given properties. | |
SFXSource | sfxCreateSource (SFXTrack track) |
Create a new source that plays the given track. | |
SFXSource | sfxCreateSource (SFXTrack track, float x, float y, float z) |
Create a new source that plays the given track and position its 3D sounds source at the given coordinates (if it is a 3D sound). | |
SFXSound | sfxCreateSource (SFXDescription description, string filename) |
Create a temporary SFXProfile from the given description and filename and then create and return a new source that plays the profile. | |
SFXSound | sfxCreateSource (SFXDescription description, string filename, float x, float y, float z) |
Create a temporary SFXProfile from the given description and filename and then create and return a new source that plays the profile. Position the sound source at the given coordinates (if it is a 3D sound). | |
void | sfxDeleteDevice () |
Delete the currently active sound device and release all its resources. | |
void | sfxDeleteWhenStopped (SFXSource source) |
Mark the given source for deletion as soon as it moves into stopped state. | |
void | sfxDumpSources (bool includeGroups=false) |
Dump information about all current SFXSource instances to the console. | |
string | sfxDumpSourcesToString (bool includeGroups=false) |
Dump information about all current SFXSource instances to a string. | |
string | sfxGetActiveStates () |
Return a newline-separated list of all active states. | |
string | sfxGetAvailableDevices () |
Get a list of all available sound devices. | |
string | sfxGetDeviceInfo () |
Return information about the currently active sound device. | |
SFXDistanceModel | sfxGetDistanceModel () |
Get the falloff curve type currently being applied to 3D sounds. | |
float | sfxGetDopplerFactor () |
Get the current global doppler effect setting. | |
float | sfxGetRolloffFactor () |
Get the current global scale factor applied to volume attenuation of 3D sounds in the logarithmic model. | |
SFXSource | sfxPlay (SFXSource source) |
Start playback of the given source. | |
void | sfxPlay (SFXTrack track) |
Create a new play-once source for the given track and start playback of the source. | |
void | sfxPlay (SFXTrack track, float x, float y, float z) |
Create a new play-once source for the given track, position its 3D sound at the given coordinates (if the track's description is set up for 3D sound) and start playback of the source. | |
SFXSource | sfxPlayOnce (SFXTrack track) |
Create a play-once source for the given track. | |
SFXSource | sfxPlayOnce (SFXTrack track, float x, float y, float z, float fadeInTime=-1) |
Create a play-once source for the given given track and position the source's 3D sound at the given coordinates only if the track's description is set up for 3D sound). | |
SFXSource | sfxPlayOnce (SFXDescription description, string filename) |
Create a new temporary SFXProfile from the given description and filename, then create a play-once source for it and start playback. | |
SFXSource | sfxPlayOnce (SFXDescription description, string filename, float x, float y, float z, float fadeInTime=-1) |
Create a new temporary SFXProfile from the given description and filename, then create a play-once source for it and start playback. Position the source's 3D sound at the given coordinates (only if the description is set up for 3D sound). | |
void | sfxSetDistanceModel (SFXDistanceModel model) |
Set the falloff curve type to use for distance-based volume attenuation of 3D sounds. | |
void | sfxSetDopplerFactor (float value) |
Set the global doppler effect scale factor. | |
void | sfxSetRolloffFactor (float value) |
Set the global scale factor to apply to volume attenuation of 3D sounds in the logarithmic model. | |
void | sfxStop (SFXSource source) |
Stop playback of the given source. | |
void | sfxStopAndDelete (SFXSource source) |
Stop playback of the given source (if it is not already stopped) and delete the source. | |
Variables | |
int | $SFX::ambientUpdateTime |
Milliseconds spent on the last ambient audio update. | |
const int | $SFX::DEVICE_CAPS_DSPEFFECTS |
Sound device capability flag indicating that the sound device supports adding DSP effect chains to sounds. | |
const int | $SFX::DEVICE_CAPS_FMODDESIGNER |
Sound device capability flag indicating that the sound device supports FMOD Designer audio projects. | |
const int | $SFX::DEVICE_CAPS_MULTILISTENER |
Sound device capability flag indicating that the sound device supports multiple concurrent listeners. | |
const int | $SFX::DEVICE_CAPS_OCCLUSION |
Sound device capability flag indicating that the sound device implements sound occlusion. | |
const int | $SFX::DEVICE_CAPS_REVERB |
Sound device capability flag indicating that the sound device supports reverb. | |
const int | $SFX::DEVICE_CAPS_VOICEMANAGEMENT |
Sound device capability flag indicating that the sound device implements its own voice virtualization. | |
const int | $SFX::DEVICE_INFO_CAPS |
Index of device capability flags in device info string. | |
const int | $SFX::DEVICE_INFO_MAXBUFFERS |
Index of buffer limit number in device info string. | |
const int | $SFX::DEVICE_INFO_NAME |
Index of device name field in device info string. | |
const int | $SFX::DEVICE_INFO_PROVIDER |
Index of sound provider field in device info string. | |
const int | $SFX::DEVICE_INFO_USEHARDWARE |
Index of use hardware flag in device info string. | |
int | $SFX::numCulled |
Number of SFXSounds that are currently in virtualized playback mode. | |
int | $SFX::numPlaying |
Number of SFXSources that are currently in playing state. | |
int | $SFX::numSounds |
Number of SFXSound type objects (i.e. actual single-file sounds) that are currently instantiated. | |
int | $SFX::numSources |
Number of SFXSource type objects that are currently instantiated. | |
int | $SFX::numVoices |
Number of voices that are currently allocated on the sound device. | |
int | $SFX::parameterUpdateTime |
Milliseconds spent on the last SFXParameter update loop. | |
static ColorI | SFXEmitter::renderColorInnerCone |
The color with which to render dots in the inner sound cone (Editor only). | |
static ColorI | SFXEmitter::renderColorOuterCone |
The color with which to render dots in the outer sound cone (Editor only). | |
static ColorI | SFXEmitter::renderColorOutsideVolume |
The color with which to render dots outside of the outer sound cone (Editor only). | |
static ColorI | SFXEmitter::renderColorPlayingInRange |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is playing and in range of the listener. | |
static ColorI | SFXEmitter::renderColorPlayingOutOfRange |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is playing but out of the range of the listener. | |
static ColorI | SFXEmitter::renderColorRangeSphere |
The color of the range sphere with which to render sound emitters in the editor. | |
static ColorI | SFXEmitter::renderColorStoppedInRange |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is not playing but the emitter is in range of the listener. | |
static ColorI | SFXEmitter::renderColorStoppedOutOfRange |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is not playing and the emitter is out of range of the listener. | |
static bool | SFXEmitter::renderEmitters |
Whether to render enhanced range feedback in the editor on all emitters regardless of selection state. | |
static float | SFXEmitter::renderPointDistance |
The distance between individual points in the sound emitter rendering in the editor as the points move from the emitter's center away to maxDistance. | |
static float | SFXEmitter::renderRadialIncrements |
The stepping (in degrees) for the radial sweep along the axis of the XY plane sweep for sound emitter rendering in the editor. | |
static float | SFXEmitter::renderSweepIncrements |
The stepping (in degrees) for the radial sweep on the XY plane for sound emitter rendering in the editor. | |
int | $SFX::sourceUpdateTime |
Milliseconds spent on the last SFXSource update loop. |
Detailed Description
A broad range of functionality for creating rich game audio.
3D Audio
Streaming vs. Buffered Audio
- See also:
- SFXDescription::isStreaming
Interactive Audio
- See also:
- SFXPlayList
- SFXState
Ambient Audio
- See also:
- SFXAmbience
Audio Reverb
Please consult the EAX documentation for more information
- Note:
- Reverb currently only works with FMOD.
- See also:
- http://www.atc.creative.com/algorithms/eax20.pdf
- http://connect.creativelabs.com/developer/Gaming/Forms/AllItems.aspx
- SFXEnvironment
- SFXDescription::useCustomReverb
Supported Sound File Formats
- Note:
- When using FMOD, the sound system supports all formats implemented by FMOD. Before applying file lookup patterns to a sound file path, the file name is first passed unaltered to FMOD. This allows to, for example, use URLs for internet radio playback.
Providers and Devices
- FMOD
- OpenAL
- XAudio2
- DirectSound
- Null
Sound System Updates
Live Asset Updates of Sound Files
Enumeration Type Documentation
enum SFXChannel |
Channels are individual properties of sound sources that may be animated over time.
- See also:
- SFXParameter
- Enumerator:
Volume Channel controls volume level of attached sound sources.
- See also:
- SFXDescription::volume
Pitch Channel controls pitch of attached sound sources.
- See also:
- SFXDescription::pitch
Priority Channel controls virtualizaton priority level of attached sound sources.
- See also:
- SFXDescription::priority
PositionX Channel controls X coordinate of 3D sound position of attached sources.
PositionY Channel controls Y coordinate of 3D sound position of attached sources.
PositionZ Channel controls Z coordinate of 3D sound position of attached sources.
RotationX Channel controls X rotation (in degrees) of 3D sound orientation of attached sources.
RotationY Channel controls Y rotation (in degrees) of 3D sound orientation of attached sources.
RotationZ Channel controls Z rotation (in degrees) of 3D sound orientation of attached sources.
VelocityX Channel controls X coordinate of 3D sound velocity vector of attached sources.
VelocityY Channel controls Y coordinate of 3D sound velocity vector of attached sources.
VelocityZ Channel controls Z coordinate of 3D sound velocity vector of attached sources.
ReferenceDistance Channel controls reference distance of 3D sound of attached sources.
- See also:
- SFXDescription::referenceDistance
MaxDistance Channel controls max volume attenuation distance of 3D sound of attached sources.
- See also:
- SFXDescription::maxDistance
ConeInsideAngle Channel controls angle (in degrees) of 3D sound inner volume cone of attached sources.
- See also:
- SFXDescription::coneInsideAngle
ConeOutsideAngle Channel controls angle (in degrees) of 3D sound outer volume cone of attached sources.
- See also:
- SFXDescription::coneOutsideAngle
ConeOutsideVolume Channel controls volume outside of 3D sound outer cone of attached sources.
- See also:
- SFXDescription::coneOutsideVolume
Cursor Channel controls playback cursor of attached sound sources.
- Note:
- Be aware that different types of sound sources interpret play cursor positions differently or do not actually have play cursors (these sources will ignore the channel).
Status Channel controls playback status of attached sound sources.
The channel's value is rounded down to the nearest integer and interpreted in the following way:
- 1: Play
- 2: Stop
- 3: Pause
User0 Channel available for custom use. By default ignored by sources.
- Note:
- For FMOD Designer event sources (SFXFMODEventSource), this channel is used for event parameters defined in FMOD Designer and should not be used otherwise.
- See also:
- SFXSource::onParameterValueChange
User1 Channel available for custom use. By default ignored by sources.
- See also:
- SFXSource::onParameterValueChange
User2 Channel available for custom use. By default ignored by sources.
- See also:
- SFXSource::onParameterValueChange
User3 Channel available for custom use. By default ignored by sources.
- See also:
- SFXSource::onParameterValueChange
enum SFXDistanceModel |
Type of volume distance attenuation curve.
The distance model determines the falloff curve applied to the volume of 3D sounds over distance.
- Enumerator:
enum SFXPlayListLoopMode |
Playlist behavior when description is set to loop.
Randomization pattern to apply to playlist slot playback order.
- See also:
- SFXPlayList::random
- Enumerator:
Behavior when hitting the play stage of a slot that is still playing from a previous cycle.
- See also:
- SFXPlayList::replay
- Enumerator:
enum SFXPlayListStateMode |
Reaction behavior when a state is changed incompatibly on a slot that has already started playing.
- See also:
- SFXPlayList::stateMode
- Enumerator:
Playlist behavior when transitioning in and out of invididual slots.
Transition behaviors apply when the playback controller starts processing a playlist slot and when it ends processing a slot. Using transition behaviors, playback can be synchronized.
- Enumerator:
enum SFXStatus |
Playback status of sound source.
Function Documentation
bool sfxCreateDevice | ( | string | provider, | |
string | device, | |||
bool | useHardware, | |||
int | maxBuffers | |||
) |
Try to create a new sound device using the given properties.
If a sound device is currently initialized, it will be uninitialized first. However, be aware that in this case, if this function fails, it will not restore the previously active device but rather leave the sound system in an uninitialized state.
Sounds that are already playing while the new device is created will be temporarily transitioned to virtualized playback and then resume normal playback once the device has been created.
In the core scripts, sound is automatically set up during startup in the sfxStartup() function.
- Parameters:
-
provider The name of the device provider as returned by sfxGetAvailableDevices(). device The name of the device as returned by sfxGetAvailableDevices(). useHardware Whether to enabled hardware mixing on the device or not. Only relevant if supported by the given device. maxBuffers The maximum number of concurrent voices for this device to use or -1 for the device to pick its own reasonable default.
- Returns:
- True if the initialization was successful, false if not.
- Note:
- This function must be called before any of the sound playback functions can be used.
Create a new source that plays the given track.
The source will be returned in stopped state. Call SFXSource::play() to start playback.
In contrast to play-once sources, the source object will not be automatically deleted once playback stops. Call delete() to release the source object.
This function will automatically create the right SFXSource type for the given SFXTrack.
- Parameters:
-
track The track the source should play.
- Returns:
- A new SFXSource for playback of the given track or 0 if no source could be created from the given track.
- Note:
- Trying to create a source for a device-specific track type will fail if the currently selected device does not support the type. Example: trying to create a source for an FMOD Designer event when not running FMOD.
- Example:
// Create and play a source from a pre-existing profile: %source = sfxCreateSource( SoundFileProfile ); %source.play();
Create a new source that plays the given track and position its 3D sounds source at the given coordinates (if it is a 3D sound).
The source will be returned in stopped state. Call SFXSource::play() to start playback.
In contrast to play-once sources, the source object will not be automatically deleted once playback stops. Call delete() to release the source object.
This function will automatically create the right SFXSource type for the given SFXTrack.
- Parameters:
-
track The track the source should play. x The X coordinate of the 3D sound position. y The Y coordinate of the 3D sound position. z The Z coordinate of the 3D sound position.
- Returns:
- A new SFXSource for playback of the given track or 0 if no source could be created from the given track.
- Note:
- Trying to create a source for a device-specific track type will fail if the currently selected device does not support the type. Example: trying to create a source for an FMOD Designer event when not running FMOD.
- Example:
// Create and play a source from a pre-existing profile and position it at (100, 200, 300): %source = sfxCreateSource( SoundFileProfile, 100, 200, 300 ); %source.play();
SFXSound sfxCreateSource | ( | SFXDescription | description, | |
string | filename | |||
) |
Create a temporary SFXProfile from the given description and filename and then create and return a new source that plays the profile.
The source will be returned in stopped state. Call SFXSource::play() to start playback.
In contrast to play-once sources, the source object will not be automatically deleted once playback stops. Call delete() to release the source object.
- Parameters:
-
description The description to use for setting up the temporary SFXProfile. filename Path to the sound file to play.
- Returns:
- A new SFXSource for playback of the given track or 0 if no source or no temporary profile could be created.
- Example:
// Create a source for a music track: %source = sfxCreateSource( AudioMusicLoop2D, "art/sound/backgroundMusic" ); %source.play();
- See also:
- SFXProfile
SFXSound sfxCreateSource | ( | SFXDescription | description, | |
string | filename, | |||
float | x, | |||
float | y, | |||
float | z | |||
) |
Create a temporary SFXProfile from the given description and filename and then create and return a new source that plays the profile. Position the sound source at the given coordinates (if it is a 3D sound).
The source will be returned in stopped state. Call SFXSource::play() to start playback.
In contrast to play-once sources, the source object will not be automatically deleted once playback stops. Call delete() to release the source object.
- Parameters:
-
description The description to use for setting up the temporary SFXProfile. filename Path to the sound file to play. x The X coordinate of the 3D sound position. y The Y coordinate of the 3D sound position. z The Z coordinate of the 3D sound position.
- Returns:
- A new SFXSource for playback of the given track or 0 if no source or no temporary profile could be created.
- Example:
// Create a source for a music track and position it at (100, 200, 300): %source = sfxCreateSource( AudioMusicLoop3D, "art/sound/backgroundMusic", 100, 200, 300 ); %source.play();
- See also:
- SFXProfile
void sfxDeleteDevice | ( | ) |
Delete the currently active sound device and release all its resources.
SFXSources that are still playing will be transitioned to virtualized playback mode. When creating a new device, they will automatically transition back to normal playback.
In the core scripts, this is done automatically for you during shutdown in the sfxShutdown() function.
- See also:
- sfxCreateDevice
void sfxDeleteWhenStopped | ( | SFXSource | source | ) |
Mark the given source for deletion as soon as it moves into stopped state.
This function will retroactively turn the given source into a play-once source (see Play-Once Sources).
- Parameters:
-
source A sound source.
void sfxDumpSources | ( | bool | includeGroups = false |
) |
Dump information about all current SFXSource instances to the console.
The dump includes information about the playback status for each source, volume levels, virtualization, etc.
- Parameters:
-
includeGroups If true, direct instances of SFXSources (which represent logical sound groups) will be included. Otherwise only instances of subclasses of SFXSources are included in the dump.
- See also:
- SFXSource
- sfxDumpSourcesToString
string sfxDumpSourcesToString | ( | bool | includeGroups = false |
) |
Dump information about all current SFXSource instances to a string.
The dump includes information about the playback status for each source, volume levels, virtualization, etc.
- Parameters:
-
includeGroups If true, direct instances of SFXSources (which represent logical sound groups) will be included. Otherwise only instances of subclasses of SFXSources are included in the dump.
- Returns:
- A string containing a dump of information about all currently instantiated SFXSources.
- See also:
- SFXSource
- sfxDumpSources
string sfxGetActiveStates | ( | ) |
Return a newline-separated list of all active states.
- Returns:
- A list of the form where each element is the name of an active state object.
stateName1 NL stateName2 NL stateName3 ...
- Example:
// Disable all active states. foreach$( %state in sfxGetActiveStates() ) %state.disable();
string sfxGetAvailableDevices | ( | ) |
Get a list of all available sound devices.
The return value will be a newline-separated list of entries where each line describes one available sound device. Each such line will have the following format:
provider TAB device TAB hasHardware TAB numMaxBuffers
- provider: The name of the device provider (e.g. "FMOD").
- device: The name of the device as returned by the device layer.
- hasHardware: Whether the device supports hardware mixing or not.
- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit limit is exceeded, i.e. if there are more active sounds playing at any one time, then voice virtualization will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not be provided by the device itself; if not provided by the device, it will be provided by Torque's sound system.
- Returns:
- A newline-separated list of information about all available sound devices.
string sfxGetDeviceInfo | ( | ) |
Return information about the currently active sound device.
The return value is a tab-delimited string of the following format:
provider TAB device TAB hasHardware TAB numMaxBuffers TAB caps
- provider: The name of the device provider (e.g. "FMOD").
- device: The name of the device as returned by the device layer.
- hasHardware: Whether the device supports hardware mixing or not.
- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit limit is exceeded, i.e. if there are more active sounds playing at any one time, then voice virtualization will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not be provided by the device itself; if not provided by the device, it will be provided by Torque's sound system.
- caps: A bitfield of capability flags.
- Returns:
- A tab-separated list of properties of the currently active sound device or the empty string if no sound device has been initialized.
- See also:
- sfxCreateDevice
- sfxGetAvailableDevices
- $SFX::DEVICE_INFO_PROVIDER
- $SFX::DEVICE_INFO_NAME
- $SFX::DEVICE_INFO_USEHARDWARE
- $SFX::DEVICE_INFO_MAXBUFFERS
- $SFX::DEVICE_INFO_CAPS
- $SFX::DEVICE_CAPS_REVERB
- $SFX::DEVICE_CAPS_VOICEMANAGEMENT
- $SFX::DEVICE_CAPS_OCCLUSION
- $SFX::DEVICE_CAPS_DSPEFFECTS
- $SFX::DEVICE_CAPS_MULTILISTENER
- $SFX::DEVICE_CAPS_FMODDESIGNER
SFXDistanceModel sfxGetDistanceModel | ( | ) |
Get the falloff curve type currently being applied to 3D sounds.
- Returns:
- The current distance model type.
float sfxGetDopplerFactor | ( | ) |
Get the current global doppler effect setting.
- Returns:
- The current global doppler effect scale factor (>=0).
- See also:
- sfxSetDopplerFactor
float sfxGetRolloffFactor | ( | ) |
Get the current global scale factor applied to volume attenuation of 3D sounds in the logarithmic model.
- Returns:
- The current scale factor for logarithmic 3D sound falloff curves.
- See also:
- sfxGetDistanceModel
- SFXDistanceModel
Start playback of the given source.
This is the same as calling SFXSource::play() directly.
- Parameters:
-
source The source to start playing.
- Returns:
- source.
- Example:
// Create and play a source from a pre-existing profile: %source = sfxCreateSource( SoundFileProfile ); %source.play();
void sfxPlay | ( | SFXTrack | track | ) |
Create a new play-once source for the given track and start playback of the source.
This is equivalent to calling sfxCreateSource() on and SFXSource::play() on the resulting source.
- Parameters:
-
track The sound datablock to play.
- Returns:
- The newly created play-once source or 0 if the creation failed.
void sfxPlay | ( | SFXTrack | track, | |
float | x, | |||
float | y, | |||
float | z | |||
) |
Create a new play-once source for the given track, position its 3D sound at the given coordinates (if the track's description is set up for 3D sound) and start playback of the source.
This is equivalent to calling sfxCreateSource() on and SFXSource::play() on the resulting source.
- Parameters:
-
track The sound datablock to play. x The X coordinate of the 3D sound position. y The Y coordinate of the 3D sound position. z The Z coordinate of the 3D sound position.
- Returns:
- The newly created play-once source or 0 if the creation failed.
Create a play-once source for the given track.
Once playback has finished, the source will be automatically deleted in the next sound system update.
- Parameters:
-
track The sound datablock.
- Returns:
- A newly created temporary source in "Playing" state or 0 if the operation failed.
Create a play-once source for the given given track and position the source's 3D sound at the given coordinates only if the track's description is set up for 3D sound).
Once playback has finished, the source will be automatically deleted in the next sound system update.
- Parameters:
-
track The sound datablock. x The X coordinate of the 3D sound position. y The Y coordinate of the 3D sound position. z The Z coordinate of the 3D sound position. fadeInTime If >=0, this overrides the SFXDescription::fadeInTime value on the track's description.
- Returns:
- A newly created temporary source in "Playing" state or 0 if the operation failed.
- Example:
// Immediately start playing the given track. Fade it in to full volume over 5 seconds. sfxPlayOnce( MusicTrack, 0, 0, 0, 5.f );
SFXSource sfxPlayOnce | ( | SFXDescription | description, | |
string | filename | |||
) |
Create a new temporary SFXProfile from the given description and filename, then create a play-once source for it and start playback.
Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced otherwise by then, the temporary SFXProfile will also be deleted.
- Parameters:
-
description The description to use for playback. filename Path to the sound file to play.
- Returns:
- A newly created temporary source in "Playing" state or 0 if the operation failed.
- Example:
// Play a sound effect file once. sfxPlayOnce( AudioEffects, "art/sound/weapons/Weapon_pickup" );
SFXSource sfxPlayOnce | ( | SFXDescription | description, | |
string | filename, | |||
float | x, | |||
float | y, | |||
float | z, | |||
float | fadeInTime = -1 | |||
) |
Create a new temporary SFXProfile from the given description and filename, then create a play-once source for it and start playback. Position the source's 3D sound at the given coordinates (only if the description is set up for 3D sound).
Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced otherwise by then, the temporary SFXProfile will also be deleted.
- Parameters:
-
description The description to use for playback. filename Path to the sound file to play. x The X coordinate of the 3D sound position. y The Y coordinate of the 3D sound position. z The Z coordinate of the 3D sound position. fadeInTime If >=0, this overrides the SFXDescription::fadeInTime value on the track's description.
- Returns:
- A newly created temporary source in "Playing" state or 0 if the operation failed.
- Example:
// Play a sound effect file once using a 3D sound with a default falloff placed at the origin. sfxPlayOnce( AudioDefault3D, "art/sound/weapons/Weapon_pickup", 0, 0, 0 );
void sfxSetDistanceModel | ( | SFXDistanceModel | model | ) |
Set the falloff curve type to use for distance-based volume attenuation of 3D sounds.
- Parameters:
-
model The distance model to use for 3D sound.
- Note:
- This setting takes effect globally and is applied to all 3D sounds.
void sfxSetDopplerFactor | ( | float | value | ) |
Set the global doppler effect scale factor.
- Parameters:
-
value The new doppler shift scale factor.
- Precondition:
- value must be >= 0.
- See also:
- sfxGetDopplerFactor
void sfxSetRolloffFactor | ( | float | value | ) |
Set the global scale factor to apply to volume attenuation of 3D sounds in the logarithmic model.
- Parameters:
-
value The new scale factor for logarithmic 3D sound falloff curves.
- Precondition:
- value must be > 0.
- Note:
- This function has no effect if the currently distance model is set to SFXDistanceModel::Linear.
- See also:
- sfxGetDistanceModel
- SFXDistanceModel
void sfxStop | ( | SFXSource | source | ) |
Stop playback of the given source.
This is equivalent to calling SFXSource::stop().
- Parameters:
-
source The source to put into stopped state.
void sfxStopAndDelete | ( | SFXSource | source | ) |
Stop playback of the given source (if it is not already stopped) and delete the source.
The advantage of this function over directly calling delete() is that it will correctly handle volume fades that may be configured on the source. Whereas calling delete() would immediately stop playback and delete the source, this functionality will wait for the fade-out to play and only then stop the source and delete it.
- Parameters:
-
source A sound source.
Variable Documentation
int $SFX::ambientUpdateTime |
int $SFX::DEVICE_CAPS_DSPEFFECTS |
Sound device capability flag indicating that the sound device supports adding DSP effect chains to sounds.
- See also:
- sfxGetDeviceInfo
- Note:
- This is not yet used by the sound system.
- See also:
- sfxGetDeviceInfo
int $SFX::DEVICE_CAPS_FMODDESIGNER |
Sound device capability flag indicating that the sound device supports FMOD Designer audio projects.
- Note:
- This is exclusive to FMOD. If the FMOD Event DLLs are in place and could be successfully loaded, this flag will be set after initializating an FMOD audio device.
- See also:
- sfxGetDeviceInfo
int $SFX::DEVICE_CAPS_MULTILISTENER |
Sound device capability flag indicating that the sound device supports multiple concurrent listeners.
- Note:
- Currently only FMOD implements this.
- See also:
- sfxGetDeviceInfo
int $SFX::DEVICE_CAPS_OCCLUSION |
Sound device capability flag indicating that the sound device implements sound occlusion.
- Note:
- This is not yet used by the sound system.
- See also:
- sfxGetDeviceInfo
int $SFX::DEVICE_CAPS_REVERB |
Sound device capability flag indicating that the sound device supports reverb.
- Note:
- Currently only FMOD implements this.
- See also:
- sfxGetDeviceInfo
int $SFX::DEVICE_CAPS_VOICEMANAGEMENT |
Sound device capability flag indicating that the sound device implements its own voice virtualization.
For these devices, the sound system will deactivate its own voice management and leave voice virtualization entirely to the device.
- Note:
- Currently only FMOD implements this.
- See also:
- sfxGetDeviceInfo
int $SFX::DEVICE_INFO_CAPS |
Index of device capability flags in device info string.
- See also:
- sfxGetDeviceInfo
- sfxGetAvailableDevices
int $SFX::DEVICE_INFO_MAXBUFFERS |
Index of buffer limit number in device info string.
- See also:
- sfxGetDeviceInfo
- sfxGetAvailableDevices
int $SFX::DEVICE_INFO_NAME |
Index of device name field in device info string.
- See also:
- sfxGetDeviceInfo
- sfxGetAvailableDevices
int $SFX::DEVICE_INFO_PROVIDER |
Index of sound provider field in device info string.
- See also:
- sfxGetDeviceInfo
- sfxGetAvailableDevices
int $SFX::DEVICE_INFO_USEHARDWARE |
Index of use hardware flag in device info string.
- See also:
- sfxGetDeviceInfo
- sfxGetAvailableDevices
int $SFX::numCulled |
Number of SFXSounds that are currently in virtualized playback mode.
int $SFX::numPlaying |
Number of SFXSources that are currently in playing state.
int $SFX::numSounds |
Number of SFXSound type objects (i.e. actual single-file sounds) that are currently instantiated.
int $SFX::numSources |
Number of SFXSource type objects that are currently instantiated.
int $SFX::numVoices |
Number of voices that are currently allocated on the sound device.
int $SFX::parameterUpdateTime |
ColorI SFXEmitter::renderColorInnerCone [static, inherited] |
The color with which to render dots in the inner sound cone (Editor only).
ColorI SFXEmitter::renderColorOuterCone [static, inherited] |
The color with which to render dots in the outer sound cone (Editor only).
ColorI SFXEmitter::renderColorOutsideVolume [static, inherited] |
The color with which to render dots outside of the outer sound cone (Editor only).
ColorI SFXEmitter::renderColorPlayingInRange [static, inherited] |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is playing and in range of the listener.
ColorI SFXEmitter::renderColorPlayingOutOfRange [static, inherited] |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is playing but out of the range of the listener.
ColorI SFXEmitter::renderColorRangeSphere [static, inherited] |
The color of the range sphere with which to render sound emitters in the editor.
ColorI SFXEmitter::renderColorStoppedInRange [static, inherited] |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is not playing but the emitter is in range of the listener.
ColorI SFXEmitter::renderColorStoppedOutOfRange [static, inherited] |
The color with which to render a sound emitter's marker cube in the editor when the emitter's sound is not playing and the emitter is out of range of the listener.
bool SFXEmitter::renderEmitters [static, inherited] |
Whether to render enhanced range feedback in the editor on all emitters regardless of selection state.
float SFXEmitter::renderPointDistance [static, inherited] |
The distance between individual points in the sound emitter rendering in the editor as the points move from the emitter's center away to maxDistance.
float SFXEmitter::renderRadialIncrements [static, inherited] |
The stepping (in degrees) for the radial sweep along the axis of the XY plane sweep for sound emitter rendering in the editor.
float SFXEmitter::renderSweepIncrements [static, inherited] |
The stepping (in degrees) for the radial sweep on the XY plane for sound emitter rendering in the editor.
int $SFX::sourceUpdateTime |
Milliseconds spent on the last SFXSource update loop.