0
0

Hi !

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);
sound_error(iResult);
[/code:1m62tlg2]

I play the sound using something like this:

[code:1m62tlg2]iResult = FMOD_System_PlaySound(ptFSystem, FMOD_CHANNEL_FREE, sndSound, TRUE, &cnlChannelSounds[iChannel]);
sound_error(iResult);
[/code:1m62tlg2]

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!

  • You must to post comments
0
0

are you checking the return code from System::update and making sure all other functions succeed? Try the same code in an fmod example, and let me know if it works.

  • You must to post comments
0
0

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?

  • You must to post comments
0
0

you said 4.04, please be more specific with your version numbers, the latest stable branch is 4.06.09, so i can’t tell if you have the latest version or not, and my advice would simply be to upgrade.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.