summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-02-28 12:07:00 +0100
committerRobin Gareus <robin@gareus.org>2016-02-28 12:07:00 +0100
commit489753e866eba93e1263f61b716c31ca80a32181 (patch)
tree704199cf0906a48909f9e031bf6d6d032b288116 /libs
parent19dc2a09db7c42d2dfaaa8439f370936d178a6c3 (diff)
specialize isfinite for MSVC compat
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/automation_control.cc11
-rw-r--r--libs/vamp-plugins/ebu_r128_proc.cc20
2 files changed, 24 insertions, 7 deletions
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index 7e9b55976c..3629345d94 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -18,6 +18,7 @@
*/
+#include <math.h>
#include <iostream>
#include "ardour/automation_control.h"
#include "ardour/automation_watch.h"
@@ -29,6 +30,14 @@
#include "i18n.h"
+#ifdef COMPILER_MSVC
+#include <float.h>
+// C99 'isfinite()' is not available in MSVC.
+#define isfinite_local(val) (bool)_finite((double)val)
+#else
+#define isfinite_local isfinite
+#endif
+
using namespace std;
using namespace ARDOUR;
using namespace PBD;
@@ -199,7 +208,7 @@ AutomationControl::internal_to_interface (double val) const
double
AutomationControl::interface_to_internal (double val) const
{
- if (!isfinite (val)) {
+ if (!isfinite_local (val)) {
val = 0;
}
if (_desc.logarithmic) {
diff --git a/libs/vamp-plugins/ebu_r128_proc.cc b/libs/vamp-plugins/ebu_r128_proc.cc
index 5675171e9e..b18b9bc30e 100644
--- a/libs/vamp-plugins/ebu_r128_proc.cc
+++ b/libs/vamp-plugins/ebu_r128_proc.cc
@@ -24,6 +24,14 @@
#include <math.h>
#include "ebu_r128_proc.h"
+#ifdef COMPILER_MSVC
+#include <float.h>
+// C99 'isfinite()' is not available in MSVC.
+#define isfinite_local(val) (bool)_finite((double)val)
+#else
+#define isfinite_local isfinite
+#endif
+
namespace Fons {
float Ebu_r128_hist::_bin_power [100] = { 0.0f };
@@ -223,8 +231,8 @@ void Ebu_r128_proc::process (int nfram, const float *const *input)
_wrind &= 63;
_loudness_M = addfrags (8);
_loudness_S = addfrags (60);
- if (!isfinite(_loudness_M) || _loudness_M < -200.f) _loudness_M = -200.0f;
- if (!isfinite(_loudness_S) || _loudness_S < -200.f) _loudness_S = -200.0f;
+ if (!isfinite_local(_loudness_M) || _loudness_M < -200.f) _loudness_M = -200.0f;
+ if (!isfinite_local(_loudness_S) || _loudness_S < -200.f) _loudness_S = -200.0f;
if (_loudness_M > _maxloudn_M) _maxloudn_M = _loudness_M;
if (_loudness_S > _maxloudn_S) _maxloudn_S = _loudness_S;
if (_integr)
@@ -329,10 +337,10 @@ float Ebu_r128_proc::detect_process (int nfram)
}
if (_nchan == 1) si = 2 * sj;
else si += _chan_gain [i] * sj;
- S->_z1 = !isfinite(z1) ? 0 : z1;
- S->_z2 = !isfinite(z2) ? 0 : z2;
- S->_z3 = !isfinite(z3) ? 0 : z3;
- S->_z4 = !isfinite(z4) ? 0 : z4;
+ S->_z1 = !isfinite_local(z1) ? 0 : z1;
+ S->_z2 = !isfinite_local(z2) ? 0 : z2;
+ S->_z3 = !isfinite_local(z3) ? 0 : z3;
+ S->_z4 = !isfinite_local(z4) ? 0 : z4;
}
return si;
}