visualize base volume

This commit is contained in:
Lennart Poettering 2009-03-21 03:27:25 +01:00
parent 6499304945
commit 7116369503
5 changed files with 26 additions and 2 deletions

View File

@ -113,3 +113,16 @@ void ChannelWidget::set_sensitive(bool enabled) {
volumeLabel->set_sensitive(enabled);
volumeScale->set_sensitive(enabled);
}
void ChannelWidget::setBaseVolume(pa_volume_t v) {
volumeScale->clear_marks();
if (v > PA_VOLUME_MUTED && v < PA_VOLUME_NORM) {
double p = ((double) v * 100) / PA_VOLUME_NORM;
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), p, (GtkPositionType) GTK_POS_BOTTOM, NULL);
}
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), 0.0, (GtkPositionType) GTK_POS_BOTTOM, NULL);
gtk_scale_add_mark(GTK_SCALE(volumeScale->gobj()), 100.0, (GtkPositionType) GTK_POS_BOTTOM, NULL);
}

View File

@ -49,6 +49,7 @@ public:
Glib::ustring beepDevice;
virtual void set_sensitive(bool enabled);
virtual void setBaseVolume(pa_volume_t);
};

View File

@ -167,6 +167,8 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->index = info.index;
w->monitor_index = info.monitor_source;
is_new = true;
w->setBaseVolume(info.base_volume);
}
w->updating = true;
@ -312,6 +314,8 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->index = info.index;
is_new = true;
w->setBaseVolume(info.base_volume);
if (pa_context_get_server_protocol_version(get_context()) >= 13)
createMonitorStreamForSource(info.index);
}

View File

@ -101,3 +101,9 @@ bool StreamWidget::timeoutEvent() {
void StreamWidget::executeVolumeUpdate() {
}
void StreamWidget::setBaseVolume(pa_volume_t v) {
if (channelMap.channels > 0)
channelWidgets[channelMap.channels-1]->setBaseVolume(v);
}

View File

@ -49,7 +49,7 @@ public:
bool timeoutEvent();
virtual void executeVolumeUpdate();
virtual void setBaseVolume(pa_volume_t v);
};
#endif