Added: Log warnings when setting excessively high max distances on sound sources
This commit is contained in:
parent
2c3ec9880f
commit
2c07386ccf
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 */ )
|
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;
|
_MinDist= mindist;
|
||||||
_MaxDist= maxdist;
|
_MaxDist= maxdist;
|
||||||
if(_FModChannel!=-1)
|
if(_FModChannel!=-1)
|
||||||
|
|
|
@ -500,6 +500,14 @@ bool CSourceAL::getSourceRelativeMode() const
|
||||||
void CSourceAL::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */)
|
void CSourceAL::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */)
|
||||||
{
|
{
|
||||||
nlassert( (mindist >= 0.0f) && (maxdist >= 0.0f) );
|
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;
|
_MinDistance = mindist;
|
||||||
_MaxDistance = maxdist;
|
_MaxDistance = maxdist;
|
||||||
|
|
||||||
|
|
|
@ -793,7 +793,14 @@ bool CSourceXAudio2::getSourceRelativeMode() const
|
||||||
void CSourceXAudio2::setMinMaxDistances(float mindist, float maxdist, bool /* deferred */)
|
void CSourceXAudio2::setMinMaxDistances(float mindist, float maxdist, bool /* deferred */)
|
||||||
{
|
{
|
||||||
// nldebug(NLSOUND_XAUDIO2_PREFIX "setMinMaxDistances %f, %f", mindist, maxdist);
|
// 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;
|
_Emitter.InnerRadius = mindist;
|
||||||
_MinDistance = mindist;
|
_MinDistance = mindist;
|
||||||
_MaxDistance = maxdist;
|
_MaxDistance = maxdist;
|
||||||
|
|
Loading…
Reference in a new issue