summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pulse/volume.c2
-rw-r--r--src/pulsecore/sample-util.c4
-rw-r--r--src/pulsecore/sconv-s16le.c8
-rw-r--r--src/pulsecore/sconv.c4
-rw-r--r--src/pulsecore/time-smoother.c8
5 files changed, 13 insertions, 13 deletions
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 15938cbc..6907dc83 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -96,7 +96,7 @@ pa_volume_t pa_sw_volume_from_dB(double dB) {
if (isinf(dB) < 0 || dB <= -USER_DECIBEL_RANGE)
return PA_VOLUME_MUTED;
- return (pa_volume_t) ((dB/USER_DECIBEL_RANGE+1)*PA_VOLUME_NORM);
+ return (pa_volume_t) lrint((dB/USER_DECIBEL_RANGE+1)*PA_VOLUME_NORM);
}
double pa_sw_volume_to_dB(pa_volume_t v) {
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index b4e8bf4b..5119ebd3 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -105,7 +105,7 @@ static void calc_linear_integer_volume(int32_t linear[], const pa_cvolume *volum
pa_assert(volume);
for (channel = 0; channel < volume->channels; channel++)
- linear[channel] = (int32_t) (pa_sw_volume_to_linear(volume->values[channel]) * 0x10000);
+ linear[channel] = lrint(pa_sw_volume_to_linear(volume->values[channel]) * 0x10000);
}
static void calc_linear_float_volume(float linear[], const pa_cvolume *volume) {
@@ -132,7 +132,7 @@ static void calc_linear_integer_stream_volumes(pa_mix_info streams[], unsigned n
for (channel = 0; channel < spec->channels; channel++) {
pa_mix_info *m = streams + k;
- m->linear[channel].i = (int32_t) (pa_sw_volume_to_linear(m->volume.values[channel]) * linear[channel] * 0x10000);
+ m->linear[channel].i = lrint(pa_sw_volume_to_linear(m->volume.values[channel]) * linear[channel] * 0x10000);
}
}
}
diff --git a/src/pulsecore/sconv-s16le.c b/src/pulsecore/sconv-s16le.c
index 1a7448e6..159c4655 100644
--- a/src/pulsecore/sconv-s16le.c
+++ b/src/pulsecore/sconv-s16le.c
@@ -111,7 +111,7 @@ void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, int16_t *b) {
float v = *(a++);
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.f);
- s = (int16_t) (v * 0x7FFF);
+ s = (int16_t) lrintf(v * 0x7FFF);
*(b++) = INT16_TO(s);
}
@@ -134,7 +134,7 @@ void pa_sconv_s32le_from_float32ne(unsigned n, const float *a, int32_t *b) {
float v = *(a++);
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
- s = (int32_t) ((double) v * (double) 0x7FFFFFFF);
+ s = (int32_t) lrint((double) v * (double) 0x7FFFFFFF);
*(b++) = INT32_TO(s);
}
@@ -179,7 +179,7 @@ void pa_sconv_s16le_from_float32re(unsigned n, const float *a, int16_t *b) {
float v = *(a++);
v = PA_FLOAT32_SWAP(v);
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
- s = (int16_t) (v * 0x7FFF);
+ s = (int16_t) lrintf(v * 0x7FFF);
*(b++) = INT16_TO(s);
}
}
@@ -193,7 +193,7 @@ void pa_sconv_s32le_from_float32re(unsigned n, const float *a, int32_t *b) {
float v = *(a++);
v = PA_FLOAT32_SWAP(v);
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
- s = (int32_t) ((double) v * 0x7FFFFFFF);
+ s = (int32_t) lrint((double) v * 0x7FFFFFFF);
*(b++) = INT32_TO(s);
}
}
diff --git a/src/pulsecore/sconv.c b/src/pulsecore/sconv.c
index 733a46ae..6c4d420e 100644
--- a/src/pulsecore/sconv.c
+++ b/src/pulsecore/sconv.c
@@ -130,7 +130,7 @@ static void ulaw_from_float32ne(unsigned n, const float *a, uint8_t *b) {
float v = *(a++);
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
v *= 0x1FFF;
- *(b++) = st_14linear2ulaw((int16_t) v);
+ *(b++) = st_14linear2ulaw((int16_t) lrintf(v));
}
}
@@ -168,7 +168,7 @@ static void alaw_from_float32ne(unsigned n, const float *a, uint8_t *b) {
float v = *a;
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
v *= 0xFFF;
- *b = st_13linear2alaw((int16_t) v);
+ *b = st_13linear2alaw((int16_t) lrintf(v));
}
}
diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c
index b165f4a8..6a2ffaa6 100644
--- a/src/pulsecore/time-smoother.c
+++ b/src/pulsecore/time-smoother.c
@@ -284,7 +284,7 @@ static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) {
/* The requested point is right of the point where we wanted
* to be on track again, thus just linearly estimate */
- t = (int64_t) s->py + (int64_t) (s->dp * (double) (x - s->px));
+ t = (int64_t) s->py + (int64_t) llrint(s->dp * (double) (x - s->px));
if (t < 0)
t = 0;
@@ -313,7 +313,7 @@ static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) {
/* Move back from origin */
ty += (double) s->ey;
- *y = ty >= 0 ? (pa_usec_t) ty : 0;
+ *y = ty >= 0 ? (pa_usec_t) lrint(ty) : 0;
/* Horner scheme */
if (deriv)
@@ -360,7 +360,7 @@ void pa_smoother_put(pa_smoother *s, pa_usec_t x, pa_usec_t y) {
/* And calculate when we want to be on track again */
s->px = s->ex + s->adjust_time;
- s->py = s->ry + (pa_usec_t) (s->dp * (double) s->adjust_time);
+ s->py = s->ry + (pa_usec_t) lrint(s->dp * (double) s->adjust_time);
s->abc_valid = FALSE;
@@ -456,7 +456,7 @@ pa_usec_t pa_smoother_translate(pa_smoother *s, pa_usec_t x, pa_usec_t y_delay)
/* pa_log_debug("translate(%llu) = %llu (%0.2f)", (unsigned long long) y_delay, (unsigned long long) ((double) y_delay / nde), nde); */
- return (pa_usec_t) ((double) y_delay / nde);
+ return (pa_usec_t) lrint((double) y_delay / nde);
}
void pa_smoother_reset(pa_smoother *s) {