I am wondering if it is possible in Fmod to put a maximum playing instance on a sound, and put the other ones virtual.
Let say I throw a grenade and it destroyed 30 barrels. Each barrel play a sound. The same sound, just at different locations. But I want to limit those sounds to a maximum like 2 or 3. Without muting other sounds like the grenade explosions or else.
When I shoot a shotgun, every impact (8 of them) emit a sound. I don’t want to sort them myself when the shot occur because I don’t know if another player is not making impacts too that can be more important to hear.
Reasons for this:
In Hardware the PlaySound function create huge lag spikes if called to often in the same frame.
In Software it works fine, but all those sounds together create an ugly big one. That why I want to limit those, and not others like gun fire, explosion, etc
Reason I don’t want to make the check myself:
I have to pass all current playing sounds, check if it is the same sound, check how many instances are playing. If max is playing, replace the one with the lowest volume/fartest distance.
And I know FMod is also doing that on all the world with "virtual channels". And I want to do it per sample too.
CreateSound("gunFire1.wav", max 3 in same time, mode, etc…)
Thanks for the help,
- Daivuk asked 10 years ago
You probably want to set max audible behaviour as well using
[code:3o3w6ff0] FMOD_SOUNDGROUP_BEHAVIOR_MUTE [/code:3o3w6ff0]
- Guest answered 10 years ago
Forgive me if this is an obvious question, but what exactly is the difference between max audible and max playbacks? I’m having a hard time understanding this. This isn’t that "virtual event" concept that was talked about last year, is it?
From the 4.14.01 documentation:
Limits the number of concurrent playbacks of sounds in a sound group to the specified value.
After this, if the sounds in the sound group are playing this many times, any attepts to play more of the sounds in the sound group will by default fail with FMOD_ERR_MAXAUDIBLE.
Use SoundGroup::setMaxAudibleBehavior to change the way the sound playback behaves when too many sounds are playing. Muting, failing and stealing behaviors can be specified.
Number of playbacks to be audible at once. -1 = unlimited. 0 means no sounds in this group will succeed. Default = -1.
If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.
SoundGroup::getNumPlaying can be used to determine how many instances of the sounds in the sound group are currently playing.
Win32, Win64, Linux, Linux64, Macintosh, Xbox, Xbox360, PlayStation 2, GameCube, PlayStation Portable, PlayStation 3, Wii, Solaris
Please login first to submit.