fix double promotions
Found with -Wdouble-promotion Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
committed by
Max Kellermann
parent
4c1cfca95b
commit
7715311117
@@ -53,7 +53,7 @@ struct IntegerToFloatSampleConvert {
|
||||
typedef typename SrcTraits::value_type SV;
|
||||
typedef typename DstTraits::value_type DV;
|
||||
|
||||
static constexpr DV factor = 1.0 / FloatToIntegerSampleConvert<F, Traits>::factor;
|
||||
static constexpr DV factor = 1.0f / FloatToIntegerSampleConvert<F, Traits>::factor;
|
||||
static_assert(factor > 0, "Wrong factor");
|
||||
|
||||
static constexpr DV Convert(SV src) noexcept {
|
||||
|
||||
+3
-1
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "PcmDither.cxx" // including the .cxx file to get inlined templates
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
template<SampleFormat F, class Traits=SampleTraits<F>>
|
||||
@@ -221,7 +223,7 @@ pcm_mix(PcmDither &dither, void *buffer1, const void *buffer2, size_t size,
|
||||
if (portion1 < 0)
|
||||
return pcm_add(buffer1, buffer2, size, format);
|
||||
|
||||
s = sin(M_PI_2 * portion1);
|
||||
s = std::sin((float)M_PI_2 * portion1);
|
||||
s *= s;
|
||||
|
||||
int vol1 = lround(s * PCM_VOLUME_1S);
|
||||
|
||||
@@ -122,7 +122,7 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate)
|
||||
ratio = float(new_sample_rate) / float(af.sample_rate);
|
||||
FormatDebug(soxr_domain,
|
||||
"samplerate conversion ratio to %.2lf",
|
||||
ratio);
|
||||
double(ratio));
|
||||
|
||||
/* libsoxr works with floating point samples */
|
||||
af.format = SampleFormat::FLOAT;
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ static constexpr int PCM_VOLUME_1S = PCM_VOLUME_1;
|
||||
static constexpr inline int
|
||||
pcm_float_to_volume(float volume) noexcept
|
||||
{
|
||||
return volume * PCM_VOLUME_1 + 0.5;
|
||||
return int(volume * PCM_VOLUME_1 + 0.5f);
|
||||
}
|
||||
|
||||
static constexpr inline float
|
||||
|
||||
Reference in New Issue
Block a user