I’m using a sound when selecting an option in a menu. When press and hold down a key, the selected option starts to change quickly and the sound is played multiple times. After a while, the sound is no longer heard and some times even the music stops (the sounds have default priority and the music priority 0). If let go the key and hold down to it again, the sound would only be heard once (the first time). My guess is that I’m running out of channels, but, as the sound is quite short, shouldn’t FMOD get free channels each time some sound stops?
Right now I’m loading the sounds from memory using something similar to this (where sound_error is a function used to check if there has been any problem):
[code:1m62tlg2]iResult = FMOD_System_CreateSound(ptFSystem, pszPosition, FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESAMPLE | FMOD_OPENMEMORY, ptInfo, psndSound);
I play the sound using something like this:
[code:1m62tlg2]iResult = FMOD_System_PlaySound(ptFSystem, FMOD_CHANNEL_FREE, sndSound, TRUE, &cnlChannelSounds[iChannel]);
And I update FMOD System in every loop.
I’m using FMOD 4.04 in Suse 10.1 and gcc version 4.1.0, but I’ve also tested this (and had the same problems) in Windows 2000 and XP using Dev-C++.
Thanks for your help!
- pier_guillen asked 12 years ago
I found my bug (thanks for your reply!). Still, there’s something that confuses me. Once it was fixed, there was a small gap where no sound was heard. So I incremented the amount of channels, which helped reduce the gap and it was barely noticable. Just for testing, I incremented again the amount of channels and, to my surprise, this made that after a while the sounds weren’t heard or were really low. If I let go and start again, the were hearable again, but just for some time. Why is this? Is it because there are to many channels to be updated and my computer isn’t fast enough to process it?
- pier_guillen answered 12 years ago
Please login first to submit.