[PATCH] Added loopback module option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: NicoHood <git@xxxxxxxxxxx>

---
 src/paprefs.cc    | 34 ++++++++++++++++++++++++++++++++++
 src/paprefs.glade | 17 ++++++++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/paprefs.cc b/src/paprefs.cc
index ca6d9bf..793bb29 100644
--- a/src/paprefs.cc
+++ b/src/paprefs.cc
@@ -62,6 +62,7 @@ public:
         *rtpLoopbackCheckButton,
         *rtpPortCheckButton,
         *combineCheckButton,
+        *loopbackCheckButton,
         *upnpMediaServerCheckButton,
         *upnpNullSinkCheckButton;
 
@@ -84,6 +85,7 @@ public:
     void onChangeRtpReceive();
     void onChangeRtpSend();
     void onChangeCombine();
+    void onChangeLoopback();
     void onChangeUpnp();
 
     void onZeroconfDiscoverInstallButtonClicked();
@@ -105,6 +107,7 @@ public:
     void writeToGConfRtpReceive();
     void writeToGConfRtpSend();
     void writeToGConfCombine();
+    void writeToGConfLoopback();
     void writeToGConfUPnP();
 
     void onGConfChange(const Glib::ustring& key, const Gnome::Conf::Value& value);
@@ -149,6 +152,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
     x->get_widget("rtpLoopbackCheckButton", rtpLoopbackCheckButton);
     x->get_widget("rtpPortCheckButton", rtpPortCheckButton);
     x->get_widget("combineCheckButton", combineCheckButton);
+    x->get_widget("loopbackCheckButton", loopbackCheckButton);
     x->get_widget("upnpMediaServerCheckButton", upnpMediaServerCheckButton);
     x->get_widget("upnpNullSinkCheckButton", upnpNullSinkCheckButton);
 
@@ -185,6 +189,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
     rtpNullSinkRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
 
     combineCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeCombine));
+    loopbackCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeLoopback));
 
     upnpMediaServerCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeUpnp));
     upnpNullSinkCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeUpnp));
@@ -292,6 +297,13 @@ void MainWindow::onChangeCombine() {
     writeToGConfCombine();
 }
 
+void MainWindow::onChangeLoopback() {
+    if (ignoreChanges)
+        return;
+
+    writeToGConfLoopback();
+}
+
 void MainWindow::onChangeUpnp() {
 
     if (ignoreChanges)
@@ -407,6 +419,27 @@ void MainWindow::writeToGConfCombine() {
     gconf->suggest_sync();
 }
 
+void MainWindow::writeToGConfLoopback() {
+    Gnome::Conf::ChangeSet changeSet;
+    changeSet.set(PA_GCONF_PATH_MODULES"/loopback/locked", true);
+    gconf->change_set_commit(changeSet, true);
+
+    if (loopbackCheckButton->get_active()) {
+        changeSet.set(PA_GCONF_PATH_MODULES"/loopback/name0", Glib::ustring("module-loopback"));
+        changeSet.set(PA_GCONF_PATH_MODULES"/loopback/args0", Glib::ustring(""));
+
+        changeSet.set(PA_GCONF_PATH_MODULES"/loopback/enabled", true);
+    } else
+        changeSet.set(PA_GCONF_PATH_MODULES"/loopback/enabled", false);
+
+    gconf->change_set_commit(changeSet, true);
+
+    changeSet.set(PA_GCONF_PATH_MODULES"/loopback/locked", false);
+    gconf->change_set_commit(changeSet, true);
+
+    gconf->suggest_sync();
+}
+
 void MainWindow::writeToGConfRemoteAccess() {
     Gnome::Conf::ChangeSet changeSet;
     bool zeroconfEnabled, anonymousEnabled;
@@ -644,6 +677,7 @@ void MainWindow::readFromGConf() {
         rtpNullSinkRadioButton->set_active(TRUE);
 
     combineCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/combine/enabled"));
+    loopbackCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/loopback/enabled"));
 
     upnpMediaServerCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/upnp-media-server/enabled"));
     upnpNullSinkCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/upnp-media-server/null-sink-enabled"));
diff --git a/src/paprefs.glade b/src/paprefs.glade
index da6b891..293f991 100644
--- a/src/paprefs.glade
+++ b/src/paprefs.glade
@@ -581,6 +581,21 @@
                     <property name="position">0</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkCheckButton" id="loopbackCheckButton">
+                    <property name="label" translatable="yes">Add _loopback output device for routing audio from a source to a sink</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </widget>
               <packing>
                 <property name="position">3</property>
@@ -590,7 +605,7 @@
               <widget class="GtkLabel" id="label4">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Simultaneous _Output</property>
+                <property name="label" translatable="yes">_Miscellaneous</property>
                 <property name="use_underline">True</property>
               </widget>
               <packing>
-- 
2.16.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux