0
0

The following is my code, where I played 2 sounds after I detect a collision between a planeHost and a planeEnemy.

My question is if I played the sound many times in one loop, like 30 times, then the ERRCHECK will return false. If I played the sound very few times, like 2 times. Then it works fine. Do I run out of Free chennels when I tried to play 30 times? Any ideas will be highly appreciated!!
[code:3l00p0t5]
planeHost->hit=true;
result = fmodSystem->playSound(FMOD_CHANNEL_FREE, soundHostBlast1, false, 0);
ERRCHECK(result);

planeEnemy[j].hit=true;
result = fmodSystem->playSound(FMOD_CHANNEL_FREE, soundEnemyBlast1, false, 0);
ERRCHECK(result);

fmodSystem->update();
[/code:3l00p0t5]

  • You must to post comments
0
0

What did you pass in for "maxchannels" in System::init? You are probably just playing more channels than you initialised with.

  • You must to post comments
0
0

[quote="chenpo":2nglk412]What did you pass in for "maxchannels" in System::init? You are probably just playing more channels than you initialised with.[/quote:2nglk412]

Really thanks for your reply. I have also thought about that. I used to use 100 for the Maxchannels. But even if I changed it to 800. It still give me the same mistake.

I don’t think that my program will use that amount of channels. Any idea?

  • You must to post comments
0
0

Hi,

Maybe the error message will give you more clues. What is the error code exactly ?

  • You must to post comments
0
0

[quote="harry":1927klef]Hi,

Maybe the error message will give you more clues. What is the error code exactly ?[/quote:1927klef]

The error is "A call to a standard soundcard driver failed, which could possibly mean a buy in the driver or resources were missing or exhausted.

  • You must to post comments
0
0

hi

I have exactly the same problem! I play a sound on a collision, but after it is played a few times it no longer plays!

I have a 45second clip playing in the background also, that continues to play (but I havent left to see if it will stop looping yet as that woul take about 30*45s). I have tried this with my onboard Realtek sound card, and on my PCI terratec and the same problem occurs. Both have the newest drivers avaliable.

I am rather stumped!

  • You must to post comments
0
0

Use FMOD_SOFTWARE or call setMaxHardwareChannels(16, 32) or maybe (16,16). The error is correct, it is your driver that is the problem. You can work around it by not using hardware all together or limiting the number of channels hardware can use at once.

  • You must to post comments
0
0

Hmmm, I now use

[code:47m0duch]system->init(32, FMOD_INIT_NORMAL, 0);[/code:47m0duch]

and it seems to be working fine. I am not sure why, but if it works it works right? … right >_>?

Thanks for the idea! I appreciate your reply.

  • You must to post comments
0
0

[quote="brett":1opnrb0y]Use FMOD_SOFTWARE or call setMaxHardwareChannels(16, 32) or maybe (16,16). The error is correct, it is your driver that is the problem. You can work around it by not using hardware all together or limiting the number of channels hardware can use at once.[/quote:1opnrb0y]

Thanks for your reply. But can you tell me a little bit more about how I use the FMod_Software? Thanks.

Here is my detailed code of using the system
initFSound
[code:1opnrb0y]result = FMOD::System_Create(&fmodSystem);
ERRCHECK(result);

result = fmodSystem->init(800, FMOD_INIT_NORMAL, 0); 
ERRCHECK(result);

result = fmodSystem->createSound("Sound/Fire.wav", FMOD_DEFAULT, 0, &soundFire);
ERRCHECK(result);[/code:1opnrb0y]

in the collisionDetection code
[code:1opnrb0y] planeHost->bullet[i].hit=true;
FMOD::Channel *channel;
result = fmodSystem->playSound(FMOD_CHANNEL_FREE, soundBulletHit1, true, &channel);
ERRCHECK(result);
result = channel->setVolume(0.25f); // Set the volume while it is paused.
ERRCHECK(result);
result = channel->setPaused(false); // This is where the sound really starts.
ERRCHECK(result);

                    planeEnemy[j].hit=true;
                    result = fmodSystem->playSound(FMOD_CHANNEL_FREE, soundEnemyBlast1, true, &channel);
                    ERRCHECK(result);
                    result = channel->setVolume(0.25f);      // Set the volume while it is paused.
                    ERRCHECK(result);
                    result = channel->setPaused(false);      // This is where the sound really starts.
                    ERRCHECK(result);[/code:1opnrb0y]

[/code]

  • You must to post comments
0
0

I used FMOD_SOFTWARE to create my sound, and now the program works. Still don’t know why I got the mistakes. It might be my hardware problems. But it doesn’t work in my two computers, both of which have the latest drivers installed.

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.