playSound3D: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (bug and workaround) |
m (template:command argument fix) |
||
Line 16: | Line 16: | ||
| '''playSound3D''' [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance] |= Syntax | | '''playSound3D''' [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance] |= Syntax | ||
|p1= [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance]: [[Array]] |= | |p1= [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance]: [[Array]] |PARAMETER1= | ||
|p2= filename: [[String]] - see [[Arma_3:_SoundFiles]] for available filenames |= | |p2= filename: [[String]] - see [[Arma_3:_SoundFiles]] for available filenames |PARAMETER2= | ||
|p3= soundSource: [[Object]] - the object emitting the sound. If "sound position" is specified this param is ignored |= | |p3= soundSource: [[Object]] - the object emitting the sound. If "sound position" is specified this param is ignored |PARAMETER3= | ||
|p4= isInside: [[Boolean]] (optional) Default: [[false]]|= | |p4= isInside: [[Boolean]] (optional) Default: [[false]]|PARAMETER4= | ||
|p5= soundPosition: [[PositionASL]] (optional) - position for sound emitter, will override "sound source" position. Default: [0,0,0] |= | |p5= soundPosition: [[PositionASL]] (optional) - position for sound emitter, will override "sound source" position. Default: [0,0,0] |PARAMETER5= | ||
|p6= volume: [[Number]] (optional) Default: 1 |= | |p6= volume: [[Number]] (optional) Default: 1 |PARAMETER6= | ||
|p7= soundPitch: [[Number]] (optional) - 1: Normal, 0.5: Darth Vader, 2: Chipmunks, etc. Default: 1 |= | |p7= soundPitch: [[Number]] (optional) - 1: Normal, 0.5: Darth Vader, 2: Chipmunks, etc. Default: 1 |PARAMETER7= | ||
|p8= distance: [[Number]] (optional) - How far is sound audible (0 <nowiki>=</nowiki> no max distance) Default: 0. |= | |p8= distance: [[Number]] (optional) - How far is sound audible (0 <nowiki>=</nowiki> no max distance) Default: 0. |PARAMETER8= | ||
| [[Nothing]] |= | | [[Nothing]] |RETURNVALUE= | ||
|x1= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]]]</code>|= | |x1= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]]]</code>|EXAMPLE1= | ||
|x2= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]], [[false]], [[getPosASL]] [[player]], 1, 1, 0]</code>|= | |x2= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]], [[false]], [[getPosASL]] [[player]], 1, 1, 0]</code>|EXAMPLE2= | ||
|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>[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent", [[player]]]; //no sound | <code>[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent", [[player]]]; //no sound | ||
[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent.wss", [[player]]]; //alarm</code>|= | [[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent.wss", [[player]]]; //alarm</code>|EXAMPLE3= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[say3D]], [[playSound]], [[say2D]], [[say]], [[setRandomLip]] |= | | [[say3D]], [[playSound]], [[say2D]], [[say]], [[setRandomLip]] |SEEALSO= | ||
| |= | | |MPBEHAVIOUR= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
}} | }} |
Revision as of 10:35, 7 April 2019
Description
- Description:
- Plays positional sound with given filename on every computer on network. At least 2 parameters must be specified.
- Groups:
- Uncategorised
Syntax
- Syntax:
- playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance]
- Parameters:
- [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance]: Array
- filename: String - see Arma_3:_SoundFiles for available filenames
- soundSource: Object - the object emitting the sound. If "sound position" is specified this param is ignored
- isInside: Boolean (optional) Default: false
- soundPosition: PositionASL (optional) - position for sound emitter, will override "sound source" position. Default: [0,0,0]
- volume: Number (optional) Default: 1
- soundPitch: Number (optional) - 1: Normal, 0.5: Darth Vader, 2: Chipmunks, etc. Default: 1
- distance: Number (optional) - How far is sound audible (0 = no max distance) Default: 0.
- Return Value:
- Nothing
Examples
- Example 1:
playSound3D ["A3\Sounds_F\sfx\blip1.wav", player]
- Example 2:
playSound3D ["A3\Sounds_F\sfx\blip1.wav", player, false, getPosASL player, 1, 1, 0]
- Example 3:
- Sound file extension must be specified even if a config entry has none:
playSound3D ["A3\Sounds_F\sfx\alarm_independent", player]; //no sound playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; //alarm
Additional Information
- See also:
- say3DplaySoundsay2DsaysetRandomLip
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
Notes
- Posted on September 23, 2013
- Killzone_Kid
- This command works well with addon sounds, however getting it to play mission sound files is a bit tricky. Follow this guide
Bottom Section
- Posted on September 26, 2014 - 09:18 (UTC)
- Killzone Kid
- Currently, playSound3D is not JIP compatible, so joining players will not hear the sound if is started before and is still playing when player joins.
- Posted on October 16, 2013 - 08:21 (UTC)
- Jacmac
- You need to get the correct path for custom mission sounds. Use missionConfigFile with BIS_fnc_trimString (to trim off "description.ext"), then add your mission's sound directory and sound file:
_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\some_sound_file.ogg"; playSound3D [_soundToPlay, _sourceObject, false, getPos _sourceObject, 10, 1, 50]; //Volume db+10, volume drops off to 0 at 50 meters from _sourceObject
- Posted on November 8, 2014 - 21:48 (UTC)
- Killzone Kid
-
When object is supplied but not a position, the position is taken from object, otherwise the position is taken from supplied position. That doesn't mean that when position is taken from object it is going to follow object when it changes position. The sound is generated at object position and it stays there.
One other important note: If soundSource param is objNull then his command develops the same bug with first person view as createSoundSource and say3D. If soundSource param is player then the bug is inverted. It seems that passing vehicle player as soundSource param is the only way to make it behave correctly when vehicles involved.