diff options
Diffstat (limited to 'src/CrossFade.cxx')
-rw-r--r-- | src/CrossFade.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/CrossFade.cxx b/src/CrossFade.cxx index fe937e4ca..0bdcc43d6 100644 --- a/src/CrossFade.cxx +++ b/src/CrossFade.cxx @@ -23,6 +23,8 @@ #include "audio_format.h" #include "tag.h" +#include <cmath> + #include <assert.h> #include <string.h> #include <stdlib.h> @@ -82,9 +84,8 @@ static float mixramp_interpolate(char *ramp_list, float required_db) } /* If required db < any stored value, use the least. */ - if (isnan(last_db)) { + if (std::isnan(last_db)) return secs; - } /* Finally, interpolate linearly. */ secs = last_secs + (required_db - last_db) * (secs - last_secs) / (db - last_db); @@ -114,13 +115,14 @@ unsigned cross_fade_calc(float duration, float total_time, chunks_f = (float)audio_format_time_to_size(af) / (float)CHUNK_SIZE; - if (isnan(mixramp_delay) || !(mixramp_start) || !(mixramp_prev_end)) { + if (std::isnan(mixramp_delay) || !mixramp_start || !mixramp_prev_end) { chunks = (chunks_f * duration + 0.5); } else { /* Calculate mixramp overlap. */ mixramp_overlap = mixramp_interpolate(mixramp_start, mixramp_db - replay_gain_db) + mixramp_interpolate(mixramp_prev_end, mixramp_db - replay_gain_prev_db); - if (!isnan(mixramp_overlap) && (mixramp_delay <= mixramp_overlap)) { + if (!std::isnan(mixramp_overlap) && + mixramp_delay <= mixramp_overlap) { chunks = (chunks_f * (mixramp_overlap - mixramp_delay)); g_debug("will overlap %d chunks, %fs", chunks, mixramp_overlap - mixramp_delay); |