setReverbProperties on master channel group causes stack overflow

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;
}

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.