aboutsummaryrefslogtreecommitdiffstats
path: root/src/CrossFade.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-30 17:10:38 +0100
committerMax Kellermann <max@duempel.org>2013-10-30 17:20:34 +0100
commitc4d3030d24d25f7fa8ea30fc108dc7df415fbc02 (patch)
treef252f20e85897ce496c882135ccf179e1d6dd25a /src/CrossFade.cxx
parentc6f101884b282a938c9c996ff613153520367b2a (diff)
downloadmpd-c4d3030d24d25f7fa8ea30fc108dc7df415fbc02.tar.gz
mpd-c4d3030d24d25f7fa8ea30fc108dc7df415fbc02.tar.xz
mpd-c4d3030d24d25f7fa8ea30fc108dc7df415fbc02.zip
CrossFade: eliminate NaN from mixramp_interpolate()
Use a boolean flag instead.
Diffstat (limited to '')
-rw-r--r--src/CrossFade.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/CrossFade.cxx b/src/CrossFade.cxx
index 8e6baf885..601d74dc2 100644
--- a/src/CrossFade.cxx
+++ b/src/CrossFade.cxx
@@ -25,8 +25,6 @@
#include "util/Domain.hxx"
#include "Log.hxx"
-#include <cmath>
-
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -37,7 +35,8 @@ gcc_pure
static float
mixramp_interpolate(const char *ramp_list, float required_db)
{
- float last_db = nan(""), last_secs = 0;
+ float last_db = 0, last_secs = 0;
+ bool have_last = false;
/* ramp_list is a string of pairs of dBs and seconds that describe the
* volume profile. Delimiters are semi-colons between pairs and spaces
@@ -71,11 +70,12 @@ mixramp_interpolate(const char *ramp_list, float required_db)
if (db < required_db) {
last_db = db;
last_secs = secs;
+ have_last = true;
continue;
}
/* If required db < any stored value, use the least. */
- if (std::isnan(last_db))
+ if (!have_last)
return secs;
/* Finally, interpolate linearly. */