# setReverbProperties on master channel group causes stack overflow

**URL:** <https://qa.fmod.com/t/setreverbproperties-on-master-channel-group-causes-stack-overflow/11663>\
**Category:** FMOD Engine\
**Created:** [October 7, 2014, 7:39am UTC](https://qa.fmod.com/t/setreverbproperties-on-master-channel-group-causes-stack-overflow/11663 "2014-10-07T07:39:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bibendovsky](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/bibendovsky/32/487_2.png) [@bibendovsky](https://qa.fmod.com/u/bibendovsky)\
**Post date:** [October 7, 2014, 7:39am UTC](https://qa.fmod.com/t/setreverbproperties-on-master-channel-group-causes-stack-overflow/11663/1 "2014-10-07T07:39:43Z")

</div>

Calling **setReverbProperties** on default master channel group with non-zero wet level causes stack overflow in **update** method. Tested on version 1.05.02.

Code sample:

```
#include <cassert>
#include <fmod.hpp>
#include <thread>

int main()
{
    FMOD_RESULT fmod_result = FMOD_OK;

    FMOD::System* system = nullptr;
    fmod_result = FMOD::System_Create(&system);
    assert(fmod_result == FMOD_OK);

    unsigned int version = 0;
    fmod_result = system->getVersion(&version);
    assert(fmod_result == FMOD_OK);
    assert(version >= FMOD_VERSION);

    fmod_result = system->init(32, FMOD_INIT_NORMAL, nullptr);
    assert(fmod_result == FMOD_OK);

    FMOD::ChannelGroup* master_channel_group = nullptr;
    fmod_result = system->getMasterChannelGroup(&master_channel_group);
    assert(fmod_result == FMOD_OK);

    FMOD::Sound* sound = nullptr;
    fmod_result = system->createSound(
        "some_sound.wav",
        FMOD_2D | FMOD_LOOP_NORMAL,
        nullptr,
        &sound);
    assert(fmod_result == FMOD_OK);

    FMOD_REVERB_PROPERTIES reverb = FMOD_PRESET_SEWERPIPE;
    fmod_result = system->setReverbProperties(0, &reverb);
    assert(fmod_result == FMOD_OK);

    fmod_result = master_channel_group->setReverbProperties(0, 0.5F);
    assert(fmod_result == FMOD_OK);

    FMOD::Channel* channel = nullptr;

    fmod_result = system->playSound(
        sound, master_channel_group, false, &channel);

    std::chrono::milliseconds delay(100);

    while (true) {
        fmod_result = system->update();
        assert(fmod_result == FMOD_OK);

        std::this_thread::sleep_for(delay);
    }

    return 0;
}
```

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [October 10, 2014, 3:58am UTC](https://qa.fmod.com/t/setreverbproperties-on-master-channel-group-causes-stack-overflow/11663/2 "2014-10-10T03:58:06Z")

</div>

Thanks for the bug report, this will be fixed for our next release.

You cannot set the reverb properties of the master channel group because it is the target for the global reverb. Setting reverb properties on a channel group create a new send connection from the channel group to the reverb. If we allowed this with the master channel group it would create a circular dependency (as you can see from the stack overflow).

This will be disabled with the next release, however it will be fine for any other channel group.
