From 7b738b897f6e523024faadef9c1efb6a9aa32f59 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 16 Aug 2004 19:55:43 +0000 Subject: add sink input/source output support (currently broken) git-svn-id: file:///home/lennart/svn/public/paman/trunk@12 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/SourceOutputWindow.cc | 108 +++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 60 deletions(-) (limited to 'src/SourceOutputWindow.cc') diff --git a/src/SourceOutputWindow.cc b/src/SourceOutputWindow.cc index 68d3ec4..fd5ae35 100644 --- a/src/SourceOutputWindow.cc +++ b/src/SourceOutputWindow.cc @@ -1,111 +1,99 @@ #include #include "paman.hh" -#include "SinkWindow.hh" +#include "SourceOutputWindow.hh" -#define GLADE_NAME "sinkWindow" +#define GLADE_NAME "sourceOutputWindow" -SinkWindow::SinkWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade) : +SourceOutputWindow::SourceOutputWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade) : Gtk::Window(cobject), nameLabel(NULL), - descriptionLabel(NULL), indexLabel(NULL), sampleTypeLabel(NULL), - latencyLabel(NULL), + sourceLabel(NULL), + clientLabel(NULL), ownerModuleLabel(NULL), - monitorSourceLabel(NULL), - volumeLabel(NULL), closeButton(NULL), - toMonitorSourceButton(NULL), toOwnerModuleButton(NULL), - volumeResetButton(NULL), - volumeMuteButton(NULL), - volumeScale(NULL) { + toClientButton(NULL), + toSourceButton(NULL) { refGlade->get_widget("nameLabel", nameLabel); - refGlade->get_widget("descriptionLabel", descriptionLabel); refGlade->get_widget("indexLabel", indexLabel); refGlade->get_widget("sampleTypeLabel", sampleTypeLabel); - refGlade->get_widget("latencyLabel", latencyLabel); + refGlade->get_widget("sourceLabel", sourceLabel); + refGlade->get_widget("clientLabel", clientLabel); refGlade->get_widget("ownerModuleLabel", ownerModuleLabel); - refGlade->get_widget("monitorSourceLabel", monitorSourceLabel); refGlade->get_widget("closeButton", closeButton); - refGlade->get_widget("toMonitorSourceButton", toMonitorSourceButton); refGlade->get_widget("toOwnerModuleButton", toOwnerModuleButton); - refGlade->get_widget("volumeLabel", volumeLabel); - refGlade->get_widget("volumeScale", volumeScale); - refGlade->get_widget("volumeResetButton", volumeResetButton); - refGlade->get_widget("volumeMuteButton", volumeMuteButton); - - closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onCloseButton)); - toMonitorSourceButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onToMonitorSourceButton)); - toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onToOwnerModuleButton)); - volumeScale->signal_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)); + refGlade->get_widget("toClientButton", toClientButton); + refGlade->get_widget("toSourceButton", toSourceButton); + + closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onCloseButton)); + toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToOwnerModuleButton)); + toClientButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToClientButton)); + toSourceButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToSourceButton)); } -SinkWindow* SinkWindow::create() { - SinkWindow *w = NULL; +SourceOutputWindow* SourceOutputWindow::create() { + SourceOutputWindow *w = NULL; Glib::RefPtr refXml = Gnome::Glade::Xml::create(GLADE_FILE, GLADE_NAME); refXml->get_widget_derived(GLADE_NAME, w); return w; } -void SinkWindow::updateInfo(const SinkInfo &i) { +void SourceOutputWindow::updateInfo(const SourceOutputInfo &i) { char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; nameLabel->set_text(i.name); - descriptionLabel->set_text(i.description); snprintf(t, sizeof(t), "#%u", i.index); indexLabel->set_text(t); pa_sample_snprint(ss, sizeof(ss), &i.sample_spec); sampleTypeLabel->set_text(ss); - snprintf(t, sizeof(t), "#%u", i.owner_module); - ownerModuleLabel->set_text(t); - snprintf(t, sizeof(t), "%u usec", i.latency); - latencyLabel->set_text(t); + if (i.owner_module == PA_INVALID_INDEX) + ownerModuleLabel->set_markup("n/a"); + else { + snprintf(t, sizeof(t), "#%u", i.owner_module); + ownerModuleLabel->set_text(t); + } - SourceInfo *source = serverInfoManager->getSourceInfo(i.monitor_source); - monitorSourceLabel->set_text(source->name); + SourceInfo *source = serverInfoManager->getSourceInfo(i.source); + sourceLabel->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); - - set_title("Sink: "+i.name); + if (i.client == PA_INVALID_INDEX) + clientLabel->set_markup("n/a"); + else { + ClientInfo *client = serverInfoManager->getClientInfo(i.client); + clientLabel->set_text(client->name); + } + + set_title("Source Output: "+i.name); - monitor_source = i.monitor_source; + this->source = i.source; owner_module = i.owner_module; - index = i.index; + client = i.client; - toOwnerModuleButton->set_sensitive(owner_module != (uint32_t) -1); + toOwnerModuleButton->set_sensitive(owner_module != PA_INVALID_INDEX); + toClientButton->set_sensitive(client != PA_INVALID_INDEX); } -void SinkWindow::onCloseButton() { +void SourceOutputWindow::onCloseButton() { hide(); } -void SinkWindow::onToMonitorSourceButton() { - serverInfoManager->showSourceWindow(monitor_source); -} - -void SinkWindow::onToOwnerModuleButton() { - if (owner_module != (uint32_t) -1) +void SourceOutputWindow::onToOwnerModuleButton() { + if (owner_module != PA_INVALID_INDEX) serverInfoManager->showModuleWindow(owner_module); } -void SinkWindow::onVolumeScaleValueChanged() { - serverInfoManager->setSinkVolume(index, (uint32_t) ((volumeScale->get_value()*0x100)/100)); -} - -void SinkWindow::onVolumeResetButton() { - serverInfoManager->setSinkVolume(index, PA_VOLUME_NORM); +void SourceOutputWindow::onToClientButton() { + if (client != PA_INVALID_INDEX) + serverInfoManager->showClientWindow(client); } -void SinkWindow::onVolumeMuteButton() { - serverInfoManager->setSinkVolume(index, PA_VOLUME_MUTE); +void SourceOutputWindow::onToSourceButton() { + if (source != PA_INVALID_INDEX) + serverInfoManager->showSourceWindow(source); } - -- cgit