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