Hello, I’m getting sound popping for 3D sounds that are played at a distance (so when their volume is low). The problem seems to be that the sounds are being played at full volume for a very short time, before the proper low volume is applied, producing the popping sound.
I’m using FMOD Studio 1.03.
Now some code in case I’m doing something wrong.
Here is how I’m initializing FMOD:
result = _system->init(512, FMOD_INIT_NORMAL | FMOD_INIT_VOL0_BECOMES_VIRTUAL, 0);
/* */
_system->createChannelGroup("effects", &_effects_channel);
Here is how I’m initializing sounds:
LOG_ERROR(_system->createSound(("audio\\" + filename).c_str(),
FMOD_3D | FMOD_3D_LINEARROLLOFF,
0, &sound));
if (sound){
LOG_ERROR(sound->set3DMinMaxDistance(320 * DISTANCEFACTOR, 1500.0f * DISTANCEFACTOR));
And here is how I’m playing sounds:
FMOD::Channel *channel = NULL;
LOG_ERROR(_system->playSound(sound, _effects_channel, true, &channel));
if (channel){
FMOD_VECTOR position;
FMOD_VECTOR vel;
vel.x = vel.y = vel.z = 0;
if (play3d){
position.x = pos.x;
position.y = pos.y;
position.z = pos.z;
} else {
position.x = 0;
position.y = 0;
position.z = 0;
channel->setMode(FMOD_3D_HEADRELATIVE);
}
LOG_ERROR(channel->set3DAttributes(&position, &vel));
LOG_ERROR(channel->setPaused(false));
}
Now, I’ve found a workaround, which is to add 5ms of silence to the start of every sound. However this adds unnecessary latency to the game sound events, which is a huge letdown.