summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-03-21 03:27:25 +0100
committerLennart Poettering <lennart@poettering.net>2009-03-21 03:27:25 +0100
commit711636950370a035eb6364f24020e07f78a1eccf (patch)
treeaf53ee6cd6fb602b766549443ae18cf4bf23ec5b /src
parent6499304945d540aa03ebcc6da6a55eda45a371f2 (diff)
visualize base volume
Diffstat (limited to 'src')
-rw-r--r--src/channelwidget.cc13
-rw-r--r--src/channelwidget.h1
-rw-r--r--src/mainwindow.cc4
-rw-r--r--src/streamwidget.cc6
-rw-r--r--src/streamwidget.h4
5 files changed, 26 insertions, 2 deletions
diff --git a/src/channelwidget.cc b/src/channelwidget.cc
index ca5b2a8..5b04012 100644
--- a/src/channelwidget.cc
+++ b/src/channelwidget.cc
@@ -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);
+}
diff --git a/src/channelwidget.h b/src/channelwidget.h
index 3472420..0413416 100644
--- a/src/channelwidget.h
+++ b/src/channelwidget.h
@@ -49,6 +49,7 @@ public:
Glib::ustring beepDevice;
virtual void set_sensitive(bool enabled);
+ virtual void setBaseVolume(pa_volume_t);
};
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index b81f0d7..1365f7e 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -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);
}
diff --git a/src/streamwidget.cc b/src/streamwidget.cc
index d020dbf..ecea771 100644
--- a/src/streamwidget.cc
+++ b/src/streamwidget.cc
@@ -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);
+}
diff --git a/src/streamwidget.h b/src/streamwidget.h
index c4b82bb..8000ef4 100644
--- a/src/streamwidget.h
+++ b/src/streamwidget.h
@@ -49,7 +49,7 @@ public:
bool timeoutEvent();
virtual void executeVolumeUpdate();
+ virtual void setBaseVolume(pa_volume_t v);
};
-
-#endif \ No newline at end of file
+#endif