mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-23 01:40:24 -05:00
Fix compilation with -Werror=float-conversion
Better make the conversions explicit so that we don't get any surprises. Fixes #4065
This commit is contained in:
parent
50870aac57
commit
1ae4374ccf
71 changed files with 286 additions and 284 deletions
|
|
@ -433,7 +433,7 @@ int midi_file_write_event(struct midi_file *mf, const struct midi_event *event)
|
|||
|
||||
tr = &mf->tracks[event->track];
|
||||
|
||||
tick = event->sec * (1000000.0 * mf->info.division) / (double)mf->tempo;
|
||||
tick = (uint32_t)(event->sec * (1000000.0 * mf->info.division) / (double)mf->tempo);
|
||||
|
||||
CHECK_RES(write_varlen(mf, tr, tick - tr->tick));
|
||||
tr->tick = tick;
|
||||
|
|
|
|||
|
|
@ -1069,7 +1069,7 @@ static int midi_play(struct data *d, void *src, unsigned int n_frames, bool *nul
|
|||
return res;
|
||||
}
|
||||
|
||||
frame = ev.sec * d->position->clock.rate.denom;
|
||||
frame = (uint32_t)(ev.sec * d->position->clock.rate.denom);
|
||||
if (frame < first_frame)
|
||||
frame = 0;
|
||||
else if (frame < last_frame)
|
||||
|
|
@ -1573,13 +1573,13 @@ static int setup_properties(struct data *data)
|
|||
nom = data->latency_value * data->rate;
|
||||
break;
|
||||
case unit_msec:
|
||||
nom = nearbyint((data->latency_value * data->rate) / 1000.0);
|
||||
nom = (unsigned int)nearbyint((data->latency_value * data->rate) / 1000.0);
|
||||
break;
|
||||
case unit_usec:
|
||||
nom = nearbyint((data->latency_value * data->rate) / 1000000.0);
|
||||
nom = (unsigned int)nearbyint((data->latency_value * data->rate) / 1000000.0);
|
||||
break;
|
||||
case unit_nsec:
|
||||
nom = nearbyint((data->latency_value * data->rate) / 1000000000.0);
|
||||
nom = (unsigned int)nearbyint((data->latency_value * data->rate) / 1000000000.0);
|
||||
break;
|
||||
case unit_samples:
|
||||
nom = data->latency_value;
|
||||
|
|
@ -1778,7 +1778,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case OPT_VOLUME:
|
||||
data.volume = atof(optarg);
|
||||
data.volume = (float)atof(optarg);
|
||||
break;
|
||||
default:
|
||||
goto error_usage;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ static void put_double(struct data *d, const char *key, double val)
|
|||
{
|
||||
char buf[128];
|
||||
put_fmt(d, key, "%s%s%s", NUMBER,
|
||||
spa_json_format_float(buf, sizeof(buf), val), NORMAL);
|
||||
spa_json_format_float(buf, sizeof(buf), (float)val), NORMAL);
|
||||
}
|
||||
|
||||
static void put_value(struct data *d, const char *key, const char *val)
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
|||
data.latency = atoi(optarg) * DEFAULT_RATE / SPA_MSEC_PER_SEC;
|
||||
break;
|
||||
case 'd':
|
||||
data.delay = atof(optarg);
|
||||
data.delay = (float)atof(optarg);
|
||||
break;
|
||||
case 'C':
|
||||
pw_properties_set(data.capture_props, PW_KEY_TARGET_OBJECT, optarg);
|
||||
|
|
|
|||
|
|
@ -182,8 +182,8 @@ static void dump_point(struct data *d, struct point *point)
|
|||
int64_t d1, d2;
|
||||
int64_t delay, period_usecs;
|
||||
|
||||
#define CLOCK_AS_USEC(cl,val) (val * (float)SPA_USEC_PER_SEC / (cl)->rate.denom)
|
||||
#define CLOCK_AS_SUSEC(cl,val) (val * (float)SPA_USEC_PER_SEC / ((cl)->rate.denom * (cl)->rate_diff))
|
||||
#define CLOCK_AS_USEC(cl,val) (int64_t)(val * (float)SPA_USEC_PER_SEC / (cl)->rate.denom)
|
||||
#define CLOCK_AS_SUSEC(cl,val) (int64_t)(val * (float)SPA_USEC_PER_SEC / ((cl)->rate.denom * (cl)->rate_diff))
|
||||
|
||||
delay = CLOCK_AS_USEC(&point->clock, point->clock.delay);
|
||||
period_usecs = CLOCK_AS_SUSEC(&point->clock, point->clock.duration);
|
||||
|
|
@ -193,7 +193,7 @@ static void dump_point(struct data *d, struct point *point)
|
|||
|
||||
if (d1 > period_usecs * 1.3 ||
|
||||
d2 > period_usecs * 1.3)
|
||||
d1 = d2 = period_usecs * 1.4;
|
||||
d1 = d2 = (int64_t)(period_usecs * 1.4);
|
||||
|
||||
/* 4 columns for the driver */
|
||||
fprintf(d->output, "%"PRIi64"\t%"PRIi64"\t%"PRIi64"\t%"PRIi64"\t",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue