Hi, I have a question about the setMode function.
Does setMode for channels and sound internally |= the mode?
I.e. if I create a sound with FMOD_3D and then call setMode on the sound with FMOD_LOOP_NORMAL, would that then overwrite the FMOD_3D bits?
I would have expected that it does, so I found myself using a pattern similar to this:
// Must ensure that the channel is set up for 3D playback
FMOD_MODE mode;
ERRCHECK(channel->getMode(&mode));
if ((mode & FMOD_3D) == 0)
{
mode &= ~FMOD_2D;
mode |= FMOD_3D;
ERRCHECK(channel->setMode(mode));
}
This ensure that the previous bits are still set, but 2D has been changed to 3D if it wasn’t already.
Then I encountered this code in the 3D core example (Line 46 of 3d.cpp), and I got a bit confused:
result = system->createSound(Common_MediaPath("drumloop.wav"), FMOD_3D, 0, &sound1);
ERRCHECK(result);
result = sound1->set3DMinMaxDistance(0.5f * DISTANCEFACTOR, 5000.0f * DISTANCEFACTOR);
ERRCHECK(result);
result = sound1->setMode(FMOD_LOOP_NORMAL);
ERRCHECK(result);
This seems to imply that setMode doesn’t overwrite the existing mode?
Would appreciate some clarity, thank you:)