mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +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)
|
||||
{
|
||||
|
@ -1803,13 +1803,27 @@ float S_GetRolloff(FRolloffInfo *rolloff, float distance)
|
|||
{
|
||||
volume = S_SoundCurve[int(S_SoundCurveSize * (1 - volume))] / 127.f;
|
||||
}
|
||||
if (rolloff->RolloffType == ROLLOFF_Linear)
|
||||
if (logarithmic)
|
||||
{
|
||||
return volume;
|
||||
if (rolloff->RolloffType == ROLLOFF_Linear)
|
||||
{
|
||||
return volume;
|
||||
}
|
||||
else
|
||||
{
|
||||
return float((pow(10.f, volume) - 1.) / 9.);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (powf(10.f, volume) - 1.f) / 9.f;
|
||||
if (rolloff->RolloffType == ROLLOFF_Linear)
|
||||
{
|
||||
return float(log10(9. * volume + 1.));
|
||||
}
|
||||
else
|
||||
{
|
||||
return volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
#include "errors.h"
|
||||
#include "version.h"
|
||||
#include "w_wad.h"
|
||||
#include "g_level.h"
|
||||
#include "r_state.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -2040,11 +2040,11 @@ float F_CALLBACK FMODSoundRenderer::RolloffCallback(FMOD_CHANNEL *channel, float
|
|||
|
||||
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)
|
||||
{
|
||||
return S_GetRolloff(&schan->Rolloff, distance * schan->DistanceScale);
|
||||
return S_GetRolloff(&schan->Rolloff, distance * schan->DistanceScale, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -141,7 +141,7 @@ void I_InitSound ();
|
|||
void I_ShutdownSound ();
|
||||
|
||||
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);
|
||||
|
||||
extern ReverbContainer *DefaultEnvironments[26];
|
||||
|
|
Loading…
Reference in a new issue