mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 21:56:13 +00:00
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 */ )
|
||||
{
|
||||
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;
|
||||
|
||||
|
|
|
@ -794,6 +794,13 @@ void CSourceXAudio2::setMinMaxDistances(float mindist, float maxdist, bool /* de
|
|||
{
|
||||
// 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