From 0a84f669d3d4c72c498b01b999dd89af7f917480 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 16 Sep 2004 00:02:32 +0000 Subject: update to new API show source and source_output latencies ad kill buttons to client/sink_input/source_output (incomplete) add vumeter buttons to sink/source git-svn-id: file:///home/lennart/svn/public/paman/trunk@33 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- configure.ac | 2 +- src/ClientWindow.cc | 8 +- src/ClientWindow.hh | 3 +- src/Makefile.am | 21 ++- src/ModuleWindow.cc | 4 +- src/SampleWindow.cc | 36 +++- src/SampleWindow.hh | 4 +- src/ServerInfoManager.cc | 41 +++-- src/ServerInfoManager.hh | 7 + src/SinkInputWindow.cc | 6 +- src/SinkInputWindow.hh | 3 +- src/SinkWindow.cc | 12 +- src/SinkWindow.hh | 5 +- src/SourceOutputWindow.cc | 13 +- src/SourceOutputWindow.hh | 6 +- src/SourceWindow.cc | 17 +- src/SourceWindow.hh | 8 +- src/StatWindow.cc | 4 +- src/paman.cc | 5 +- src/paman.glade | 459 +++++++++++++++++++++++++++++++++++++++------- 20 files changed, 554 insertions(+), 110 deletions(-) diff --git a/configure.ac b/configure.ac index a5facc6..063371f 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. AC_PREREQ(2.57) -AC_INIT([paman],[0.3],[mzcnzna (at) 0pointer (dot) de]) +AC_INIT([paman],[0.4],[mzcnzna (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/paman.cc]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall]) diff --git a/src/ClientWindow.cc b/src/ClientWindow.cc index b0bf5d8..6cb814e 100644 --- a/src/ClientWindow.cc +++ b/src/ClientWindow.cc @@ -12,7 +12,8 @@ ClientWindow::ClientWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("nameLabel", nameLabel); refGlade->get_widget("protocolLabel", protocolLabel); @@ -20,6 +21,7 @@ ClientWindow::ClientWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("ownerModuleLabel", ownerModuleLabel); refGlade->get_widget("closeButton", closeButton); refGlade->get_widget("toOwnerModuleButton", toOwnerModuleButton); + refGlade->get_widget("killButton", killButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &ClientWindow::onCloseButton)); toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &ClientWindow::onToOwnerModuleButton)); @@ -33,7 +35,7 @@ ClientWindow* ClientWindow::create() { } void ClientWindow::updateInfo(const ClientInfo &i) { - char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[20]; nameLabel->set_text(i.name); protocolLabel->set_text(i.protocol_name); @@ -58,7 +60,7 @@ void ClientWindow::onToOwnerModuleButton() { serverInfoManager->showModuleWindow(owner_module); } -bool ClientWindow::on_delete_event(GdkEventAny* e) { +bool ClientWindow::on_delete_event(GdkEventAny*) { hide(); return false; } diff --git a/src/ClientWindow.hh b/src/ClientWindow.hh index f65cdc4..837a3b7 100644 --- a/src/ClientWindow.hh +++ b/src/ClientWindow.hh @@ -19,7 +19,8 @@ public: *ownerModuleLabel; Gtk::Button *closeButton, - *toOwnerModuleButton; + *toOwnerModuleButton, + *killButton; uint32_t owner_module; diff --git a/src/Makefile.am b/src/Makefile.am index 8613a60..d25d0bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,21 @@ +# $Id$ +# +# This file is part of Polypaudio Manager. +# +# Polypaudio Manager is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Polypaudio Manager is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Polypaudio Manager; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. bin_PROGRAMS=paman @@ -17,4 +35,5 @@ paman_SOURCES=MainWindow.cc MainWindow.hh \ paman_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) $(POLYP_LIBS) paman_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) $(POLYP_CFLAGS) -paman_CXXFLAGS+=-DGLADE_FILE=\"$(pkgdatadir)/paman.glade\" +#paman_CXXFLAGS+=-DGLADE_FILE=\"$(pkgdatadir)/paman.glade\" +paman_CXXFLAGS+=-DPAVUMETER_PATH=\"/home/lennart/projects/pavumeter/src/pavumeter\" diff --git a/src/ModuleWindow.cc b/src/ModuleWindow.cc index 4c44cd4..584a303 100644 --- a/src/ModuleWindow.cc +++ b/src/ModuleWindow.cc @@ -32,7 +32,7 @@ ModuleWindow* ModuleWindow::create() { } void ModuleWindow::updateInfo(const ModuleInfo &i) { - char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[20]; nameLabel->set_text(i.name); if (!i.argument.empty()) @@ -57,7 +57,7 @@ void ModuleWindow::onCloseButton() { hide(); } -bool ModuleWindow::on_delete_event(GdkEventAny* e) { +bool ModuleWindow::on_delete_event(GdkEventAny*) { hide(); return false; } diff --git a/src/SampleWindow.cc b/src/SampleWindow.cc index c3ff7fc..1685213 100644 --- a/src/SampleWindow.cc +++ b/src/SampleWindow.cc @@ -11,8 +11,10 @@ SampleWindow::SampleWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("nameLabel", nameLabel); @@ -21,6 +23,8 @@ SampleWindow::SampleWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("sampleTypeLabel", sampleTypeLabel); refGlade->get_widget("durationLabel", durationLabel); refGlade->get_widget("sizeLabel", sizeLabel); + refGlade->get_widget("lazyLabel", lazyLabel); + refGlade->get_widget("filenameLabel", filenameLabel); refGlade->get_widget("closeButton", closeButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SampleWindow::onCloseButton)); @@ -43,14 +47,30 @@ void SampleWindow::updateInfo(const SampleInfo &i) { snprintf(t, sizeof(t), "%0.0f%%", (double) i.volume / 0x100 * 100); volumeLabel->set_text(t); - pa_sample_spec_snprint(ss, sizeof(ss), &i.sample_spec); - sampleTypeLabel->set_text(ss); + if (pa_sample_spec_valid(&i.sample_spec)) { + pa_sample_spec_snprint(ss, sizeof(ss), &i.sample_spec); + sampleTypeLabel->set_text(ss); + } else + sampleTypeLabel->set_markup("n/a"); + + if (i.duration > 0) { + snprintf(t, sizeof(t), "%0.1fs", (double) i.duration/1000000); + durationLabel->set_text(t); + } else + durationLabel->set_markup("n/a"); + + if (i.bytes > 0) { + pa_bytes_snprint(t, sizeof(t), i.bytes); + sizeLabel->set_text(t); + } else + sizeLabel->set_markup("n/a"); - snprintf(t, sizeof(t), "%0.1fs", (double) i.duration/1000000); - durationLabel->set_text(t); + lazyLabel->set_text(i.lazy ? "yes" : "no"); - pa_bytes_snprint(t, sizeof(t), i.bytes); - sizeLabel->set_text(t); + if (i.filename.size() > 0) + filenameLabel->set_text(i.filename); + else + filenameLabel->set_markup("n/a"); set_title("Sample: "+i.name); } @@ -59,7 +79,7 @@ void SampleWindow::onCloseButton() { hide(); } -bool SampleWindow::on_delete_event(GdkEventAny* e) { +bool SampleWindow::on_delete_event(GdkEventAny*) { hide(); return false; } diff --git a/src/SampleWindow.hh b/src/SampleWindow.hh index 71c9930..f17314b 100644 --- a/src/SampleWindow.hh +++ b/src/SampleWindow.hh @@ -18,7 +18,9 @@ public: *volumeLabel, *sampleTypeLabel, *durationLabel, - *sizeLabel; + *sizeLabel, + *lazyLabel, + *filenameLabel; Gtk::Button *closeButton; diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index 02268ec..13c751a 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -13,6 +13,7 @@ SinkInfo::SinkInfo(const struct pa_sink_info &i) : owner_module(i.owner_module), volume(i.volume), latency(i.latency), + monitor_source_name(i.monitor_source_name), window(NULL) { } @@ -30,6 +31,7 @@ void SinkInfo::update(const struct pa_sink_info &i) { owner_module = i.owner_module; volume = i.volume; latency = i.latency; + monitor_source_name = i.monitor_source_name; if (window) window->updateInfo(*this); @@ -54,6 +56,7 @@ SourceInfo::SourceInfo(const struct pa_source_info &i) : sample_spec(i.sample_spec), owner_module(i.owner_module), monitor_of_sink(i.monitor_of_sink), + latency(i.latency), window(NULL) { } @@ -69,6 +72,7 @@ void SourceInfo::update(const struct pa_source_info &i) { sample_spec = i.sample_spec; owner_module = i.owner_module; monitor_of_sink = i.monitor_of_sink; + latency = i.latency; if (window) window->updateInfo(*this); @@ -211,6 +215,8 @@ SourceOutputInfo::SourceOutputInfo(const struct pa_source_output_info &i) : source(i.source), client(i.client), owner_module(i.owner_module), + buffer_usec(i.buffer_usec), + source_usec(i.source_usec), window(NULL) { } @@ -226,6 +232,8 @@ void SourceOutputInfo::update(const struct pa_source_output_info &i) { source = i.source; client = i.client; owner_module = i.owner_module; + buffer_usec = i.buffer_usec; + source_usec = i.source_usec; if (window) window->updateInfo(*this); @@ -250,6 +258,8 @@ SampleInfo::SampleInfo(const struct pa_sample_info &i) : volume(i.volume), duration(i.duration), bytes(i.bytes), + lazy(!!i.lazy), + filename(i.filename), window(NULL) { } @@ -265,6 +275,8 @@ void SampleInfo::update(const struct pa_sample_info &i) { volume = i.volume; duration = i.duration; bytes = i.bytes; + lazy = !!i.lazy; + filename = i.filename; if (window) window->updateInfo(*this); @@ -294,9 +306,7 @@ extern "C" { static void subscribe_callback(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata); }; -static void server_info_callback(struct pa_context *c, const struct pa_server_info *i, void *userdata) { - ServerInfoManager *si = (ServerInfoManager*) userdata; - +static void server_info_callback(struct pa_context *c, const struct pa_server_info *i, void *) { if (!i) { mainWindow->showFailure(pa_strerror(pa_context_errno(c))); return; @@ -305,37 +315,37 @@ static void server_info_callback(struct pa_context *c, const struct pa_server_in mainWindow->updateInfo(*i); } -static void sink_info_callback(struct pa_context *c, const struct pa_sink_info *i, int is_last, void *userdata) { +static void sink_info_callback(struct pa_context *, const struct pa_sink_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } -static void source_info_callback(struct pa_context *c, const struct pa_source_info *i, int is_last, void *userdata) { +static void source_info_callback(struct pa_context *, const struct pa_source_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } -static void client_info_callback(struct pa_context *c, const struct pa_client_info *i, int is_last, void *userdata) { +static void client_info_callback(struct pa_context *, const struct pa_client_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } -static void module_info_callback(struct pa_context *c, const struct pa_module_info *i, int is_last, void *userdata) { +static void module_info_callback(struct pa_context *, const struct pa_module_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } -static void sink_input_info_callback(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) { +static void sink_input_info_callback(struct pa_context *, const struct pa_sink_input_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } -static void source_output_info_callback(struct pa_context *c, const struct pa_source_output_info *i, int is_last, void *userdata) { +static void source_output_info_callback(struct pa_context *, const struct pa_source_output_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } -static void sample_info_callback(struct pa_context *c, const struct pa_sample_info *i, int is_last, void *userdata) { +static void sample_info_callback(struct pa_context *, const struct pa_sample_info *i, int, void *userdata) { ServerInfoManager *si = (ServerInfoManager*) userdata; if (i) si->updateInfo(*i); } @@ -679,7 +689,6 @@ void ServerInfoManager::showStatWindow() { statWindow = StatWindow::create(); statWindow->show(); } - } void ServerInfoManager::playSample(uint32_t sample, uint32_t sink) { @@ -691,3 +700,13 @@ void ServerInfoManager::playSample(uint32_t sample, uint32_t sink) { pa_operation_unref(pa_context_play_sample(&context, samplei->name.c_str(), sinki->name.c_str(), PA_VOLUME_NORM, NULL, NULL)); } + +#ifndef PAVUMETER_PATH +#define PAVUMETER_PATH "pavumeter" +#endif + +void ServerInfoManager::runVolumeMeter(const Glib::ustring &source) { + char t[256]; + snprintf(t, sizeof(t), "%s %s", PAVUMETER_PATH, source.c_str()); + Glib::spawn_command_line_async(t); +} diff --git a/src/ServerInfoManager.hh b/src/ServerInfoManager.hh index 3395de1..01e9394 100644 --- a/src/ServerInfoManager.hh +++ b/src/ServerInfoManager.hh @@ -41,6 +41,7 @@ public: uint32_t owner_module; pa_volume_t volume; pa_usec_t latency; + Glib::ustring monitor_source_name; Gtk::TreeRowReference treeRef, sinkComboBoxTreeRef; @@ -60,6 +61,7 @@ public: struct pa_sample_spec sample_spec; uint32_t owner_module; uint32_t monitor_of_sink; + pa_usec_t latency; Gtk::TreeRowReference treeRef; SourceWindow *window; @@ -136,6 +138,7 @@ public: uint32_t source; uint32_t client; uint32_t owner_module; + pa_usec_t buffer_usec, source_usec; Gtk::TreeRowReference treeRef; @@ -155,6 +158,8 @@ public: Glib::ustring name; struct pa_sample_spec sample_spec; uint32_t volume, duration, bytes; + bool lazy; + Glib::ustring filename; Gtk::TreeRowReference treeRef; @@ -202,6 +207,8 @@ public: void showStatWindow(); void playSample(uint32_t sample, uint32_t sink); + + void runVolumeMeter(const Glib::ustring &source); protected: std::map sinks; diff --git a/src/SinkInputWindow.cc b/src/SinkInputWindow.cc index 19546a6..6a59969 100644 --- a/src/SinkInputWindow.cc +++ b/src/SinkInputWindow.cc @@ -21,6 +21,7 @@ SinkInputWindow::SinkInputWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("nameLabel", nameLabel); @@ -38,6 +39,7 @@ SinkInputWindow::SinkInputWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("volumeScale", volumeScale); refGlade->get_widget("volumeResetButton", volumeResetButton); refGlade->get_widget("volumeMuteButton", volumeMuteButton); + refGlade->get_widget("killButton", killButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkInputWindow::onCloseButton)); toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkInputWindow::onToOwnerModuleButton)); @@ -72,7 +74,7 @@ void SinkInputWindow::updateInfo(const SinkInputInfo &i) { ownerModuleLabel->set_text(t); } - snprintf(t, sizeof(t), "%u μs (= buffer: %u μs + sink: %u μs)", i.buffer_usec+i.sink_usec, i.buffer_usec, i.sink_usec); + snprintf(t, sizeof(t), "%0.0f μs (= buffer: %0.0f μs + sink: %0.0f μs)", (double) i.buffer_usec+i.sink_usec, (double) i.buffer_usec, (double) i.sink_usec); latencyLabel->set_markup(t); SinkInfo *sink = serverInfoManager->getSinkInfo(i.sink); @@ -134,7 +136,7 @@ void SinkInputWindow::onVolumeMuteButton() { serverInfoManager->setSinkInputVolume(index, PA_VOLUME_MUTED); } -bool SinkInputWindow::on_delete_event(GdkEventAny* e) { +bool SinkInputWindow::on_delete_event(GdkEventAny* ) { hide(); return false; } diff --git a/src/SinkInputWindow.hh b/src/SinkInputWindow.hh index 350f18d..aaade23 100644 --- a/src/SinkInputWindow.hh +++ b/src/SinkInputWindow.hh @@ -27,7 +27,8 @@ public: *toClientButton, *toSinkButton, *volumeResetButton, - *volumeMuteButton; + *volumeMuteButton, + *killButton; Gtk::HScale *volumeScale; diff --git a/src/SinkWindow.cc b/src/SinkWindow.cc index 4a205d1..4c6a01a 100644 --- a/src/SinkWindow.cc +++ b/src/SinkWindow.cc @@ -20,6 +20,7 @@ SinkWindow::SinkWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("nameLabel", nameLabel); @@ -36,6 +37,7 @@ SinkWindow::SinkWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("volumeScale", volumeScale); refGlade->get_widget("volumeResetButton", volumeResetButton); refGlade->get_widget("volumeMuteButton", volumeMuteButton); + refGlade->get_widget("volumeMeterButton", volumeMeterButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onCloseButton)); toMonitorSourceButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onToMonitorSourceButton)); @@ -43,6 +45,7 @@ SinkWindow::SinkWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_value_changed().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeScaleValueChanged)); volumeResetButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeResetButton)); volumeMuteButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeMuteButton)); + volumeMeterButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeMeterButton)); } SinkWindow* SinkWindow::create() { @@ -65,7 +68,7 @@ void SinkWindow::updateInfo(const SinkInfo &i) { snprintf(t, sizeof(t), "#%u", i.owner_module); ownerModuleLabel->set_text(t); - snprintf(t, sizeof(t), "%u usec", i.latency); + snprintf(t, sizeof(t), "%0.0f usec", (double) i.latency); latencyLabel->set_text(t); SourceInfo *source = serverInfoManager->getSourceInfo(i.monitor_source); @@ -85,6 +88,7 @@ void SinkWindow::updateInfo(const SinkInfo &i) { monitor_source = i.monitor_source; owner_module = i.owner_module; index = i.index; + monitor_source_name = i.monitor_source_name; toOwnerModuleButton->set_sensitive(owner_module != (uint32_t) -1); } @@ -114,7 +118,11 @@ void SinkWindow::onVolumeMuteButton() { serverInfoManager->setSinkVolume(index, PA_VOLUME_MUTED); } -bool SinkWindow::on_delete_event(GdkEventAny* e) { +bool SinkWindow::on_delete_event(GdkEventAny*) { hide(); return false; } + +void SinkWindow::onVolumeMeterButton() { + serverInfoManager->runVolumeMeter(monitor_source_name); +} diff --git a/src/SinkWindow.hh b/src/SinkWindow.hh index 1cb6708..bc88e30 100644 --- a/src/SinkWindow.hh +++ b/src/SinkWindow.hh @@ -26,11 +26,13 @@ public: *toMonitorSourceButton, *toOwnerModuleButton, *volumeResetButton, - *volumeMuteButton; + *volumeMuteButton, + *volumeMeterButton; Gtk::HScale *volumeScale; uint32_t index, owner_module, monitor_source; + Glib::ustring monitor_source_name; void updateInfo(const SinkInfo &i); @@ -41,6 +43,7 @@ public: virtual void onVolumeResetButton(); virtual void onVolumeMuteButton(); virtual bool on_delete_event(GdkEventAny* e); + virtual void onVolumeMeterButton(); }; #endif diff --git a/src/SourceOutputWindow.cc b/src/SourceOutputWindow.cc index 30808f3..e93dff4 100644 --- a/src/SourceOutputWindow.cc +++ b/src/SourceOutputWindow.cc @@ -13,10 +13,12 @@ SourceOutputWindow::SourceOutputWindow(BaseObjectType* cobject, const Glib::RefP sourceLabel(NULL), clientLabel(NULL), ownerModuleLabel(NULL), + latencyLabel(NULL), closeButton(NULL), toOwnerModuleButton(NULL), toClientButton(NULL), - toSourceButton(NULL) { + toSourceButton(NULL), + killButton(NULL) { refGlade->get_widget("nameLabel", nameLabel); refGlade->get_widget("indexLabel", indexLabel); @@ -24,10 +26,12 @@ SourceOutputWindow::SourceOutputWindow(BaseObjectType* cobject, const Glib::RefP refGlade->get_widget("sourceLabel", sourceLabel); refGlade->get_widget("clientLabel", clientLabel); refGlade->get_widget("ownerModuleLabel", ownerModuleLabel); + refGlade->get_widget("latencyLabel", latencyLabel); refGlade->get_widget("closeButton", closeButton); refGlade->get_widget("toOwnerModuleButton", toOwnerModuleButton); refGlade->get_widget("toClientButton", toClientButton); refGlade->get_widget("toSourceButton", toSourceButton); + refGlade->get_widget("killButton", killButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onCloseButton)); toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToOwnerModuleButton)); @@ -43,7 +47,7 @@ SourceOutputWindow* SourceOutputWindow::create() { } void SourceOutputWindow::updateInfo(const SourceOutputInfo &i) { - char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[100], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; nameLabel->set_text(i.name); snprintf(t, sizeof(t), "#%u", i.index); @@ -58,6 +62,9 @@ void SourceOutputWindow::updateInfo(const SourceOutputInfo &i) { ownerModuleLabel->set_text(t); } + snprintf(t, sizeof(t), "%0.0f μs (= buffer: %0.0f μs + source: %0.0f μs)", (double) i.buffer_usec+i.source_usec, (double) i.buffer_usec, (double) i.source_usec); + latencyLabel->set_markup(t); + SourceInfo *source = serverInfoManager->getSourceInfo(i.source); sourceLabel->set_text(source->name); @@ -97,7 +104,7 @@ void SourceOutputWindow::onToSourceButton() { serverInfoManager->showSourceWindow(source); } -bool SourceOutputWindow::on_delete_event(GdkEventAny* e) { +bool SourceOutputWindow::on_delete_event(GdkEventAny*) { hide(); return false; } diff --git a/src/SourceOutputWindow.hh b/src/SourceOutputWindow.hh index 81ec128..5fc4e8c 100644 --- a/src/SourceOutputWindow.hh +++ b/src/SourceOutputWindow.hh @@ -18,12 +18,14 @@ public: *sampleTypeLabel, *sourceLabel, *clientLabel, - *ownerModuleLabel; + *ownerModuleLabel, + *latencyLabel; Gtk::Button *closeButton, *toOwnerModuleButton, *toClientButton, - *toSourceButton; + *toSourceButton, + *killButton; uint32_t owner_module, source, client; diff --git a/src/SourceWindow.cc b/src/SourceWindow.cc index a396c6a..bb48071 100644 --- a/src/SourceWindow.cc +++ b/src/SourceWindow.cc @@ -11,9 +11,11 @@ SourceWindow::SourceWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("nameLabel", nameLabel); refGlade->get_widget("descriptionLabel", descriptionLabel); @@ -21,13 +23,16 @@ SourceWindow::SourceWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("sampleTypeLabel", sampleTypeLabel); refGlade->get_widget("ownerModuleLabel", ownerModuleLabel); refGlade->get_widget("monitorOfSinkLabel", monitorOfSinkLabel); + refGlade->get_widget("latencyLabel", latencyLabel); refGlade->get_widget("closeButton", closeButton); refGlade->get_widget("toParentSinkButton", toParentSinkButton); refGlade->get_widget("toOwnerModuleButton", toOwnerModuleButton); + refGlade->get_widget("volumeMeterButton", volumeMeterButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onCloseButton)); toParentSinkButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onParentSinkButton)); toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onToOwnerModuleButton)); + volumeMeterButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onVolumeMeterButton)); } SourceWindow* SourceWindow::create() { @@ -49,6 +54,9 @@ void SourceWindow::updateInfo(const SourceInfo &i) { snprintf(t, sizeof(t), "#%u", i.owner_module); ownerModuleLabel->set_text(t); + snprintf(t, sizeof(t), "%0.0f usec", (double) i.latency); + latencyLabel->set_text(t); + monitorOfSinkLabel->set_markup("n/a"); toParentSinkButton->set_sensitive(false); if (i.monitor_of_sink != (uint32_t) -1) { @@ -60,6 +68,7 @@ void SourceWindow::updateInfo(const SourceInfo &i) { } monitor_of_sink = i.monitor_of_sink; + source_name = i.name; set_title("Source: "+i.name); @@ -81,7 +90,11 @@ void SourceWindow::onToOwnerModuleButton() { serverInfoManager->showModuleWindow(owner_module); } -bool SourceWindow::on_delete_event(GdkEventAny* e) { +bool SourceWindow::on_delete_event(GdkEventAny*) { hide(); return false; } + +void SourceWindow::onVolumeMeterButton() { + serverInfoManager->runVolumeMeter(source_name); +} diff --git a/src/SourceWindow.hh b/src/SourceWindow.hh index 315f8d9..a8a699b 100644 --- a/src/SourceWindow.hh +++ b/src/SourceWindow.hh @@ -14,13 +14,16 @@ public: *indexLabel, *sampleTypeLabel, *ownerModuleLabel, - *monitorOfSinkLabel; + *monitorOfSinkLabel, + *latencyLabel; Gtk::Button *closeButton, *toParentSinkButton, - *toOwnerModuleButton; + *toOwnerModuleButton, + *volumeMeterButton; uint32_t monitor_of_sink, owner_module; + Glib::ustring source_name; void updateInfo(const SourceInfo &i); @@ -28,6 +31,7 @@ public: virtual void onParentSinkButton(); virtual void onToOwnerModuleButton(); virtual bool on_delete_event(GdkEventAny* e); + virtual void onVolumeMeterButton(); }; #endif diff --git a/src/StatWindow.cc b/src/StatWindow.cc index c1226d9..2fb903b 100644 --- a/src/StatWindow.cc +++ b/src/StatWindow.cc @@ -47,7 +47,7 @@ void StatWindow::onCloseButton() { hide(); } -static void stat_cb(struct pa_context *c, const struct pa_stat_info *i, void *userdata) { +static void stat_cb(struct pa_context *, const struct pa_stat_info *i, void *userdata) { char t[20]; StatWindow *s = (struct StatWindow*) userdata; @@ -80,7 +80,7 @@ void StatWindow::present() { onRefreshButton(); } -bool StatWindow::on_delete_event(GdkEventAny* e) { +bool StatWindow::on_delete_event(GdkEventAny*) { hide(); return false; } diff --git a/src/paman.cc b/src/paman.cc index f08be5d..06c4046 100644 --- a/src/paman.cc +++ b/src/paman.cc @@ -18,7 +18,7 @@ struct pa_mainloop_api *mainloop_api = NULL; extern "C" static void context_state_callback(struct pa_context *c, void *userdata); -static void context_state_callback(struct pa_context *c, void *userdata) { +static void context_state_callback(struct pa_context *c, void *) { g_assert(c && mainWindow); switch (pa_context_get_state(c)) { @@ -71,7 +71,7 @@ void createConnection() { context = pa_context_new(mainloop_api, "Polypaudio Manager"); g_assert(context); pa_context_set_state_callback(context, context_state_callback, NULL); - pa_context_connect(context, NULL); + pa_context_connect(context, NULL, 1, NULL); } void killConnection() { @@ -110,7 +110,6 @@ int main(int argc, char *argv[]) { Gtk::Main::run(*mainWindow); -quit: if (serverInfoManager) delete serverInfoManager; diff --git a/src/paman.glade b/src/paman.glade index c58603b..4d8ce32 100644 --- a/src/paman.glade +++ b/src/paman.glade @@ -2169,10 +2169,10 @@ - + True - GTK_BUTTONBOX_START - 0 + False + 6 @@ -2184,6 +2184,11 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + @@ -2196,6 +2201,28 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + + + + + + True + True + True + Show Volume Meter + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + @@ -2306,7 +2333,7 @@ 5 True - 6 + 7 2 False 6 @@ -2409,7 +2436,7 @@ - + True True foo @@ -2426,14 +2453,14 @@ 1 2 - 4 - 5 + 3 + 4 - + True True foo @@ -2450,14 +2477,14 @@ 1 2 - 3 - 4 + 2 + 3 - + True True foo @@ -2474,14 +2501,14 @@ 1 2 - 2 - 3 + 1 + 2 - + True True foo @@ -2498,32 +2525,32 @@ 1 2 - 1 - 2 + 0 + 1 - + True - True - foo + <b>Monitor of Sink:</b> False - False + True GTK_JUSTIFY_LEFT False - True - 0 + False + 1 0.5 0 0 - 1 - 2 - 0 - 1 + 0 + 1 + 6 + 7 + fill @@ -2545,17 +2572,17 @@ 0 1 - 4 - 5 + 5 + 6 fill - + True - <b>Monitor of Sink:</b> + <b>Latency:</b> False True GTK_JUSTIFY_LEFT @@ -2569,8 +2596,8 @@ 0 1 - 5 - 6 + 4 + 5 fill @@ -2591,11 +2618,60 @@ 0 0 + + 1 + 2 + 6 + 7 + fill + + + + + + + True + True + foo + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + 1 2 5 6 + + + + + + + True + True + foo + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 4 + 5 fill @@ -2609,10 +2685,10 @@ - + True - GTK_BUTTONBOX_START - 0 + False + 6 @@ -2624,6 +2700,11 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + @@ -2636,6 +2717,28 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + + + + + + True + True + True + Show Volume Meter + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + @@ -3292,10 +3395,10 @@ - + True - GTK_BUTTONBOX_START - 0 + False + 6 @@ -3307,6 +3410,28 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + + + + + + True + True + True + Kill + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + @@ -3887,10 +4012,10 @@ - + True - GTK_BUTTONBOX_START - 0 + False + 6 @@ -3902,6 +4027,11 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + @@ -3914,6 +4044,11 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + @@ -3926,6 +4061,28 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + + + + + + True + True + True + Kill + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + @@ -3977,6 +4134,7 @@ True True + True True gtk-close True @@ -4035,7 +4193,7 @@ True - 6 + 7 2 False 6 @@ -4187,9 +4345,9 @@ - + True - <b>Connected to Source:</b> + <b>Owner Module:</b> False True GTK_JUSTIFY_LEFT @@ -4203,8 +4361,8 @@ 0 1 - 3 - 4 + 6 + 7 fill @@ -4224,6 +4382,30 @@ 0 0 + + 0 + 1 + 5 + 6 + fill + + + + + + + True + <b>Connected to Source:</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + 0 1 @@ -4235,9 +4417,9 @@ - + True - <b>Owner Module:</b> + <b>Latency:</b> False True GTK_JUSTIFY_LEFT @@ -4251,18 +4433,18 @@ 0 1 - 5 - 6 + 3 + 4 fill - + True True - label4757 + label4759 False False GTK_JUSTIFY_LEFT @@ -4276,8 +4458,8 @@ 1 2 - 3 - 4 + 6 + 7 fill @@ -4298,6 +4480,31 @@ 0 0 + + 1 + 2 + 5 + 6 + fill + + + + + + + True + True + label4757 + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + 1 2 @@ -4309,10 +4516,10 @@ - + True True - label4759 + label4833 False False GTK_JUSTIFY_LEFT @@ -4326,8 +4533,8 @@ 1 2 - 5 - 6 + 3 + 4 fill @@ -4341,10 +4548,10 @@ - + True - GTK_BUTTONBOX_START - 0 + False + 6 @@ -4356,6 +4563,11 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + @@ -4368,6 +4580,11 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + @@ -4380,6 +4597,28 @@ GTK_RELIEF_NORMAL True + + 0 + True + True + + + + + + True + True + True + Kill + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + @@ -4873,7 +5112,7 @@ 12 True - 6 + 8 2 False 6 @@ -5171,6 +5410,102 @@ + + + + True + <b>Lazy:</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 6 + 7 + fill + + + + + + + True + <b>Filename:</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 7 + 8 + fill + + + + + + + True + label4830 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 6 + 7 + fill + + + + + + + True + label4831 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 7 + 8 + fill + + + False -- cgit