Move the isNaN function to soundmgr_openal_private.hxx to make it avaiable for the soundmanager too

This commit is contained in:
Erik Hofman 2016-06-27 12:35:58 +02:00
parent a3b3280123
commit 2321d9783d
3 changed files with 12 additions and 11 deletions

View File

@ -32,14 +32,6 @@
#include "soundmgr_openal_private.hxx" #include "soundmgr_openal_private.hxx"
#include "sample_group.hxx" #include "sample_group.hxx"
#if defined(HAVE_STD_ISNAN) && !defined(HAVE_ISNAN)
using std::isnan;
#endif
bool isNaN(float *v) {
return (isnan(v[0]) || isnan(v[1]) || isnan(v[2]));
}
SGSampleGroup::SGSampleGroup () : SGSampleGroup::SGSampleGroup () :
_smgr(NULL), _smgr(NULL),
_refname(""), _refname(""),

View File

@ -28,6 +28,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <simgear_config.h> # include <simgear_config.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
@ -388,9 +389,9 @@ void SGSoundMgr::update( double dt )
if (_changed) { if (_changed) {
#if 0 #if 0
if (isNaN(_at_up_vec)) printf("NaN in listener orientation\n"); if (isNaN(d->_at_up_vec)) printf("NaN in listener orientation\n");
if (isNaN(toVec3f(_absolute_pos).data())) printf("NaN in listener position\n"); if (isNaN(toVec3f(d->_absolute_pos).data())) printf("NaN in listener position\n");
if (isNaN(_velocity.data())) printf("NaN in listener velocity\n"); if (isNaN(toVec3f(_velocity).data())) printf("NaN in listener velocity\n");
#endif #endif
alListenerf( AL_GAIN, _volume ); alListenerf( AL_GAIN, _volume );
alListenerfv( AL_ORIENTATION, d->_at_up_vec ); alListenerfv( AL_ORIENTATION, d->_at_up_vec );

View File

@ -35,6 +35,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cmath>
#include <map> #include <map>
#if defined(__APPLE__) #if defined(__APPLE__)
@ -50,6 +51,9 @@
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#if defined(HAVE_STD_ISNAN) && !defined(HAVE_ISNAN)
using std::isnan;
#endif
class SGSampleGroup; class SGSampleGroup;
struct refUint { struct refUint {
@ -69,6 +73,10 @@ typedef std::map < std::string, SGSharedPtr<SGSampleGroup> > sample_group_map;
typedef sample_group_map::iterator sample_group_map_iterator; typedef sample_group_map::iterator sample_group_map_iterator;
typedef sample_group_map::const_iterator const_sample_group_map_iterator; typedef sample_group_map::const_iterator const_sample_group_map_iterator;
inline bool isNaN(float *v) {
return (isnan(v[0]) || isnan(v[1]) || isnan(v[2]));
}
#endif // _SG_SOUNDMGR_OPENAL_PRIVATE_HXX #endif // _SG_SOUNDMGR_OPENAL_PRIVATE_HXX