0
0

Hi,

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.

Other example:
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.

Something like:
CreateSound("gunFire1.wav", max 3 in same time, mode, etc…)

Thanks for the help,
Dave

  • You must to post comments
0
0

Check out SoundGroup::setMaxAudible() in the documentation.

  • You must to post comments
0
0

Sorry but I can’t find that function in fmodex.pdf document.

Are you sure?

  • You must to post comments
0
0

From the 4.14.01 documentation:
[quote="docs":3a06kr5h]SoundGroup::setMaxAudible
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.

Syntax

FMOD_RESULT SoundGroup::setMaxAudible(
int maxaudible
);

Parameters

maxaudible

Number of playbacks to be audible at once. -1 = unlimited. 0 means no sounds in this group will succeed. Default = -1.

Return Values

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.

Remarks

SoundGroup::getNumPlaying can be used to determine how many instances of the sounds in the sound group are currently playing.

Platforms Supported

Win32, Win64, Linux, Linux64, Macintosh, Xbox, Xbox360, PlayStation 2, GameCube, PlayStation Portable, PlayStation 3, Wii, Solaris

See Also

System::createSoundGroup
SoundGroup::getMaxAudible
SoundGroup::getNumPlaying
SoundGroup::setMaxAudibleBehavior
SoundGroup::getMaxAudibleBehavior
System::getMasterSoundGroup [/quote:3a06kr5h]

  • You must to post comments
0
0

You probably want to set max audible behaviour as well using
[code:3o3w6ff0]FMOD_RESULT SoundGroup::setMaxAudibleBehavior(
FMOD_SOUNDGROUP_BEHAVIOR behavior
);[/code:3o3w6ff0]

I’d reccomend
[code:3o3w6ff0] FMOD_SOUNDGROUP_BEHAVIOR_MUTE [/code:3o3w6ff0]

  • You must to post comments
0
0

Thanks for your replies, we didn’t updated fmod to the latest, that’s why I couldn’t find SoundGroup :)

That is EXACTLY what I was looking for :)
Even better, if I have 3 random sounds for ricochet, I can put them in the same group! 😀

  • You must to post comments
0
0

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?

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.