diff options
Diffstat (limited to 'src/SinkWindow.cc')
-rw-r--r-- | src/SinkWindow.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/SinkWindow.cc b/src/SinkWindow.cc index f632078..37a84b4 100644 --- a/src/SinkWindow.cc +++ b/src/SinkWindow.cc @@ -53,7 +53,8 @@ SinkWindow* SinkWindow::create() { } void SinkWindow::updateInfo(const SinkInfo &i) { - char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[64], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + double percent, db; nameLabel->set_text(i.name); descriptionLabel->set_text(i.description); @@ -70,9 +71,14 @@ void SinkWindow::updateInfo(const SinkInfo &i) { SourceInfo *source = serverInfoManager->getSourceInfo(i.monitor_source); monitorSourceLabel->set_text(source->name); - volumeScale->set_value(((double) i.volume / 0x100) * 100); - snprintf(t, sizeof(t), "%u%%", (i.volume*100)/0x100); - volumeLabel->set_text(t); + percent = ((double) i.volume / 0x100) * 100; + db = pa_volume_to_dB(i.volume); + volumeScale->set_value(percent); + if (db != PA_DECIBEL_MININFTY) + snprintf(t, sizeof(t), "%0.0f%% (%0.2fdB)", percent, db); + else + snprintf(t, sizeof(t), "%0.0f%% (-∞dB)", percent); + volumeLabel->set_markup(t); set_title("Sink: "+i.name); |