mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- another #include fix for Linux.
- Added a 'logarithmic' parameter to S_GetRolloff. SVN r1235 (trunk)
This commit is contained in:
parent
4ecb892df3
commit
71dd0d0269
4 changed files with 24 additions and 7 deletions
|
@ -1778,7 +1778,7 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
float S_GetRolloff(FRolloffInfo *rolloff, float distance)
|
float S_GetRolloff(FRolloffInfo *rolloff, float distance, bool logarithmic)
|
||||||
{
|
{
|
||||||
if (rolloff == NULL)
|
if (rolloff == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1803,13 +1803,27 @@ float S_GetRolloff(FRolloffInfo *rolloff, float distance)
|
||||||
{
|
{
|
||||||
volume = S_SoundCurve[int(S_SoundCurveSize * (1 - volume))] / 127.f;
|
volume = S_SoundCurve[int(S_SoundCurveSize * (1 - volume))] / 127.f;
|
||||||
}
|
}
|
||||||
|
if (logarithmic)
|
||||||
|
{
|
||||||
if (rolloff->RolloffType == ROLLOFF_Linear)
|
if (rolloff->RolloffType == ROLLOFF_Linear)
|
||||||
{
|
{
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (powf(10.f, volume) - 1.f) / 9.f;
|
return float((pow(10.f, volume) - 1.) / 9.);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rolloff->RolloffType == ROLLOFF_Linear)
|
||||||
|
{
|
||||||
|
return float(log10(9. * volume + 1.));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include "g_level.h"
|
||||||
|
#include "r_state.h"
|
||||||
|
#include "cmdlib.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -2040,11 +2040,11 @@ float F_CALLBACK FMODSoundRenderer::RolloffCallback(FMOD_CHANNEL *channel, float
|
||||||
|
|
||||||
if (GRolloff != NULL)
|
if (GRolloff != NULL)
|
||||||
{
|
{
|
||||||
return S_GetRolloff(GRolloff, distance * GDistScale);
|
return S_GetRolloff(GRolloff, distance * GDistScale, true);
|
||||||
}
|
}
|
||||||
else if (chan->getUserData((void **)&schan) == FMOD_OK && schan != NULL)
|
else if (chan->getUserData((void **)&schan) == FMOD_OK && schan != NULL)
|
||||||
{
|
{
|
||||||
return S_GetRolloff(&schan->Rolloff, distance * schan->DistanceScale);
|
return S_GetRolloff(&schan->Rolloff, distance * schan->DistanceScale, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,7 +141,7 @@ void I_InitSound ();
|
||||||
void I_ShutdownSound ();
|
void I_ShutdownSound ();
|
||||||
|
|
||||||
void S_ChannelEnded(FISoundChannel *schan);
|
void S_ChannelEnded(FISoundChannel *schan);
|
||||||
float S_GetRolloff(FRolloffInfo *rolloff, float distance);
|
float S_GetRolloff(FRolloffInfo *rolloff, float distance, bool logarithmic);
|
||||||
FISoundChannel *S_GetChannel(void *syschan);
|
FISoundChannel *S_GetChannel(void *syschan);
|
||||||
|
|
||||||
extern ReverbContainer *DefaultEnvironments[26];
|
extern ReverbContainer *DefaultEnvironments[26];
|
||||||
|
|
Loading…
Reference in a new issue