SoundSource

SoundSource objects are used to position sounds within your Scene. Sounds emitted can be either positional, directional or ambient; they can either be buffered or be played directly. Coupled with direct filtering and audio effects each sound source can be controlled independently to give the best audio experience to your users.

See Also

Static Variables


Name Description
object Parent Object where the SoundSource component is attached.
soundbuffer The active SoundBuffer Asset connected to the active SoundSource.
group Current SoundGroup the active SoundSource belongs to (if any).
source_id Internal source id given by the underlying sound API (OpenAL).
direct_filter Current AudioFilter connected to the active SoundSource.

Variables


Name Description
priority Value used by the sound queue system to determine the active SoundSource priority.
option PresetOption set for the active SoundSource.
speaker_type Defines the way the sound of the active SoundSource is emitted in space.
distance_model Custom DistanceModel to apply to the SoundSource.
pitch Controls the internal playback speed of the SoundBuffer associated to the active SoundSource.
gain Controls the volume of the active SoundSource.
air_absorption Multiplier to the amount of air absorption applied to the SoundSource.
room_rolloff_factor Additional factor to the SoundSource roll-off factor which is used to attenuate the reflected sound according to the source-listener distance.
min_gain Minimum amount of gain that can be applied to the SoundSource.
max_gain Defines the amplitude threshold and indicates the maximal gain that can be applied to the SoundSource.
rolloff_factor Affect the distance attenuation calculations based on inverse distance with the roll off.
max_distance Maximum distance the sound should still be heard.
reference_distance Act as the minimum distance the SoundSource should be emitting at full capacity.
cone_outer_gain Define the volume level outside of the cone defined by the outer angle.
cone_outer_gain_hf The high-frequency gain of the outside cone defined by the outer angle.
cone_inner_angle The inner angle of the directional SoundSource cone (in degree).
cone_outer_angle The outside angle of the directional SoundSource cone (in degree).
effectslot_mask Bit mask created from EffectSlot flags that tell the system which AudioEffect should be applied on the SoundSource.
velocity Current SoundSource velocity vector.
state Active playback state of the SoundSource.
warmstart The amount of time to seek before starting the playback of the SoundSource.
flags Bit mask of various options currently applied to the SoundSource.
auto_play Specify to the internal system that the SoundSource should start playing as soon it is loaded.
auto_loop Loop back the SoundSource when the end of the audio stream is reached.
auto_velocity Let the internal system calculate and update the velocity of the SoundSource.
auto_delete Automatically remove the SoundSource from the Scene it belong when it stops playing.
randomize_warmstart Randomize the warmstart time before playback.

Functions


Name Description
SetSoundBuffer Connect an existing SoundBuffer Asset to the active SoundSource.
EnableStreaming Enable SoundBuffer streaming.
Stop Helper to modify the current streaming buffer configuration.
DisableStreaming Disable streaming and destroy all allocated buffers.
Play Start/resume the active SoundSource playback.
Pause Pause the active SoundSource playback.
Stop Stop the active SoundSource playback.
Seek Move the audio stream to a specific time where 1.0 = 1sec..
GetPlaybackTime Return the current playback time for the active SoundSource.
GetDuration Helper function that return the total duration of the SoundSource audio stream.
GetBuffersQueued Function that returns the current amount of queued buffers.
SetAudioFilter Connect an AudioFilter to the existing SoundSource.
SetEffectSlotAudioFilter Assign an existing AudioFilter to a specific slot.
HideAll Retrieve the AudioFilter connected to a specific slot.
ClearEffectSlotAudioFilters Clear all the AudioFilter slots connected to the active SoundSource.
Sync Force to update and synchronize all AudioFilter slots associated with the current SoundSource.

Events


Callbacks Description
OnPlay This callback gets called when the SoundSource received the signal to start playing.
OnResume Triggered if the SoundSource was paused and then start playing again.
OnPause Triggered when the SoundSource gets paused.
OnStop Called when the SoundSource received the stop signal.

SpeakerType


Available types of speaker that dictate the way the SoundSource propagate sounds in your world.

  • kAmbient: Playback audio tracks without any attenuation. Regardless of the listener distance to the source, the sound is constant. It is typically used to play background music or other types of background sound effects.
  • kPositional: Can be defined as omnidirectional, this type launches sound in every direction and is attenuated based on the listener-source distance.
  • kDirectional: Emit sounds using an inner and outer cone; just like kPositional it is also affected by the distance with the listener. The two cones that form the directional sound source can be adjusted independently depending on the type of emission you are stimulating as well as the front and back gain.




NRG - API 2022.4.384543 - Fri Nov 4 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA