Audio: SCR SoundManagerModule – Arma Reforger

From Bohemia Interactive Community
m (Text replacement - "\{\{GameCategory\|armaR\|Modding\|(Guidelines|Tutorials)\|([^=↵]*)\}\}" to "{{GameCategory|armaR|Modding|$2|$1}}")
(Rename SCR_SoundManagerEntity to SCR_SoundManagerModule)
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}
{{Link/Enfusion|armaR|SCR_SoundManagerEntity}} 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 manager created to play simple one-shot sounds without the need for a {{Link/Enfusion|armaR|SoundComponent}} to exist on a given entity.
* {{hl|SCR_SoundManagerEntity}} is a core entity present in every world.
* {{hl|SCR_SoundManagerModule}} is a core entity present in every world.
* If functions in {{hl|SCR_SoundManagerEntity}} 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 SoundComponent on the entity.
* If the entity already has {{Link/Enfusion|armaR|SoundComponent}} because of some other sound, do not use {{hl|SCR_SoundManagerEntity}}.
* 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_SoundManagerEntity}} is '''not''' present on the console app.
* {{hl|SCR_SoundManagerModule}} is '''not''' present on the console app.
* Do '''not''' use {{hl|SCR_SoundManagerEntity}} for UI sounds.
* Do '''not''' use {{hl|SCR_SoundManagerModule}} for UI sounds.
* Do '''not''' use {{hl|SCR_SoundManagerEntity}} 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.
}}
}}
{{Feature|informative|Before {{GVI|armaR|1.6.0}}, {{hl|SCR_SoundManagerModule}} was named {{hl|SCR_SoundManagerEntity}}.}}




Line 35: Line 37:
{{Link/Enfusion|armaR|SCR_SoundDataComponent}} is the best way to configure multiple sounds
{{Link/Enfusion|armaR|SCR_SoundDataComponent}} is the best way to configure multiple sounds


It contains an {{hl|SCR_AudioSourceDefinition}} array for sounds configuration and {{hl|SCR_SoundManagerEntity}} contains methods that can work with this component directly.
It contains an {{hl|SCR_AudioSourceDefinition}} array for sounds configuration and {{hl|SCR_SoundManagerModule}} contains methods that can work with this component directly.




== Usage ==
== Usage ==


=== SCR_SoundManagerEntity Scripting ===
=== SCR_SoundManagerModule Scripting ===


Sound is defined using {{hl|SCR_AudioSourceConfiguration}}. You need it to play the sound. Two methods:
Sound is defined using {{hl|SCR_AudioSourceConfiguration}}. You need it to play the sound. Two methods:
Line 60: Line 62:


{{GameCategory|armaR|Modding|Audio|Guidelines}}
{{GameCategory|armaR|Modding|Audio|Guidelines}}
{{DISPLAYTITLE:Arma Reforger:Audio: SCR_SoundManagerEntity}}
{{DISPLAYTITLE:Arma Reforger:Audio: SCR_SoundManagerModule}}

Revision as of 11:15, 3 November 2025

SCR_SoundManagerModule is a manager created to play 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 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 the console app.
  • 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: