mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 00:40:25 +00:00
Audio: print volume also in dB
This commit is contained in:
@@ -259,7 +259,7 @@ void keyboard_control::usage()
|
||||
if (response_get_status(resp) == 200) {
|
||||
double vol = atof(response_get_text(resp));
|
||||
double db = 20.0 * log10(vol / 100.0);
|
||||
cout << "Received audio volume: " << fixed << setprecision(2) << vol << " % (" << (db >= 0.0 ? "+" : "") << db << " dB)\n";
|
||||
cout << "Received audio volume: " << fixed << setprecision(2) << vol << "% (" << (db >= 0.0 ? "+" : "") << db << " dB)\n";
|
||||
}
|
||||
free_response(resp);
|
||||
}
|
||||
|
||||
@@ -698,14 +698,16 @@ void audio_decoder_increase_volume(void *state)
|
||||
{
|
||||
auto s = (struct state_audio_decoder *) state;
|
||||
s->scale->scale *= 1.1;
|
||||
log_msg(LOG_LEVEL_INFO, "Volume: %f%%\n", s->scale->scale * 100.0);
|
||||
double db = 20.0 * log10(s->scale->scale);
|
||||
log_msg(LOG_LEVEL_INFO, "Volume: %.2f%% (%+.2f dB)\n", s->scale->scale * 100.0, db);
|
||||
}
|
||||
|
||||
void audio_decoder_decrease_volume(void *state)
|
||||
{
|
||||
auto s = (struct state_audio_decoder *) state;
|
||||
s->scale->scale /= 1.1;
|
||||
log_msg(LOG_LEVEL_INFO, "Volume: %f%%\n", s->scale->scale * 100.0);
|
||||
double db = 20.0 * log10(s->scale->scale);
|
||||
log_msg(LOG_LEVEL_INFO, "Volume: %.2f%% (%+.2f dB)\n", s->scale->scale * 100.0, db);
|
||||
}
|
||||
|
||||
void audio_decoder_mute(void *state)
|
||||
|
||||
Reference in New Issue
Block a user