Added: Log warnings when setting excessively high max distances on sound sources
This commit is contained in:
parent
2e47ab7fe4
commit
dee18c2e72
3 changed files with 23 additions and 1 deletions
|
@ -413,6 +413,13 @@ bool CSourceFMod::getSourceRelativeMode() const
|
|||
// ******************************************************************
|
||||
void CSourceFMod::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */ )
|
||||
{
|
||||
static float maxSqrt = sqrt(std::numeric_limits<float>::max());
|
||||
if (maxdist >= maxSqrt)
|
||||
{
|
||||
nlwarning("SOUND_DEV (FMod): Ridiculously high max distance set on source");
|
||||
maxdist = maxSqrt;
|
||||
}
|
||||
|
||||
_MinDist= mindist;
|
||||
_MaxDist= maxdist;
|
||||
if(_FModChannel!=-1)
|
||||
|
|
|
@ -500,6 +500,14 @@ bool CSourceAL::getSourceRelativeMode() const
|
|||
void CSourceAL::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */)
|
||||
{
|
||||
nlassert( (mindist >= 0.0f) && (maxdist >= 0.0f) );
|
||||
|
||||
static float maxSqrt = sqrt(std::numeric_limits<float>::max());
|
||||
if (maxdist >= maxSqrt)
|
||||
{
|
||||
nlwarning("SOUND_DEV (OpenAL): Ridiculously high max distance set on source");
|
||||
maxdist = maxSqrt;
|
||||
}
|
||||
|
||||
_MinDistance = mindist;
|
||||
_MaxDistance = maxdist;
|
||||
|
||||
|
|
|
@ -793,7 +793,14 @@ bool CSourceXAudio2::getSourceRelativeMode() const
|
|||
void CSourceXAudio2::setMinMaxDistances(float mindist, float maxdist, bool /* deferred */)
|
||||
{
|
||||
// nldebug(NLSOUND_XAUDIO2_PREFIX "setMinMaxDistances %f, %f", mindist, maxdist);
|
||||
|
||||
|
||||
static float maxSqrt = sqrt(std::numeric_limits<float>::max());
|
||||
if (maxdist >= maxSqrt)
|
||||
{
|
||||
nlwarning("SOUND_DEV (XAudio2): Ridiculously high max distance set on source");
|
||||
maxdist = maxSqrt;
|
||||
}
|
||||
|
||||
_Emitter.InnerRadius = mindist;
|
||||
_MinDistance = mindist;
|
||||
_MaxDistance = maxdist;
|
||||
|
|
Loading…
Reference in a new issue