// Change volume variables from the given decibel. Quantize value according to // our ranges. static float change_volume_decibel(struct action_event *event, float raw_decibel) { int volume_level = volume_decibel_to_level(raw_decibel); // Since we quantize it to the level, lets calculate the // actual level. float decibel = volume_level_to_decibel(volume_level); char volume[10]; snprintf(volume, sizeof(volume), "%d", volume_level); char db_volume[10]; snprintf(db_volume, sizeof(db_volume), "%d", (int) (256 * decibel)); fprintf(stderr, "Setting volume-db to %.2fdb == #%d\n", decibel, volume_level); change_volume_and_notify(event, volume, db_volume); return decibel; }
// Change volume variables from the given decibel. Quantize value according to // our ranges. static float change_volume_decibel(float raw_decibel) { int volume_level = volume_decibel_to_level(raw_decibel); // Since we quantize it to the level, lets calculate the // actual level. float decibel = volume_level_to_decibel(volume_level); char volume[10]; snprintf(volume, sizeof(volume), "%d", volume_level); char db_volume[10]; snprintf(db_volume, sizeof(db_volume), "%d", (int) (256 * decibel)); Log_info("control", "Setting volume-db to %.2fdb == #%d", decibel, volume_level); change_volume(volume, db_volume); return decibel; }