playSoundUI: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (2.12 mini-update)
 
(18 intermediate revisions by 3 users not shown)
Line 8: Line 8:
|gr1= Sounds
|gr1= Sounds


|descr= Plays given [[CfgSounds]] sound or sound file given by file path through a dedicated UI sound channel unaffected by the global mixer volumes. If the file path is given, the leading slash will be ignored.
|descr= Plays given [[CfgSounds]] sound or a [[Arma 3: Sound Files| sound file]] given by file path through a dedicated UI sound channel unaffected by the global mixer volumes. If the file path is given, the leading slash will be ignored.


|s1= [[playSoundUI]] [sound, volume, soundPitch]
|s1= [[playSoundUI]] [sound, volume, soundPitch, isEffect, offset]


|p1= sound: [[String]] - [[CfgSounds]] class or file as used in [[playSound3D]] (See [[Arma 3: Sound Files]] for available file names)
|p1= sound: [[String]] - [[CfgSounds]] class or file as used in [[playSound3D]] (see [[Arma 3: Sound Files]] for available file names)
|p2= volume: [[Number]] - (Optional, default 1) Sound volume. A value greater than 5 gets capped
|p2= volume: [[Number]] - (Optional, default 1) sound volume clamped in range 0..5
|p3= soundPitch: [[Number]] - (Optional, default 1)
|p3= soundPitch: [[Number]] - (Optional, default 1)
* 1.0 → normal  
* 1.0 → normal  
* 0.5 → Darth Vader
* 0.5 → Darth Vader
* 2.0 → Chipmunks
* 2.0 → Chipmunks
|p4= isEffect: [[Boolean]] - (Optional, default [[false]]) if [[true]], diverts sound through effects channel (see [[fadeSound]], [[soundVolume]])
|p5= offset: [[Number]] - (Optional, default 0) offset in seconds. Same as with [[playSound3D]]
|p5since= arma3 2.12


|r1= [[Nothing]]
|r1= [[Number]] - id of the sound (0..65535) since {{GVI|arma3|2.12|size= 0.75}} (was [[Nothing]] before that)


|x1= <code>[[playSoundUI]] ["Alarm", 0.5, 0.5];</code>
|x1= <sqf>playSoundUI ["Alarm", 0.5, 0.5];</sqf>


|x2= <code>[[playSoundUI]] ["A3\Sounds_F\sfx\blip1.wss"];</code>
|x2= <sqf>playSoundUI ["A3\Sounds_F\sfx\blip1.wss"];</sqf>


|x3= Sound file extension must be specified even if a config entry has none:
|x3= Sound file extension must be specified even if a config entry has none:
<code>[[playSoundUI]] ["A3\Sounds_F\sfx\alarm_independent", 5, 1]; {{cc|no sound}}
<sqf>
[[playSoundUI]] ["A3\Sounds_F\sfx\alarm_independent.wss", 5, 1]; {{cc|alarm}}</code>
playSoundUI ["A3\Sounds_F\sfx\alarm_independent", 5, 1]; // no sound
playSoundUI ["A3\Sounds_F\sfx\alarm_independent.wss", 5, 1]; // alarm
</sqf>


|seealso= [[say3D]] [[playSound]] [[say2D]] [[say]] [[createSoundSource]] [[setRandomLip]] [[getMissionPath]] [[playSound3D]]
|seealso= [[stopSound]] [[soundParams]] [[say3D]] [[playSound]] [[say2D]] [[say]] [[createSoundSource]] [[setRandomLip]] [[getMissionPath]] [[playSound3D]]
}}
}}

Latest revision as of 14:41, 20 July 2023

Hover & click on the images for description

Description

Description:
Plays given CfgSounds sound or a sound file given by file path through a dedicated UI sound channel unaffected by the global mixer volumes. If the file path is given, the leading slash will be ignored.
Groups:
Sounds

Syntax

Syntax:
playSoundUI [sound, volume, soundPitch, isEffect, offset]
Parameters:
sound: String - CfgSounds class or file as used in playSound3D (see Arma 3: Sound Files for available file names)
volume: Number - (Optional, default 1) sound volume clamped in range 0..5
soundPitch: Number - (Optional, default 1)
  • 1.0 → normal
  • 0.5 → Darth Vader
  • 2.0 → Chipmunks
isEffect: Boolean - (Optional, default false) if true, diverts sound through effects channel (see fadeSound, soundVolume)
since Arma 3 logo black.png2.12
offset: Number - (Optional, default 0) offset in seconds. Same as with playSound3D
Return Value:
Number - id of the sound (0..65535) since Arma 3 logo black.png2.12 (was Nothing before that)

Examples

Example 1:
playSoundUI ["Alarm", 0.5, 0.5];
Example 2:
playSoundUI ["A3\Sounds_F\sfx\blip1.wss"];
Example 3:
Sound file extension must be specified even if a config entry has none:
playSoundUI ["A3\Sounds_F\sfx\alarm_independent", 5, 1]; // no sound playSoundUI ["A3\Sounds_F\sfx\alarm_independent.wss", 5, 1]; // alarm

Additional Information

See also:
stopSound soundParams say3D playSound say2D say createSoundSource setRandomLip getMissionPath playSound3D

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note