0
0

Here’s all the source code from a main() function in a test app. It just plays a 250ms-long sound every 100ms or so, and before each time prints out how many channels are active:

FMOD::System *Sound;
FMOD::Sound *fire;

FMOD::System_Create(&Sound);
Sound->init(100, FMOD_INIT_NORMAL, 0);
Sound->createSound("ARTILLER2.wav", FMOD_DEFAULT, 0, &fire);

int k = 12;

for(int i = 0; i < 1000; i++) {
    Sound->playSound(FMOD_CHANNEL_FREE, fire, false, 0);

    //Just blow about 10ms of processing time:
    for(int j = 0; j < 10000000; j++)
        k = (k * 4) / 3;

    int channels;
    Sound->getChannelsPlaying(&channels);
    printf("%i channels\n", channels);
}

The number just increases indefinitely, and after the first 32 sounds play, I don’t hear anything else until I get up to 100 (when it steals back one of the first 32).

Any idea what I’m doing wrong here?

  • You must to post comments
0
0

Hi beandog,

You have to call System::update to get the channels cleaned up. It is a requirement for FMOD to function properly that you call System::update regularly.

[quote:2sy4m601]//Just blow about 10ms of processing time:
for(int j = 0; j < 10000000; j++)
k = (k * 4) / 3; [/quote:2sy4m601]
Although this is not relevant to your issue, use should use Sleep(10) for this purpose. That way you wont waste CPU cycles and starve other threads/apps.

-Pete

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.