0
0

First off I’m a complete n00b… I just have been playing with FMOD EX in VC++ 6 and I have ran into a block wall here. My code seems to run fine for the first 32 voices played in this example. The sounds are all small and stop playing in under a second but after ive played 32 sounds the sounds start playing individually (cancelling out the other sounds). If I play with my maxchannels and crank it up the effect is worse. After a couple sounds, playSound doesnt play anything anymore. Heres my code:

[code:2czo03nz]

// IN CLASS HEADER

class cFmod_Parameter
{
public:
FMOD_RESULT result;
FMOD::System *system;
FMOD::Channel *channel;
FMOD::Sound *sound;
};

// IN MAIN
cFmod_Parameter cSound;
cFmod_Parameter cqSound;
cFmod_Parameter cwSound;
cFmod_Parameter ceSound;
cFmod_Parameter crSound;
cFmod_Parameter cuSound;
cFmod_Parameter ciSound;
cFmod_Parameter coSound;
cFmod_Parameter cpSound;

cSound.result = FMOD::System_Create(&cSound.system);        // Create the main system object.               QSOUND
if (cSound.result != FMOD_OK)
{
    MessageBox(
        NULL, 
        "FMOD Error!",
        "Error!", 
        MB_OK|MB_ICONEXCLAMATION);
    exit(-1);
}  
cSound.result = cSound.system->init(32, FMOD_INIT_NORMAL, 0);    // initialize FMoD. PROBLEM CHILD
if (cSound.result != FMOD_OK)
{
    MessageBox(NULL, "blown", "Error!", MB_OK|MB_ICONEXCLAMATION );

    exit(-1);
}

cSound.result = cSound.system->createSound("kayah.wav", FMOD_SOFTWARE, 0, &cqSound.sound);
cSound.result = cSound.system->createSound("roar.wav", FMOD_SOFTWARE, 0, &cwSound.sound);
cSound.result = cSound.system->createSound("maxim.wav", FMOD_SOFTWARE, 0, &ceSound.sound);
cSound.result = cSound.system->createSound("minim.wav", FMOD_SOFTWARE, 0, &crSound.sound);
cSound.result = cSound.system->createSound("bang.wav", FMOD_SOFTWARE, 0, &cuSound.sound);
cSound.result = cSound.system->createSound("my gong.wav", FMOD_SOFTWARE, 0, &ciSound.sound);
cSound.result = cSound.system->createSound("my ding.wav", FMOD_SOFTWARE, 0, &coSound.sound);
cSound.result = cSound.system->createSound("my alert.wav",
}

// I CALL THIS IN MY LOOP (replace the q for whatever other letter
// specified in createSound)

cqSound.result = cSound.system->playSound(FMOD_CHANNEL_FREE,
cqSound.sound,
false,
&cqSound.channel);

[/code:2czo03nz]

Any help is greatly appreciated. Anyone have any working sample code that I could use as a cheat sheet? I’m not worried about effects at all. Just play the sounds I tell you to! lol 😆

On a further note I’ve tried this on another machine with a better sound card and it does the same (although it does handle more hardware channels better)

Thanx

  • You must to post comments
0
0

You are playing the sound over and over and over? What are you using to trigger the sounds? (ie maybe a keypress?)

  • You must to post comments
0
0

Thanx for the response!

I’m sorry maybe I should of specified…
yes that is true
cqSound.sound = DIK_Q keypress oneshot

If I play < 32 sounds it is fine. After 32 keypresses it quits overlaying the sounds and breaks the paying sound on my keypress. The sounds still play but not simultaniously. Just 1 sound at a time after 32 sounds have been played. Do I have to somehow release them after they are played?

Thanx

  • You must to post comments
0
0

if you are going to use the same sounds over and over then you dont want to release the sounds…

For something like this I would use designated channels instead of FMOD_CHANNEL_FREE and make sure you initialize FMOD with the number of channels you want to use.

cSound.system->init(32, FMOD_INIT_NORMAL, 0);

notice the 32? once you reach that you cant play anymore. FMOD_CHANNEL_FREE will try to find the next available channel. maybe FMOD_CHANNEL_REUSE might work. But i would give each sound its own channel to be honest.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.