3

I am trying to set up my Sound Manager (FMOD) to play a background music and other action sounds on different channels, as I understand that this is the only way of having simultaneous sounds with FMOD.... My setup is below, if I call playRepeat and then playOnce the first track stops!

void SoundMgr::addSound(char *path, string n){
    Sound* s;
    fmodsys->createSound(path, FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &s);


    soundMap.insert(pair<string,Sound*>(n, s));
}

void SoundMgr::playOnce(string name){

    fmodsys->playSound(FMOD_CHANNEL_FREE,
        soundMap.find(name)->second, true, &fmodchn);
    fmodchn->setPosition(0, FMOD_TIMEUNIT_PCM);
    fmodchn->setPaused(false);
}

void SoundMgr::playRepeat(string name){

    fmodsys->playSound(FMOD_CHANNEL_FREE,
        soundMap.find(name)->second, true, &backChn);
    backChn->setMode(FMOD_LOOP_NORMAL);
    backChn->setPosition(0, FMOD_TIMEUNIT_PCM);
    backChn->setPaused(false);

}

...despite the fact that I AM using two separate channels.... am I missing something?

Alex
  • 561
  • 2
  • 9
  • 28

1 Answers1

4

The issue was that I was only initialising FMOD with one channel

fmodsys->init(1,FMOD_INIT_NORMAL,0);

Changing that to a higher number made the setup above work ok!

Alex
  • 561
  • 2
  • 9
  • 28