replay_gain_info, ...: use cmath instead of math.h in C++ mode

Fixes build problems with mingw32.
This commit is contained in:
Max Kellermann
2013-01-07 08:53:08 +01:00
parent 989c9a7317
commit 333a08ebf9
5 changed files with 20 additions and 8 deletions

View File

@@ -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);