# Sound and Channel setMode function

**URL:** <https://qa.fmod.com/t/sound-and-channel-setmode-function/23067>\
**Category:** FMOD Engine\
**Created:** [June 23, 2025, 4:46am UTC](https://qa.fmod.com/t/sound-and-channel-setmode-function/23067 "2025-06-23T04:46:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kat2201](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kat2201](https://qa.fmod.com/u/kat2201)\
**Post date:** [June 23, 2025, 4:46am UTC](https://qa.fmod.com/t/sound-and-channel-setmode-function/23067/1 "2025-06-23T04:46:39Z")

</div>

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:

```cpp
// 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:

```cpp
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:)

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [June 26, 2025, 5:35am UTC](https://qa.fmod.com/t/sound-and-channel-setmode-function/23067/2 "2025-06-26T05:35:58Z")

</div>

> [@kat2201](#):
>
> Does setMode for channels and sound internally |= the mode?

There is a little more processing depending on what kind of object `setMode` is being called on and what mode is being set, but generally speaking yes, `|=` is used internally when setting `FMOD_MODE` flags.
