mirror of
https://github.com/owntone/owntone-server.git
synced 2025-12-05 23:33:13 -05:00
Downgrade volume computations to float (from double)
Although we lose precision, this is still enough for computing relative, absolute and RAOP volume and will make a difference on embedded CPUs.
This commit is contained in:
@@ -257,12 +257,12 @@ status_update(enum play_status status)
|
||||
static int
|
||||
rel_to_vol(int relvol)
|
||||
{
|
||||
double vol;
|
||||
float vol;
|
||||
|
||||
if (relvol == 100)
|
||||
return master_volume;
|
||||
|
||||
vol = ((double)relvol * (double)master_volume) / 100.0;
|
||||
vol = ((float)relvol * (float)master_volume) / 100.0;
|
||||
|
||||
return (int)vol;
|
||||
}
|
||||
@@ -270,12 +270,12 @@ rel_to_vol(int relvol)
|
||||
static int
|
||||
vol_to_rel(int volume)
|
||||
{
|
||||
double rel;
|
||||
float rel;
|
||||
|
||||
if (volume == master_volume)
|
||||
return 100;
|
||||
|
||||
rel = ((double)volume / (double)master_volume) * 100.0;
|
||||
rel = ((float)volume / (float)master_volume) * 100.0;
|
||||
|
||||
return (int)rel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user