Cold War Enhanced introduces a new way of playing sounds using the CWE Dynamic Sound Engine. CWE_DSE.exe is an external program, which reads data output from the game by Fwatch, and plays sounds according to that data. The program uses BASS Audio Library by Un4seen Developments. The library is free for noncommercial use such as usage in this mod. All sounds to be played must be located in the "\CWE\Sounds\" folder or its subfolders. The Dynamic Sound Engine also performs some specific additional tasks when needed.
CWE natively uses DSE to play weapon sounds. This allows for utilizing the Dynamic Sound System, so that different variations of weapon sounds are played depending from the distance to the listener and the environment of the area. Currently CWE DSS uses 35 different sounds for each weapon.
Why use an external program to play the sounds? Couldn't the original 'say' command be used?
There are serious limitations to the capabilities of the 'say' command. The game process can only play a limited amount of sounds at the same time, and often prioritizes nonscripted sounds over the sounds executed by the 'say' command. Therefore sounds are often missed and delayed. Using external program removes this problem, and also completely eliminates the lag caused by excessive use of the 'say' command. CWE_DSE also takes advantage of the multiple CPU cores in modern computers, whereas OFP can only use one core.
Using DSE to Play Custom Sounds
First create a new subfolder with a distinguishable (but not very long) name to the main sound folder: "\CWE\Sounds\", then put your sound files into that folder. The sound files must be in the 16-bit 44100 Hz PCM Wave format. Avoid long filenames and don't use spaces in your filenames.
Then in the game, call the function "\CWE_Functions\PlaySound.sqf" to play your sounds. Be very careful when using the function; too long filepath or erroneous input may cause the game to crash due to the limit of the loadfile path that Fwatch uses as input. The function's syntax is as follows:
[<soundName>,<soundFolder>,<posASL>,<delay>,<volume>,<stereoWidth>] call loadfile("\CWE_Functions\PlaySound.sqf")
- <soundName> is a string, consisting of the name of the sound without the folder path or file extension.
- <soundFolder> is a string, consisting of the name of your sound folder, without slashes.
- <posASL> is a 3D array consisting of the sound source's position above sea level.
- <delay> is the delay before executing the sound in seconds. Use negative value to automatically calculate the delay based on the distance to the listener.
- <volume> is the sound volume in some kind of pseudo-decibels. CWE weapons use a value of 160.
- <stereoWidth> determines the width of the stereo panning. Use 1 for full stereo, or 0 for mono. Any values between 0 and 1 are valid.
["MySound","MyFolder",(getposASL MyUnit),-1,85,1.0] call loadfile("\CWE_Functions\PlaySound.sqf")
(In the above example the actual filepath for the sound is: "..\CWE\Sounds\MyFolder\MySound.wav")