pass volume as an integer to scripts

This commit is contained in:
Felix Kratz 2022-10-09 16:35:09 +02:00
parent 673259897d
commit bc4de68167

View file

@ -737,7 +737,7 @@ void bar_manager_handle_volume_change(struct bar_manager* bar_manager, float vol
struct env_vars env_vars; struct env_vars env_vars;
env_vars_init(&env_vars); env_vars_init(&env_vars);
char volume_str[16]; char volume_str[16];
snprintf(volume_str, 16, "%.2f", volume); snprintf(volume_str, 16, "%d", (int)(volume*100. + 0.5));
env_vars_set(&env_vars, string_copy("INFO"), string_copy(volume_str)); env_vars_set(&env_vars, string_copy("INFO"), string_copy(volume_str));
bar_manager_custom_events_trigger(bar_manager, bar_manager_custom_events_trigger(bar_manager,
COMMAND_SUBSCRIBE_VOLUME_CHANGE, COMMAND_SUBSCRIBE_VOLUME_CHANGE,