Browse Source

Merge branch 'master' into console

console
Nico de Poel 5 years ago
parent
commit
e0ad3ebd5e
  1. 14
      engine/Quake/snd_fmod.c

14
engine/Quake/snd_fmod.c

@ -211,7 +211,8 @@ whereby sounds can have varying degrees of distance rolloff.
static float F_CALL SND_FMOD_Attenuation(FMOD_CHANNELCONTROL *channelcontrol, float distance) static float F_CALL SND_FMOD_Attenuation(FMOD_CHANNELCONTROL *channelcontrol, float distance)
{ {
FMOD_RESULT result; FMOD_RESULT result;
soundslot_t *userdata;
void *userdata;
soundslot_t *soundslot;
float scale; float scale;
result = FMOD_Channel_GetUserData((FMOD_CHANNEL*)channelcontrol, &userdata); result = FMOD_Channel_GetUserData((FMOD_CHANNEL*)channelcontrol, &userdata);
@ -221,7 +222,8 @@ static float F_CALL SND_FMOD_Attenuation(FMOD_CHANNELCONTROL *channelcontrol, fl
return 1.0f; return 1.0f;
} }
scale = 1.0f - (distance * userdata->dist_mult);
soundslot = (soundslot_t *)userdata;
scale = 1.0f - (distance * soundslot->dist_mult);
if (scale < 0.0f) if (scale < 0.0f)
scale = 0.0f; scale = 0.0f;
@ -239,7 +241,8 @@ is properly cleared when the channel stops playing.
static FMOD_RESULT F_CALL SND_FMOD_Callback(FMOD_CHANNELCONTROL *channelcontrol, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2) static FMOD_RESULT F_CALL SND_FMOD_Callback(FMOD_CHANNELCONTROL *channelcontrol, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2)
{ {
FMOD_RESULT result; FMOD_RESULT result;
soundslot_t *userdata;
void *userdata;
soundslot_t *soundslot;
// We're only interested in notifications for when a channel is done playing a sound // We're only interested in notifications for when a channel is done playing a sound
if (controltype != FMOD_CHANNELCONTROL_CHANNEL || callbacktype != FMOD_CHANNELCONTROL_CALLBACK_END) if (controltype != FMOD_CHANNELCONTROL_CHANNEL || callbacktype != FMOD_CHANNELCONTROL_CALLBACK_END)
@ -251,9 +254,10 @@ static FMOD_RESULT F_CALL SND_FMOD_Callback(FMOD_CHANNELCONTROL *channelcontrol,
return FMOD_OK; return FMOD_OK;
} }
if (userdata->zone)
soundslot = (soundslot_t *)userdata;
if (soundslot->zone)
{ {
Z_Free(userdata);
Z_Free(soundslot);
} }
return FMOD_OK; return FMOD_OK;

Loading…
Cancel
Save