hi, this time i worked on the sound system, there is a lot of sound libs such as openal, bass, fmod, miles.
i chosed to use fmod ex because it is very advanced system and very easy to use.
i created sound manager to manage all sound creation in the game, i also add something called sound shader which is very similar to my material script.
sound shader is a script that let you to define specific parameters to one or few sounds and when you want to play the sound/s in that shader you just call CreateSoundFromShader(shaderNameInScript) which is a function inside sound manager and it will be played with all the attributes you specified in the script.
shakeData 0 zzzztsolggeedccbbbaaaaaaaa
shakeData 1 zzzztsolggeedccbbbaaaaaaaa
1) weapon_blaster_fire is sound shader name which we called from the code
min/max distance is the distance which the sound is audible
2) volumeDb is volume in decibels
3) frequentlyused is one of few flags that allow me to control few sound attributes such as occlusion, looping etc. this is used to cache the sound so it will be played from memory and wont be decompressed every time we want to play it
4) sound/weapons/blaster/fire01 and sound/weapons/blaster/fire02 is 2 sound files we wish to play while activating this sound shader. by default we chose randomly one of them.
5) shakeData is intensity of the sound in ascii form (z is loud, a is complete silence), i use it to change camera view based on the sound volume.
few of the sounds in the game must be played in relation to model animations, so to make it possible i created something called frame based event system, which allows you to specify events that will be triggered on specific animation frame/s.
for example, this is how i created shotgun reload sound events:
"RELOAD", "9", "sound", "weapon_shotgun_clipout",
"RELOAD", "22", "sound", "weapon_shotgun_clipin",
"RELOAD", "35", "sound", "weapon_shotgun_pump1",
"RELOAD", "38", "sound", "weapon_shotgun_pump2"
"RELOAD" is animation name
"9", "22", "35", "38" is frames to trigger the event
"sound" event type - all of them is sound
the last parameter is based on event type, in sound events its sound shader name