mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-17 01:33:18 -05:00
Fix RAOP volume printing
Partial revert of 4ac75a316a9a6b6b92593f8e04fc845dcd54755e, going back to the previous way of computing the RAOP volume. Fixes printing when volume is 0.0 (would print -0.000000).
This commit is contained in:
parent
02ea6f4823
commit
1e9078182d
@ -1675,13 +1675,11 @@ raop_volume_convert(int volume)
|
|||||||
/* RAOP volume
|
/* RAOP volume
|
||||||
* -144.0 is off
|
* -144.0 is off
|
||||||
* 0 - -30.0 maps to 100 - 0
|
* 0 - -30.0 maps to 100 - 0
|
||||||
*
|
|
||||||
* Here, raop_volume is the absolute value
|
|
||||||
*/
|
*/
|
||||||
if (volume == 0)
|
if (volume == 0)
|
||||||
raop_volume = 144.0;
|
raop_volume = -144.0;
|
||||||
else
|
else
|
||||||
raop_volume = 30.0 - ((float)volume * 30.0) / 100.0;
|
raop_volume = -30.0 + ((float)volume * 30.0) / 100.0;
|
||||||
|
|
||||||
return raop_volume;
|
return raop_volume;
|
||||||
}
|
}
|
||||||
@ -1704,7 +1702,7 @@ raop_set_volume_internal(struct raop_session *rs, int volume, evrtsp_req_cb cb)
|
|||||||
raop_volume = raop_volume_convert(volume);
|
raop_volume = raop_volume_convert(volume);
|
||||||
|
|
||||||
/* Don't let locales get in the way here */
|
/* Don't let locales get in the way here */
|
||||||
ret = evbuffer_add_printf(evbuf, "volume: -%d.%06d", (int)raop_volume, (int)(1000000.0 * (raop_volume - (int)raop_volume)));
|
ret = evbuffer_add_printf(evbuf, "volume: %d.%06d", (int)raop_volume, -(int)(1000000.0 * (raop_volume - (int)raop_volume)));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_RAOP, "Out of memory for SET_PARAMETER payload (volume)\n");
|
DPRINTF(E_LOG, L_RAOP, "Out of memory for SET_PARAMETER payload (volume)\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user