Merge branch 'pipewire-roundf'

Closes #262
This commit is contained in:
Daniel Eklöf 2023-01-21 15:50:22 +01:00
commit d1776714ed
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 6 additions and 4 deletions

View file

@ -44,11 +44,13 @@
* dwl module reporting only the last part of the title ([#251][251])
* i3/sway: regression; persistent workspaces shown twice
([#253][253]).
* pipewire: use roundf instead of ceilf for more accuracy ([#262][262])
[239]: https://codeberg.org/dnkl/yambar/issues/239
[241]: https://codeberg.org/dnkl/yambar/issues/241
[251]: https://codeberg.org/dnkl/yambar/pulls/251
[253]: https://codeberg.org/dnkl/yambar/issues/253
[262]: https://codeberg.org/dnkl/yambar/issues/262
### Security

View file

@ -35,8 +35,8 @@ struct output_informations {
/* informations */
bool muted;
uint8_t linear_volume; /* classic volume */
uint8_t cubic_volume; /* volume a la pulseaudio */
uint16_t linear_volume; /* classic volume */
uint16_t cubic_volume; /* volume a la pulseaudio */
char *name;
char *description;
char *form_factor; /* headset, headphone, speaker, ..., can be null */
@ -478,8 +478,8 @@ node_events_param(void *userdata, __attribute__((unused)) int seq, __attribute__
total += values[i];
float base_volume = total / n_values;
output_informations->linear_volume = ceilf(base_volume * 100);
output_informations->cubic_volume = ceilf(cbrtf(base_volume) * 100);
output_informations->linear_volume = roundf(base_volume * 100);
output_informations->cubic_volume = roundf(cbrtf(base_volume) * 100);
}
}