Audio: SCR_SoundManagerEntity – Arma Reforger

From Bohemia Interactive Community
Jump to: navigation, search

SCR_SoundManagerEntity is a manager created to play simple one-shot sounds without the need for a SoundComponent to exist on a given entity.

  • SCR_SoundManagerEntity is a core entity present in every world.
  • If functions in SCR_SoundManagerEntity are enough for a given sound, prioritise it before adding SoundComponent on the entity.
  • If the entity already has SoundComponent because of some other sound, do not use SCR_SoundManagerEntity.
  • Signals for a given sound can be set only before the sound playback and cannot be updated during the sound playback.
  • SCR_SoundManagerEntity is not present on the console app.
  • Do not use SCR_SoundManagerEntity for UI sounds.
  • Do not use SCR_SoundManagerEntity for managing looped sounds. Looped sounds always need SoundComponent to work properly in multiplayer.


Signals

  • By default, the following Variables are used:
    • GCurrVehicleCoverage
    • GIsThirdPersonCam
    • GInterior
  • the Distance signal can be enabled using the flags in SCR_AudioSourceConfiguration
  • any additional feature-specific signals can be added using the SCR_AudioSource API if needed.


SCR_AudioSourceDefinition

  • Class used for setting sound parameters
  • This class is used in SCR_SoundDataComponent, or can be used in any feature in script if needed.
    • Sound Project (resource) - acp that contains m_sSoundEventName
    • Sound Event Name (string) - Sound event name
    • Static (flag) - If false, sound will follow the entity's position


SCR_SoundDataComponent

SCR_SoundDataComponent is the best way to configure multiple sounds

It contains an SCR_AudioSourceDefinition array for sounds configuration and SCR_SoundManagerEntity contains methods that can work with this component directly.


Usage

SCR_SoundManagerEntity Scripting

Sound is defined using SCR_AudioSourceConfiguration. You need it to play the sound. Two methods:

SCR_SoundDataComponent Workflow

Store the string event name in script, then two methods:

  1. create and play sound using cCreateAndPlayAudioSource(IEntity owner, string eventName)
  2. alternatively create SCR_AudioSource using cCreateAudioSource(IEntity owner, string eventName) - checks if the sound is in the audible range and play SCR_AudioSource using cPlayAudioSource(SCR_AudioSource audioSource) - sets occlusion signals, distance signal, triggers the sound, and adds SCR_AudioSource to the pool.

SCR_AudioSourceConfiguration Workflow

Validate a SCR_AudioSourceConfiguration instance, then two methods: