From a65f63747b4602cf227f7c0699b01bba5f7cd8df Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Oct 2013 16:50:34 +0100 Subject: CrossFade: use negative value for invalid mixramp_delay Avoid NaN to allow -ffast-math. --- src/CrossFade.cxx | 2 +- src/CrossFade.hxx | 7 +++---- src/PlayerThread.cxx | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/CrossFade.cxx b/src/CrossFade.cxx index 76820fb45..098987d19 100644 --- a/src/CrossFade.cxx +++ b/src/CrossFade.cxx @@ -108,7 +108,7 @@ CrossFadeSettings::Calculate(float total_time, chunks_f = (float)af.GetTimeToSize() / (float)CHUNK_SIZE; - if (std::isnan(mixramp_delay) || !mixramp_start || !mixramp_prev_end) { + if (mixramp_delay <= 0 || !mixramp_start || !mixramp_prev_end) { chunks = (chunks_f * duration + 0.5); } else { /* Calculate mixramp overlap. */ diff --git a/src/CrossFade.hxx b/src/CrossFade.hxx index eb81ae152..c47db84e1 100644 --- a/src/CrossFade.hxx +++ b/src/CrossFade.hxx @@ -22,8 +22,6 @@ #include "Compiler.h" -#include - struct AudioFormat; struct CrossFadeSettings { @@ -35,14 +33,15 @@ struct CrossFadeSettings { float mixramp_db; /** - * The configured MixRapm delay [s]. + * The configured MixRapm delay [s]. A non-positive value + * disables MixRamp. */ float mixramp_delay; CrossFadeSettings() :duration(0), mixramp_db(0), - mixramp_delay(std::nanf("")) + mixramp_delay(-1) {} diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index 79efe7a9d..cb45885d5 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -779,7 +779,7 @@ Player::PlayNextChunk() other_chunk->tag); other_chunk->tag = nullptr; - if (std::isnan(pc.cross_fade.mixramp_delay)) { + if (pc.cross_fade.mixramp_delay <= 0) { chunk->mix_ratio = ((float)cross_fade_position) / cross_fade_chunks; } else { -- cgit v1.2.3