Increase Max Channels?

(Michael Barth) #1

Hi there! I develop under the Source Engine, and I created an ambient entity that utilizes FMOD’s 3D capabilities, since Source’s built in ambient_generic… Well, it sucks.

Basically I’m running into a problem where there’s a lot of sounds in a map, and each sound creates a channel for which to play on using FMOD_CHANNEL_FREE. After a certain amount of entities, or sounds, it seems they just stop playing. No more new sounds. It’s around the 40s, so I assume there’s a channel limit of 48 or something.

I was wondering if there’s any way to increase it or get around it.

This is the basic path that it follows:

result = GetMusicSystem()->GetSoundSystem()->createStream(szSound, FMOD_LOOP_NORMAL | FMOD_3D | FMOD_3D_LINEARROLLOFF, 0, &sound);
result = GetMusicSystem()->GetSoundSystem()->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);

These are the two main functions called with the exception of all the 3D logic and error checking. There’s no errors being outputted to the console. I’ve tried FMOD_CHANNEL_REUSE, and there’s no difference. For every instance of the entity there’s a new channel and sound created as part of a class. I just wonder if there’s a better way to go about this. Or if there’s a way to artificially increase the maximum amount of channels available. I’d greatly appreciate any help! Thanks!

(Brett Paterson) #2

FMOD’s virtual voice system goes off how loud the sound is, and if you have enough channels specified in System::init, nothing will ever get stolen, just prioritized based on how many real channels are active. If you set System::init to 1000 for example you should be fine, and the ones that are audible are up to you. They will either be based on distance in 3d, or boosted to the top with a priority value. (Sound::setDefaults)