Why Reverb3D Objects affects 2D sounds?

Hi,
I have a problem using reverb in my application.
I’m planning to use Reverb3D objects for 3D sounds only, and let the music without reverb.

The problem is that 2D sounds are affected too, and while I can switch the effect off calling FMOD_Channel_SetReverbProperties(channel, 0, 0.0f), I see no way to disable reverb for EventInstances. The music event is without 3D panner, so is a 2D sound.

I tried to disable the reverb on all channels of the instance’s channel group:

FMODChannelGroup cgMusic = musicInstance.getChannelGroup();
cgMusic.setReverbWetness(0, 0.0f);
for(int i = 0; i<cgMusic.getNumChannels();++i){
    FMODChannel chan = cgMusic.getChannel(i);
    chan.setReverbWetness(0, 0.0f);
}

But the reverb is still there.
Thanks in advance.

ADDENDUM:
The documentation clearly say that 2D sound should not be affected by Reverb3D objects (from http://www.fmod.org/documentation/#content/generated/overview/3dreverb.htm):

“It is important to note that this technique will only place add reverb to 3D sounds. To place reverb effects on 2D sounds, you will need to make an additional to call System::setReverbProperties (which will incur a small CPU and memory hit).”

But my 2D sound are affected too, so maybe it’s a bug?

To repeat from support:

Sorry about the documentation, it will have to be updated a bit, I see it also mentions FMOD Ex.
The reverb zones in FMOD Ex used a 2nd physical reverb instance, now it uses slot 0, which is the same reverb used by the system. (there is no more special ambient background reverb setting any more, the background ambient reverb is the standard reverb you use with System::setReverbProperties.)

There is a mention of this in the documentation for System::createReverb3D

In FMOD Ex a special ‘ambient’ reverb setting was used when outside the influence of all reverb spheres. This function no longer exists.

In FMOD Studio System::setReverbProperties can be used to create an alternative reverb that can be used for 2D and background global reverb.

To avoid this reverb intefering with the reverb slot used by the 3d reverb, 2d reverb should use a different slot id with System::setReverbProperties, otherwise FMOD_ADVANCEDSETTINGS::reverb3Dinstance can also be used to place 3d reverb on a different physical reverb slot.

You can also turn off reverb with Channel::setReverbProperties and wet = 0, which I will add to the docs.

1 Like

Hi,
I should write this here too for completeness, I do not think that the answer resolves the issue properly.

I think something is really wrong in the C implementation, and I’m sure it is a bug.

  1. The reverb3Dinstance of FMOD_ADVANCEDSETTINGS given to FMOD_System_SetAdvancedSettings() is simply ignored.

a) No reverb instance is created with the instance index specified.

b) Any attempt to call FMOD_Channel_SetReverbProperties(channel, instance, 0.0f) with the same instance as reverb3Dinstance will fail with the following message:
“FMOD error 59 : Specified instance in FMOD_REVERB_PROPERTIES couldn’t be set. Most likely because it is an invalid instance number or the reverb doesn’t exist.”

If I manually create the instance for 3D reverb:
FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_HANGAR;
// instance3D == “reverb3Dinstance” in FMOD_ADVANCEDSETTINGS
FMOD_System_SetReverbProperties(fsystem, instance3D, &prop);

Then if I call
FMOD_Channel_SetReverbProperties(channel, instance3D, 0.0f);

No error is generated but the 3D reverb is NOT disabled!

If I create the instance 0 instead:
FMOD_System_SetReverbProperties(fsystem, 0, &prop);

Then I can disable the reverb with FMOD_Channel_SetReverbProperties(channel, 0, 0.0f)

But this do not make any sense to me, because I used another instance index, not 0.

  1. I cannot find a way to disable any reverb on 2D or 3D EventInstances.

In any case, this process of disabling manually the 3D reverb for 2D sounds is tedious (at best), illogical, and it is contrary to what the doc says.

From http://www.fmod.org/documentation/#content/generated/overview/3dreverb.htm:
“It is important to note that this technique will only place add reverb to 3D sounds. To place reverb effects on 2D sounds, you will need to make an additional to call System::setReverbProperties (which will incur a small CPU and memory hit).”

Clearly that statement is not correct, because Reverb3D objects affect ALL sounds, even 2D sounds.

Conclusion:
At the moment it seems that:
a) reverb3D is enabled in all sound by default, regardless if they are 3D or 2D (illogical)
b) reverb3D objects are stuck at instance 0. (no matter what you set with FMOD_ADVANCEDSETTINGS)
c) calling FMOD_Channel_SetReverbProperties do not work for 3D reverb instance different then 0.
d) there is no way to disable reverb on EventInstances.

Regards.​

Copy of the program example that shows the bug:

#include "stdio.h"
#include <fmod/fmod.h>
#include <fmod/fmod_errors.h>
#include <fmod/fmod_studio.h>

void check(FMOD_RESULT r) {
    if (r != FMOD_OK) printf("FMOD error %d : %s\n", r, FMOD_ErrorString(r));
}


int main() {
    FMOD_SYSTEM*    fsystem = 0;
    FMOD_SOUND*     sound   = 0;
    FMOD_CHANNEL*   channel = 0;
    FMOD_REVERB3D*  reverb3D = 0;
    FMOD_RESULT     r;
    FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_HANGAR;
    FMOD_VECTOR position = {0};

    // initialize
    r = FMOD_System_Create(&fsystem);                                          check(r);


    int instance3D = 2;
    FMOD_ADVANCEDSETTINGS settings = {0};
    settings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS);
    settings.reverb3Dinstance = instance3D;
    r = FMOD_System_SetAdvancedSettings(fsystem, &settings);                   check(r);


    r = FMOD_System_Init(fsystem, 128, FMOD_INIT_NORMAL, 0);                   check(r);

    // NO NEED TO CALL THIS, WE DO NOT WANT 2D sound with reverb
    //FMOD_REVERB_PROPERTIES prop2 = FMOD_PRESET_OFF;
    //r = FMOD_System_SetReverbProperties(fsystem, instance3D, &prop2);         check(r);

    // create a reverb3D object
    r = FMOD_System_CreateReverb3D(fsystem, &reverb3D);                        check(r);
    r = FMOD_Reverb3D_SetProperties(reverb3D, &prop);                          check(r);
    r = FMOD_Reverb3D_Set3DAttributes(reverb3D, &position, 10.0f, 40.0f);      check(r);
    r = FMOD_Reverb3D_SetActive(reverb3D, true );                              check(r);

    // load and play a 2D sound
    r = FMOD_System_CreateSound(fsystem, "2D_Sound.ogg", FMOD_CREATESTREAM, NULL, &sound);  check(r);
    r = FMOD_System_PlaySound(fsystem, sound, NULL, false, &channel);                       check(r);

    // this will return an error in case FMOD_System_SetReverbProperties is not called for instance "instance3D",
    // or it will not disable reverb if FMOD_System_SetReverbProperties is called!
    r = FMOD_Channel_SetReverbProperties(channel, instance3D,  0.0f);
    if (r != FMOD_OK){
        printf("FMOD error %d : %s\n", r, FMOD_ErrorString(r));
        exit(-1);
    }

    // play the sound
    FMOD_BOOL isPlaying = true;
    while(isPlaying){
        FMOD_System_Update(fsystem);
        FMOD_Channel_IsPlaying(channel, &isPlaying);
    }
    return 0;
}

The first answer is correct, there is just a bug with FMOD_ADVANCEDSETTINGS::reverb3Dinstance which is a separate issue, and will be fixed for the 1.07.03 release.