Audio: SCR SoundManagerModule – Arma Reforger

From Bohemia Interactive Community
m (Lou Montana moved page Arma Reforger:Audio: SCR SoundManagerEntity to Arma Reforger:Audio: SCR SoundManagerModule: SCR_SoundManagerEntity class renamed to SCR_SoundManagerModule)
m (Some wiki formatting)
 
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}
{{Link/Enfusion|armaR|SCR_SoundManagerModule}} is a manager created to play simple one-shot sounds without the need for a {{Link/Enfusion|armaR|SoundComponent}} to exist on a given entity.
{{Link/Enfusion|armaR|SCR_SoundManagerModule}} is a module that plays simple one-shot sounds without the need for a {{Link/Enfusion|armaR|SoundComponent}} to exist on a given entity.
* {{hl|SCR_SoundManagerModule}} is a core entity present in every world.
* {{hl|SCR_SoundManagerModule}} is a core entity present in every world.
* If functions in {{hl|SCR_SoundManagerModule}} are enough for a given sound, prioritise it before adding SoundComponent on the entity.
* If functions in {{hl|SCR_SoundManagerModule}} are enough for a given sound, prioritise it before adding a {{Link/Enfusion|armaR|SoundComponent}} on the entity.
* If the entity already has {{Link/Enfusion|armaR|SoundComponent}} because of some other sound, do not use {{hl|SCR_SoundManagerModule}}.
* If the entity already has {{Link/Enfusion|armaR|SoundComponent}} because of some other sound, do not use {{hl|SCR_SoundManagerModule}}.
* Signals for a given sound can be set only before the sound playback and cannot be updated during the sound playback.
* Signals for a given sound can be set only before the sound playback and cannot be updated during the sound playback.
{{Feature|important|
{{Feature|important|
* {{hl|SCR_SoundManagerModule}} is '''not''' present on the console app.
* {{hl|SCR_SoundManagerModule}} is '''not''' present on headless applications (e.g dedicated server).
* Do '''not''' use {{hl|SCR_SoundManagerModule}} for UI sounds.
* Do '''not''' use {{hl|SCR_SoundManagerModule}} for UI sounds.
* Do '''not''' use {{hl|SCR_SoundManagerModule}} for managing looped sounds. Looped sounds always need {{hl|SoundComponent}} to work properly in multiplayer.
* Do '''not''' use {{hl|SCR_SoundManagerModule}} for managing looped sounds. Looped sounds always need {{hl|SoundComponent}} to work properly in multiplayer.
Line 20: Line 20:
** {{hl|GIsThirdPersonCam}}
** {{hl|GIsThirdPersonCam}}
** {{hl|GInterior}}
** {{hl|GInterior}}
* the Distance signal can be enabled using the flags in {{Link/Enfusion|armaR|SCR_AudioSourceConfiguration}}
* the {{hl|Distance}} signal can be enabled using the flags in {{Link/Enfusion|armaR|SCR_AudioSourceConfiguration}}
* any additional feature-specific signals can be added using the {{Link/Enfusion|armaR|SCR_AudioSource}} API if needed.
* any additional feature-specific signals can be added using the {{Link/Enfusion|armaR|SCR_AudioSource}} API if needed.



Latest revision as of 14:05, 3 November 2025

SCR_SoundManagerModule is a module that plays simple one-shot sounds without the need for a SoundComponent to exist on a given entity.

  • SCR_SoundManagerModule is a core entity present in every world.
  • If functions in SCR_SoundManagerModule are enough for a given sound, prioritise it before adding a SoundComponent on the entity.
  • If the entity already has SoundComponent because of some other sound, do not use SCR_SoundManagerModule.
  • Signals for a given sound can be set only before the sound playback and cannot be updated during the sound playback.
  • SCR_SoundManagerModule is not present on headless applications (e.g dedicated server).
  • Do not use SCR_SoundManagerModule for UI sounds.
  • Do not use SCR_SoundManagerModule for managing looped sounds. Looped sounds always need SoundComponent to work properly in multiplayer.
Before armareforger-symbol black.png 1.6.0, SCR_SoundManagerModule was named SCR_SoundManagerEntity.


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_SoundManagerModule contains methods that can work with this component directly.


Usage

SCR_SoundManagerModule 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 CreateAndPlayAudioSource(IEntity owner, string eventName)
  2. alternatively create SCR_AudioSource using CreateAudioSource(IEntity owner, string eventName) - checks if the sound is in the audible range and play SCR_AudioSource using PlayAudioSource(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: