OSDN Git Service

kmix: remove pulseaudio backend
authorIvailo Monev <xakepa10@gmail.com>
Fri, 26 Feb 2021 10:07:58 +0000 (12:07 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Fri, 26 Feb 2021 11:31:40 +0000 (13:31 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
22 files changed:
kmix/CMakeLists.txt
kmix/apps/kmix.cpp
kmix/apps/kmix.h
kmix/apps/main.cpp
kmix/backends/kmix-backends.cpp
kmix/backends/mixer_backend.cpp
kmix/backends/mixer_backend.h
kmix/backends/mixer_pulse.cpp [deleted file]
kmix/backends/mixer_pulse.h [deleted file]
kmix/core/GlobalConfig.cpp
kmix/core/GlobalConfig.h
kmix/core/mixer.cpp
kmix/core/mixer.h
kmix/core/mixertoolbox.cpp
kmix/gui/guiprofile.cpp
kmix/gui/kmixprefdlg.cpp
kmix/gui/kmixprefdlg.h
kmix/gui/viewbase.cpp
kmix/gui/viewbase.h
kmix/gui/viewdockareapopup.cpp
kmix/gui/viewsliders.cpp
kmix/tests/CMakeLists.txt

index c18ba2d..d6e16c3 100644 (file)
@@ -14,20 +14,6 @@ set_package_properties(Alsa PROPERTIES
     PURPOSE "Needed for KMix sound feedback"
 )
 
-macro_optional_find_package(PulseAudio 0.9.16)
-set_package_properties(PulseAudio PROPERTIES
-    DESCRIPTION "PulseAudio Audio Server"
-    URL "http://www.pulseaudio.org/"
-    PURPOSE "Needed to let KMix control PulseAudio"
-)
-
-macro_optional_find_package(Canberra)
-set_package_properties(Canberra PROPERTIES
-    DESCRIPTION "libcanberra audio library"
-    URL "http://0pointer.de/lennart/projects/libcanberra/"
-    PURPOSE "Needed for KMix sound feedback"
-)
-
 add_definitions(-DKDE_DEFAULT_DEBUG_AREA=67100)
 
 include_directories(/usr/lib/oss/include)
@@ -41,17 +27,6 @@ if (ALSA_FOUND)
     include_directories(${ALSA_INCLUDES})
 endif (ALSA_FOUND)
 
-if (PULSEAUDIO_FOUND)
-    add_definitions(-DHAVE_PULSE ${PULSEAUDIO_DEFINITIONS})
-    include_directories(${PULSEAUDIO_INCLUDE_DIR})
-endif (PULSEAUDIO_FOUND)
-
-if (CANBERRA_FOUND)
-    add_definitions(-DHAVE_CANBERRA)
-    include_directories(${CANBERRA_INCLUDE_DIRS})
-endif (CANBERRA_FOUND)
-
-
 set(kmix_adaptor_SRCS
        dbus/dbusmixerwrapper.cpp
        dbus/dbusmixsetwrapper.cpp
@@ -73,11 +48,6 @@ if (ALSA_FOUND)
         backends/mixer_alsa9.cpp )
 endif (ALSA_FOUND)
 
-if (PULSEAUDIO_FOUND)
-    set(kmix_backend_SRCS ${kmix_backend_SRCS}
-        backends/mixer_pulse.cpp )
-endif (PULSEAUDIO_FOUND)
-
 set(kmix_SRCS ${kmix_adaptor_SRCS} ${kmix_backend_SRCS}
     apps/main.cpp 
     apps/kmix.cpp 
@@ -129,14 +99,6 @@ if (ALSA_FOUND)
     target_link_libraries(kmix ${ALSA_LIBRARIES})
 endif (ALSA_FOUND)
 
-if (PULSEAUDIO_FOUND)
-    target_link_libraries(kmix ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY})
-endif (PULSEAUDIO_FOUND)
-
-if (CANBERRA_FOUND)
-    target_link_libraries(kmix ${CANBERRA_LIBRARIES})
-endif (CANBERRA_FOUND)
-
 install(
     TARGETS kmix
     DESTINATION ${KDE4_LIB_INSTALL_DIR}
@@ -175,14 +137,6 @@ if (ALSA_FOUND)
     target_link_libraries(kded_kmixd ${ALSA_LIBRARIES})
 endif (ALSA_FOUND)
 
-if (PULSEAUDIO_FOUND)
-    target_link_libraries(kded_kmixd ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY})
-endif (PULSEAUDIO_FOUND)
-
-if (CANBERRA_FOUND)
-    target_link_libraries(kded_kmixd ${CANBERRA_LIBRARIES})
-endif (CANBERRA_FOUND)
-
 install(TARGETS kded_kmixd DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
 
 #target_link_libraries( kmixd kded_kmixd )
@@ -222,14 +176,6 @@ if (ALSA_FOUND)
     target_link_libraries(kmixctrl ${ALSA_LIBRARIES})
 endif (ALSA_FOUND)
 
-if (PULSEAUDIO_FOUND)
-    target_link_libraries(kmixctrl ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY})
-endif (PULSEAUDIO_FOUND)
-
-if (CANBERRA_FOUND)
-    target_link_libraries(kmixctrl ${CANBERRA_LIBRARIES})
-endif (CANBERRA_FOUND)
-
 ########### next target ###############
 add_subdirectory( plasma )
 
index dbfe65c..1fbaa52 100644 (file)
@@ -280,24 +280,19 @@ KMixWindow::initActionsLate()
 void
 KMixWindow::initActionsAfterInitMixer()
 {
-       // Only show the new tab widget if Pulseaudio is not used. Hint: The Pulseaudio backend always
-       // runs with 4 fixed Tabs.
-       if (!Mixer::pulseaudioPresent())
-    {
-      QPixmap cornerNewPM = KIconLoader::global()->loadIcon("tab-new", KIconLoader::Toolbar, KIconLoader::SizeSmall);
-      QPushButton* _cornerLabelNew = new QPushButton();
-      _cornerLabelNew->setIcon(cornerNewPM);
-      //cornerLabelNew->setSizePolicy(QSizePolicy());
-      m_wsMixers->setCornerWidget(_cornerLabelNew, Qt::TopLeftCorner);
-      connect(_cornerLabelNew, SIGNAL(clicked()), SLOT (newView()));
-    }
+    QPixmap cornerNewPM = KIconLoader::global()->loadIcon("tab-new", KIconLoader::Toolbar, KIconLoader::SizeSmall);
+    QPushButton* _cornerLabelNew = new QPushButton();
+    _cornerLabelNew->setIcon(cornerNewPM);
+    //cornerLabelNew->setSizePolicy(QSizePolicy());
+    m_wsMixers->setCornerWidget(_cornerLabelNew, Qt::TopLeftCorner);
+    connect(_cornerLabelNew, SIGNAL(clicked()), SLOT (newView()));
 }
 
 void
 KMixWindow::initPrefDlg()
 {
-       KMixPrefDlg* prefDlg = KMixPrefDlg::createInstance(this, GlobalConfig::instance());
-       connect(prefDlg, SIGNAL(kmixConfigHasChanged()), SLOT(applyPrefs()));
+    KMixPrefDlg* prefDlg = KMixPrefDlg::createInstance(this, GlobalConfig::instance());
+    connect(prefDlg, SIGNAL(kmixConfigHasChanged()), SLOT(applyPrefs()));
 }
 
 void
@@ -533,7 +528,6 @@ KMixWindow::loadBaseConfig()
   preferredMixersInSoundMenu = config.readEntry("Soundmenu.Mixers", preferredMixersInSoundMenu);
   GlobalConfig::instance().setMixersForSoundmenu(preferredMixersInSoundMenu.toSet());
 
-  setBeepOnVolumeChange(gcd.volumeFeedback);
   m_startVisible = config.readEntry("Visible", false);
   m_multiDriverMode = config.readEntry("MultiDriver", false);
   m_defaultCardOnStart = config.readEntry("DefaultCardOnStart", "");
@@ -1056,9 +1050,8 @@ KMixWindow::addMixerWidget(const QString& mixer_ID, QString guiprofId, int inser
 
 void KMixWindow::updateTabsClosable()
 {
-    // Pulseaudio runs with 4 fixed tabs - don't allow to close them.
-    // Also do not allow to close the last view
-    m_wsMixers->setTabsClosable(!Mixer::pulseaudioPresent() && m_wsMixers->count() > 1);
+    // Ddo not allow to close the last view
+    m_wsMixers->setTabsClosable(m_wsMixers->count() > 1);
 }
 
 bool KMixWindow::queryClose()
@@ -1247,18 +1240,6 @@ void KMixWindow::applyPrefs()
        saveConfig();
 }
 
-/**
- * Sets whether a beep on volume change should be done.
- * This method store the value internally and also propagates
- * this to the Mixer core.
- *
- * @param beep true, if a beep should be changed
- */
-void KMixWindow::setBeepOnVolumeChange(bool beep)
-{
-       Mixer::setBeepOnVolumeChange(beep);
-}
-
 void
 KMixWindow::toggleMenuBar()
 {
index 6664771..cde2e3e 100644 (file)
@@ -70,7 +70,6 @@ KMixWindow : public KXmlGuiWindow
    void initWidgets();
    //void setErrorMixerWidget();
 
-   void setBeepOnVolumeChange(bool beep);
    void fixConfigAfterRead();
 
    virtual bool queryClose();
index 03a585c..947d201 100644 (file)
@@ -40,11 +40,8 @@ int main(int argc, char *argv[])
 
    // Author Policy: Long-term maintainers and backend writers/maintainers go in the Authors list.
    aboutData.addAuthor(ki18n("Christian Esken")   , ki18n("Original author and current maintainer"), "esken@kde.org");
-   aboutData.addAuthor(ki18n("Colin Guthrie")     , ki18n("PulseAudio support"), "colin@mageia.org");
    aboutData.addAuthor(ki18n("Helio Chissini de Castro"), ki18n("ALSA 0.9x port"), "helio@kde.org" );
    aboutData.addAuthor(ki18n("Brian Hanson")      , ki18n("Solaris support"), "bhanson@hotmail.com");
-// The HP/UX port is not maintained anymore, and no official part of KMix anymore
-// aboutData.addAuthor(ki18n("Helge Deller")      , ki18n("HP/UX port"), "deller@gmx.de");
 // The initial support was for ALSA 0.5. The new code is not based on it IIRC.
 // aboutData.addAuthor(ki18n("Nick Lopez")        , ki18n("Initial ALSA port"), "kimo_sabe@usa.net");
 
index c88c20d..48a6973 100644 (file)
@@ -28,7 +28,6 @@
 #include <QString>
 
 
-
 #if defined(Q_OS_SOLARIS)
 #define SUN_MIXER
 #elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD)
@@ -70,19 +69,12 @@ QString MPRIS2_getDriverName();
 Mixer_Backend* ALSA_getMixer(Mixer *mixer, int device );
 QString ALSA_getDriverName();
 
-Mixer_Backend* PULSE_getMixer(Mixer *mixer, int device );
-QString PULSE_getDriverName();
-
 MixerFactory g_mixerFactories[] = {
 
 #if defined(SUN_MIXER)
     { SUN_getMixer, SUN_getDriverName },
 #endif
 
-#if defined(HAVE_PULSE)
-    { PULSE_getMixer, PULSE_getDriverName },
-#endif
-
 #if defined(HAVE_ALSA)
     { ALSA_getMixer, ALSA_getDriverName },
 #endif
index 48a372f..a5ad6a4 100644 (file)
@@ -140,7 +140,7 @@ QString Mixer_Backend::getName() const
  */
 QString Mixer_Backend::getId() const
 {
-       return m_mixerName; // Backwards compatibility. PulseAudio overrides it.
+       return m_mixerName; // Backwards compatibility.
 }
 
 /**
index d9d622f..b4389c5 100644 (file)
@@ -158,12 +158,6 @@ protected:
 signals:
   void controlChanged( void ); // TODO remove?
 
-public slots:
-/**
- * Re-initialize. Currently only implemented by PulseAudio backend, and this slot might get moved there
- */
-  virtual void reinit() {};
-
 protected:
   void freeMixDevices();
 
diff --git a/kmix/backends/mixer_pulse.cpp b/kmix/backends/mixer_pulse.cpp
deleted file mode 100644 (file)
index ebb85ec..0000000
+++ /dev/null
@@ -1,1453 +0,0 @@
-/*
- *              KMix -- KDE's full featured mini mixer
- *
- *
- *              Copyright (C) 2008 Helio Chissini de Castro <helio@kde.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#include "mixer_pulse.h"
-
-#include <cstdlib>
-#include <QtCore/QAbstractEventDispatcher>
-#include <QTimer>
-
-#include <klocale.h>
-
-#include "core/mixer.h"
-#include "core/ControlManager.h"
-#include "core/GlobalConfig.h"
-
-#include <pulse/glib-mainloop.h>
-#include <pulse/ext-stream-restore.h>
-#if defined(HAVE_CANBERRA)
-#  include <canberra.h>
-#endif
-
-// PA_VOLUME_UI_MAX landed in pulseaudio-0.9.23, so this can be removed when/if
-// minimum requirement is ever bumped up (from 0.9.12 currently)
-#ifndef PA_VOLUME_UI_MAX
-#define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0))
-#endif
-
-#define HAVE_SOURCE_OUTPUT_VOLUMES PA_CHECK_VERSION(1,0,0)
-
-#define KMIXPA_PLAYBACK     0
-#define KMIXPA_CAPTURE      1
-#define KMIXPA_APP_PLAYBACK 2
-#define KMIXPA_APP_CAPTURE  3
-#define KMIXPA_WIDGET_MAX KMIXPA_APP_CAPTURE
-
-#define KMIXPA_EVENT_KEY "sink-input-by-media-role:event"
-
-static unsigned int refcount = 0;
-static pa_glib_mainloop *s_mainloop = NULL;
-static pa_context *s_context = NULL;
-static enum { UNKNOWN, ACTIVE, INACTIVE } s_pulseActive = UNKNOWN;
-static int s_outstandingRequests = 0;
-
-#if defined(HAVE_CANBERRA)
-static ca_context *s_ccontext = NULL;
-#endif
-
-QMap<int,Mixer_PULSE*> s_mixers;
-
-static devmap outputDevices;
-static devmap captureDevices;
-static QMap<int,QString> clients;
-static devmap outputStreams;
-static devmap captureStreams;
-static devmap outputRoles;
-
-typedef struct {
-    pa_channel_map channel_map;
-    pa_cvolume volume;
-    bool mute;
-    QString device;
-} restoreRule;
-static QMap<QString,restoreRule> s_RestoreRules;
-
-static void dec_outstanding(pa_context *c) {
-    if (s_outstandingRequests <= 0)
-        return;
-
-    if (--s_outstandingRequests == 0)
-    {
-        s_pulseActive = ACTIVE;
-
-        // If this is our probe phase, exit our context immediately
-        if (s_context != c) {
-            pa_context_disconnect(c);
-        } else
-          kDebug(67100) <<  "Reconnected to PulseAudio";
-    }
-}
-
-static void translateMasksAndMaps(devinfo& dev)
-{
-    dev.chanMask = Volume::MNONE;
-    dev.chanIDs.clear();
-
-    if (dev.channel_map.channels != dev.volume.channels) {
-        kError() << "Hiddeous Channel mixup map says " << dev.channel_map.channels << ", volume says: " << dev.volume.channels;
-        return;
-    }
-    if (1 == dev.channel_map.channels && PA_CHANNEL_POSITION_MONO == dev.channel_map.map[0]) {
-        // We just use the left channel to represent this.
-        dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MLEFT);
-        dev.chanIDs[0] = Volume::LEFT;
-    } else {
-        for (uint8_t i = 0; i < dev.channel_map.channels; ++i) {
-            switch (dev.channel_map.map[i]) {
-                case PA_CHANNEL_POSITION_MONO:
-                    kWarning(67100) << "Channel Map contains a MONO element but has >1 channel - we can't handle this.";
-                    return;
-
-                case PA_CHANNEL_POSITION_FRONT_LEFT:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MLEFT);
-                    dev.chanIDs[i] = Volume::LEFT;
-                    break;
-                case PA_CHANNEL_POSITION_FRONT_RIGHT:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MRIGHT);
-                    dev.chanIDs[i] = Volume::RIGHT;
-                    break;
-                case PA_CHANNEL_POSITION_FRONT_CENTER:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MCENTER);
-                    dev.chanIDs[i] = Volume::CENTER;
-                    break;
-                case PA_CHANNEL_POSITION_REAR_CENTER:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MREARCENTER);
-                    dev.chanIDs[i] = Volume::REARCENTER;
-                    break;
-                case PA_CHANNEL_POSITION_REAR_LEFT:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MSURROUNDLEFT);
-                    dev.chanIDs[i] = Volume::SURROUNDLEFT;
-                    break;
-                case PA_CHANNEL_POSITION_REAR_RIGHT:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MSURROUNDRIGHT);
-                    dev.chanIDs[i] = Volume::SURROUNDRIGHT;
-                    break;
-                case PA_CHANNEL_POSITION_LFE:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MWOOFER);
-                    dev.chanIDs[i] = Volume::WOOFER;
-                    break;
-                case PA_CHANNEL_POSITION_SIDE_LEFT:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MREARSIDELEFT);
-                    dev.chanIDs[i] = Volume::REARSIDELEFT;
-                    break;
-                case PA_CHANNEL_POSITION_SIDE_RIGHT:
-                    dev.chanMask = (Volume::ChannelMask)( dev.chanMask | Volume::MREARSIDERIGHT);
-                    dev.chanIDs[i] = Volume::REARSIDERIGHT;
-                    break;
-                default:
-                    kWarning(67100) << "Channel Map contains a pa_channel_position we cannot handle " << dev.channel_map.map[i];
-                    break;
-            }
-        }
-    }
-}
-
-static QString getIconNameFromProplist(pa_proplist *l) {
-    const char *t;
-
-    if ((t = pa_proplist_gets(l, PA_PROP_MEDIA_ICON_NAME)))
-        return QString::fromUtf8(t);
-
-    if ((t = pa_proplist_gets(l, PA_PROP_WINDOW_ICON_NAME)))
-        return QString::fromUtf8(t);
-
-    if ((t = pa_proplist_gets(l, PA_PROP_APPLICATION_ICON_NAME)))
-        return QString::fromUtf8(t);
-
-    if ((t = pa_proplist_gets(l, PA_PROP_MEDIA_ROLE))) {
-
-        if (strcmp(t, "video") == 0 || strcmp(t, "phone") == 0)
-            return QString::fromUtf8(t);
-
-        if (strcmp(t, "music") == 0)
-            return "audio";
-
-        if (strcmp(t, "game") == 0)
-            return "applications-games";
-
-        if (strcmp(t, "event") == 0)
-            return "dialog-information";
-    }
-
-    return "";
-}
-
-static void sink_cb(pa_context *c, const pa_sink_info *i, int eol, void *) {
-
-    if (eol < 0) {
-        if (pa_context_errno(c) == PA_ERR_NOENTITY)
-            return;
-
-        kWarning(67100) << "Sink callback failure";
-        return;
-    }
-
-    if (eol > 0) {
-        dec_outstanding(c);
-        if (s_mixers.contains(KMIXPA_PLAYBACK))
-            s_mixers[KMIXPA_PLAYBACK]->triggerUpdate();
-        return;
-    }
-
-    devinfo s;
-    s.index = s.device_index = i->index;
-    s.name = QString::fromUtf8(i->name).replace(' ', '_');
-    s.description = QString::fromUtf8(i->description);
-    s.icon_name = QString::fromUtf8(pa_proplist_gets(i->proplist, PA_PROP_DEVICE_ICON_NAME));
-    s.volume = i->volume;
-    s.channel_map = i->channel_map;
-    s.mute = !!i->mute;
-    s.stream_restore_rule = "";
-
-    s.priority = 0;
-    if (i->active_port != NULL)
-        s.priority = i->active_port->priority;
-
-    translateMasksAndMaps(s);
-
-    bool is_new = !outputDevices.contains(s.index);
-    outputDevices[s.index] = s;
-//     kDebug(67100) << "Got some info about sink: " << s.description;
-
-    if (s_mixers.contains(KMIXPA_PLAYBACK)) {
-        if (is_new)
-            s_mixers[KMIXPA_PLAYBACK]->addWidget(s.index);
-        else {
-            int mid = s_mixers[KMIXPA_PLAYBACK]->id2num(s.name);
-            if (mid >= 0) {
-                MixSet *ms = s_mixers[KMIXPA_PLAYBACK]->getMixSet();
-                (*ms)[mid]->setReadableName(s.description);
-            }
-        }
-    }
-}
-
-static void source_cb(pa_context *c, const pa_source_info *i, int eol, void *) {
-
-    if (eol < 0) {
-        if (pa_context_errno(c) == PA_ERR_NOENTITY)
-            return;
-
-        kWarning(67100) << "Source callback failure";
-        return;
-    }
-
-    if (eol > 0) {
-        dec_outstanding(c);
-        if (s_mixers.contains(KMIXPA_CAPTURE))
-            s_mixers[KMIXPA_CAPTURE]->triggerUpdate();
-        return;
-    }
-
-    // Do something....
-    if (PA_INVALID_INDEX != i->monitor_of_sink)
-    {
-        kDebug(67100) << "Ignoring Monitor Source: " << i->description;
-        return;
-    }
-
-    devinfo s;
-    s.index = s.device_index = i->index;
-    s.name = QString::fromUtf8(i->name).replace(' ', '_');
-    s.description = QString::fromUtf8(i->description);
-    s.icon_name = QString::fromUtf8(pa_proplist_gets(i->proplist, PA_PROP_DEVICE_ICON_NAME));
-    s.volume = i->volume;
-    s.channel_map = i->channel_map;
-    s.mute = !!i->mute;
-    s.stream_restore_rule = "";
-
-    translateMasksAndMaps(s);
-
-    bool is_new = !captureDevices.contains(s.index);
-    captureDevices[s.index] = s;
-//     kDebug(67100) << "Got some info about source: " << s.description;
-
-    if (s_mixers.contains(KMIXPA_CAPTURE)) {
-        if (is_new)
-            s_mixers[KMIXPA_CAPTURE]->addWidget(s.index);
-        else {
-            int mid = s_mixers[KMIXPA_CAPTURE]->id2num(s.name);
-            if (mid >= 0) {
-                MixSet *ms = s_mixers[KMIXPA_CAPTURE]->getMixSet();
-                (*ms)[mid]->setReadableName(s.description);
-            }
-        }
-    }
-}
-
-static void client_cb(pa_context *c, const pa_client_info *i, int eol, void *) {
-
-    if (eol < 0) {
-        if (pa_context_errno(c) == PA_ERR_NOENTITY)
-            return;
-
-        kWarning(67100) << "Client callback failure";
-        return;
-    }
-
-    if (eol > 0) {
-        dec_outstanding(c);
-        return;
-    }
-
-    clients[i->index] = QString::fromUtf8(i->name);
-    //kDebug(67100) << "Got some info about client: " << clients[i->index];
-}
-
-static void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *) {
-
-    if (eol < 0) {
-        if (pa_context_errno(c) == PA_ERR_NOENTITY)
-            return;
-
-        kWarning(67100) << "Sink Input callback failure";
-        return;
-    }
-
-    if (eol > 0) {
-        dec_outstanding(c);
-        if (s_mixers.contains(KMIXPA_APP_PLAYBACK))
-            s_mixers[KMIXPA_APP_PLAYBACK]->triggerUpdate();
-        return;
-    }
-
-    const char *t;
-    if ((t = pa_proplist_gets(i->proplist, "module-stream-restore.id"))) {
-        if (strcmp(t, KMIXPA_EVENT_KEY) == 0) {
-            //kDebug(67100) << "Ignoring sink-input due to it being designated as an event and thus handled by the Event slider";
-            return;
-        }
-    }
-
-    QString appname = i18n("Unknown Application");
-    if (clients.contains(i->client))
-        appname = clients[i->client];
-
-    QString prefix = QString("%1: ").arg(appname);
-
-    devinfo s;
-    s.index = i->index;
-    s.device_index = i->sink;
-    s.description = prefix + QString::fromUtf8(i->name);
-    s.name = QString("stream:") + QString::number(i->index); //appname.replace(' ', '_').toLower();
-    s.icon_name = getIconNameFromProplist(i->proplist);
-    s.channel_map = i->channel_map;
-    s.volume = i->volume;
-    s.mute = !!i->mute;
-    s.stream_restore_rule = QString::fromUtf8(t);
-
-    translateMasksAndMaps(s);
-
-    bool is_new = !outputStreams.contains(s.index);
-    outputStreams[s.index] = s;
-//     kDebug(67100) << "Got some info about sink input (playback stream): " << s.description;
-
-    if (s_mixers.contains(KMIXPA_APP_PLAYBACK)) {
-        if (is_new)
-            s_mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index, true);
-        else {
-            int mid = s_mixers[KMIXPA_APP_PLAYBACK]->id2num(s.name);
-            if (mid >= 0) {
-                MixSet *ms = s_mixers[KMIXPA_APP_PLAYBACK]->getMixSet();
-                (*ms)[mid]->setReadableName(s.description);
-            }
-        }
-    }
-}
-
-static void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, void *) {
-
-    if (eol < 0) {
-        if (pa_context_errno(c) == PA_ERR_NOENTITY)
-            return;
-
-        kWarning(67100) << "Source Output callback failure";
-        return;
-    }
-
-    if (eol > 0) {
-        dec_outstanding(c);
-        if (s_mixers.contains(KMIXPA_APP_CAPTURE))
-            s_mixers[KMIXPA_APP_CAPTURE]->triggerUpdate();
-        return;
-    }
-
-    /* NB Until Source Outputs support volumes, we just use the volume of the source itself */
-    if (!captureDevices.contains(i->source)) {
-        kDebug(67100) << "Source Output refers to a Source we don't have any info for (probably just a peak meter or similar)";
-        return;
-    }
-
-    QString appname = i18n("Unknown Application");
-    if (clients.contains(i->client))
-        appname = clients[i->client];
-
-    QString prefix = QString("%1: ").arg(appname);
-
-    devinfo s;
-    s.index = i->index;
-    s.device_index = i->source;
-    s.description = prefix + QString::fromUtf8(i->name);
-    s.name = QString("stream:") + QString::number(i->index); //appname.replace(' ', '_').toLower();
-    s.icon_name = getIconNameFromProplist(i->proplist);
-    s.channel_map = i->channel_map;
-#if HAVE_SOURCE_OUTPUT_VOLUMES
-    s.volume = i->volume;
-    s.mute = !!i->mute;
-#else
-    s.volume = captureDevices[i->source].volume;
-    s.mute = captureDevices[i->source].mute;
-#endif
-    s.stream_restore_rule = QString::fromUtf8(pa_proplist_gets(i->proplist, "module-stream-restore.id"));
-
-    translateMasksAndMaps(s);
-
-    bool is_new = !captureStreams.contains(s.index);
-    captureStreams[s.index] = s;
-//     kDebug(67100) << "Got some info about source output (capture stream): " << s.description;
-
-    if (s_mixers.contains(KMIXPA_APP_CAPTURE)) {
-        if (is_new)
-            s_mixers[KMIXPA_APP_CAPTURE]->addWidget(s.index, true);
-        else {
-            int mid = s_mixers[KMIXPA_APP_CAPTURE]->id2num(s.name);
-            if (mid >= 0) {
-                MixSet *ms = s_mixers[KMIXPA_APP_CAPTURE]->getMixSet();
-                (*ms)[mid]->setReadableName(s.description);
-            }
-        }
-    }
-}
-
-
-static devinfo create_role_devinfo(QString name) {
-
-    Q_ASSERT(s_RestoreRules.contains(name));
-
-    devinfo s;
-    s.index = s.device_index = PA_INVALID_INDEX;
-    s.description = i18n("Event Sounds");
-    s.name = QString("restore:") + name;
-    s.icon_name = "dialog-information";
-    s.channel_map = s_RestoreRules[name].channel_map;
-    s.volume = s_RestoreRules[name].volume;
-    s.mute = s_RestoreRules[name].mute;
-    s.stream_restore_rule = name;
-
-    translateMasksAndMaps(s);
-    return s;
-}
-
-
-void ext_stream_restore_read_cb(pa_context *c, const pa_ext_stream_restore_info *i, int eol, void *) {
-
-    if (eol < 0) {
-        dec_outstanding(c);
-        kWarning(67100) << "Failed to initialize stream_restore extension: " << pa_strerror(pa_context_errno(s_context));
-        return;
-    }
-
-    if (eol > 0) {
-        dec_outstanding(c);
-
-        // Special case: ensure that our media events exists.
-        // On first login by a new users, this wont be in our database so we should create it.
-        if (!s_RestoreRules.contains(KMIXPA_EVENT_KEY)) {
-            // Create a fake rule
-            restoreRule rule;
-            rule.channel_map.channels = 1;
-            rule.channel_map.map[0] = PA_CHANNEL_POSITION_MONO;
-            rule.volume.channels = 1;
-            rule.volume.values[0] = PA_VOLUME_NORM;
-            rule.mute = false;
-            rule.device = "";
-            s_RestoreRules[KMIXPA_EVENT_KEY] = rule;
-            kDebug(67100) << "Initialising restore rule for new user: " << i18n("Event Sounds");
-        }
-
-        if (s_mixers.contains(KMIXPA_APP_PLAYBACK)) {
-            // If we have rules, it will be created below... but if no rules
-            // then we add it here.
-            if (!outputRoles.contains(PA_INVALID_INDEX)) {
-                devinfo s = create_role_devinfo(KMIXPA_EVENT_KEY);
-                outputRoles[s.index] = s;
-
-                s_mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
-            }
-
-            s_mixers[KMIXPA_APP_PLAYBACK]->triggerUpdate();
-        }
-
-        return;
-    }
-
-
-    QString name = QString::fromUtf8(i->name);
-//     kDebug(67100) << QString("Got some info about restore rule: '%1' (Device: %2)").arg(name).arg(i->device ? i->device : "None");
-    restoreRule rule;
-    rule.channel_map = i->channel_map;
-    rule.volume = i->volume;
-    rule.mute = !!i->mute;
-    rule.device = i->device;
-
-    if (rule.channel_map.channels < 1 && name == KMIXPA_EVENT_KEY) {
-        // Stream restore rules may not have valid volumes/channel maps (as these are optional)
-        // but we need a valid volume+channelmap for our events sounds so fix it up.
-        rule.channel_map.channels = 1;
-        rule.channel_map.map[0] = PA_CHANNEL_POSITION_MONO;
-        rule.volume.channels = 1;
-        rule.volume.values[0] = PA_VOLUME_NORM;
-    }
-
-    s_RestoreRules[name] = rule;
-
-    if (s_mixers.contains(KMIXPA_APP_PLAYBACK)) {
-        // We only want to know about Sound Events for now...
-        if (name == KMIXPA_EVENT_KEY) {
-            devinfo s = create_role_devinfo(name);
-            bool is_new = !outputRoles.contains(s.index);
-            outputRoles[s.index] = s;
-
-            if (is_new)
-                s_mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index, true);
-        }
-    }
-}
-
-static void ext_stream_restore_subscribe_cb(pa_context *c, void *) {
-
-    Q_ASSERT(c == s_context);
-
-    pa_operation *o;
-    if (!(o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, NULL))) {
-        kWarning(67100) << "pa_ext_stream_restore_read() failed";
-        return;
-    }
-
-    pa_operation_unref(o);
-}
-
-
-static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index, void *) {
-
-    Q_ASSERT(c == s_context);
-
-    switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
-        case PA_SUBSCRIPTION_EVENT_SINK:
-            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-                if (s_mixers.contains(KMIXPA_PLAYBACK))
-                    s_mixers[KMIXPA_PLAYBACK]->removeWidget(index);
-            } else {
-                pa_operation *o;
-                if (!(o = pa_context_get_sink_info_by_index(c, index, sink_cb, NULL))) {
-                    kWarning(67100) << "pa_context_get_sink_info_by_index() failed";
-                    return;
-                }
-                pa_operation_unref(o);
-            }
-            break;
-
-        case PA_SUBSCRIPTION_EVENT_SOURCE:
-            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-                if (s_mixers.contains(KMIXPA_CAPTURE))
-                    s_mixers[KMIXPA_CAPTURE]->removeWidget(index);
-            } else {
-                pa_operation *o;
-                if (!(o = pa_context_get_source_info_by_index(c, index, source_cb, NULL))) {
-                    kWarning(67100) << "pa_context_get_source_info_by_index() failed";
-                    return;
-                }
-                pa_operation_unref(o);
-            }
-            break;
-
-        case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
-            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-                if (s_mixers.contains(KMIXPA_APP_PLAYBACK))
-                    s_mixers[KMIXPA_APP_PLAYBACK]->removeWidget(index);
-            } else {
-                pa_operation *o;
-                if (!(o = pa_context_get_sink_input_info(c, index, sink_input_cb, NULL))) {
-                    kWarning(67100) << "pa_context_get_sink_input_info() failed";
-                    return;
-                }
-                pa_operation_unref(o);
-            }
-            break;
-
-        case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT:
-            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-                if (s_mixers.contains(KMIXPA_APP_CAPTURE))
-                    s_mixers[KMIXPA_APP_CAPTURE]->removeWidget(index);
-            } else {
-                pa_operation *o;
-                if (!(o = pa_context_get_source_output_info(c, index, source_output_cb, NULL))) {
-                    kWarning(67100) << "pa_context_get_sink_input_info() failed";
-                    return;
-                }
-                pa_operation_unref(o);
-            }
-            break;
-
-        case PA_SUBSCRIPTION_EVENT_CLIENT:
-            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-                clients.remove(index);
-            } else {
-                pa_operation *o;
-                if (!(o = pa_context_get_client_info(c, index, client_cb, NULL))) {
-                    kWarning(67100) << "pa_context_get_client_info() failed";
-                    return;
-                }
-                pa_operation_unref(o);
-            }
-            break;
-
-    }
-}
-
-
-static void context_state_callback(pa_context *c, void *)
-{
-    pa_context_state_t state = pa_context_get_state(c);
-    if (state == PA_CONTEXT_READY) {
-        // Attempt to load things up
-        pa_operation *o;
-
-        // 1. Register for the stream changes (except during probe)
-        if (s_context == c) {
-            pa_context_set_subscribe_callback(c, subscribe_cb, NULL);
-
-            if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)
-                                           (PA_SUBSCRIPTION_MASK_SINK|
-                                            PA_SUBSCRIPTION_MASK_SOURCE|
-                                            PA_SUBSCRIPTION_MASK_CLIENT|
-                                            PA_SUBSCRIPTION_MASK_SINK_INPUT|
-                                            PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT), NULL, NULL))) {
-                kWarning(67100) << "pa_context_subscribe() failed";
-                return;
-            }
-            pa_operation_unref(o);
-        }
-
-        if (!(o = pa_context_get_sink_info_list(c, sink_cb, NULL))) {
-            kWarning(67100) << "pa_context_get_sink_info_list() failed";
-            return;
-        }
-        pa_operation_unref(o);
-        s_outstandingRequests++;
-
-        if (!(o = pa_context_get_source_info_list(c, source_cb, NULL))) {
-            kWarning(67100) << "pa_context_get_source_info_list() failed";
-            return;
-        }
-        pa_operation_unref(o);
-        s_outstandingRequests++;
-
-
-        if (!(o = pa_context_get_client_info_list(c, client_cb, NULL))) {
-            kWarning(67100) << "pa_context_client_info_list() failed";
-            return;
-        }
-        pa_operation_unref(o);
-        s_outstandingRequests++;
-
-        if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, NULL))) {
-            kWarning(67100) << "pa_context_get_sink_input_info_list() failed";
-            return;
-        }
-        pa_operation_unref(o);
-        s_outstandingRequests++;
-
-        if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, NULL))) {
-            kWarning(67100) << "pa_context_get_source_output_info_list() failed";
-            return;
-        }
-        pa_operation_unref(o);
-        s_outstandingRequests++;
-
-        /* These calls are not always supported */
-        if ((o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, NULL))) {
-            pa_operation_unref(o);
-            s_outstandingRequests++;
-
-            pa_ext_stream_restore_set_subscribe_cb(c, ext_stream_restore_subscribe_cb, NULL);
-
-            if ((o = pa_ext_stream_restore_subscribe(c, 1, NULL, NULL)))
-                pa_operation_unref(o);
-        } else {
-            kWarning(67100) << "Failed to initialize stream_restore extension: " << pa_strerror(pa_context_errno(s_context));
-        }
-    } else if (!PA_CONTEXT_IS_GOOD(state)) {
-        // If this is our probe phase, exit our context immediately
-        if (s_context != c) {
-            pa_context_disconnect(c);
-        } else {
-            // If we're not probing, it means we've been disconnected from our
-            // glib context
-            pa_context_unref(s_context);
-            s_context = NULL;
-
-            // Remove all GUI elements
-            QMap<int,Mixer_PULSE*>::iterator it;
-            for (it = s_mixers.begin(); it != s_mixers.end(); ++it) {
-                (*it)->removeAllWidgets();
-            }
-            // This one is not handled above.
-            clients.clear();
-
-            if (s_mixers.contains(KMIXPA_PLAYBACK)) {
-                kWarning(67100) << "Connection to PulseAudio daemon closed. Attempting reconnection.";
-                s_pulseActive = UNKNOWN;
-                QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit()));
-            }
-        }
-    }
-}
-
-static void setVolumeFromPulse(Volume& volume, const devinfo& dev)
-{
-    chanIDMap::const_iterator iter;
-    for (iter = dev.chanIDs.begin(); iter != dev.chanIDs.end(); ++iter)
-    {
-        //kDebug(67100) <<  "Setting volume for channel " << iter.value() << " to " << (long)dev.volume.values[iter.key()] << " (" << ((100*(long)dev.volume.values[iter.key()]) / PA_VOLUME_NORM) << "%)";
-        volume.setVolume(iter.value(), (long)dev.volume.values[iter.key()]);
-    }
-}
-
-static pa_cvolume genVolumeForPulse(const devinfo& dev, Volume& volume)
-{
-    pa_cvolume cvol = dev.volume;
-
-    chanIDMap::const_iterator iter;
-    for (iter = dev.chanIDs.begin(); iter != dev.chanIDs.end(); ++iter)
-    {
-        cvol.values[iter.key()] = (uint32_t)volume.getVolume(iter.value());
-        //kDebug(67100) <<  "Setting volume for channel " << iter.value() << " to " << cvol.values[iter.key()] << " (" << ((100*cvol.values[iter.key()]) / PA_VOLUME_NORM) << "%)";
-    }
-    return cvol;
-}
-
-static devmap* get_widget_map(int type, QString id = "")
-{
-    Q_ASSERT(type >= 0 && type <= KMIXPA_WIDGET_MAX);
-
-    if (KMIXPA_PLAYBACK == type)
-        return &outputDevices;
-    else if (KMIXPA_CAPTURE == type)
-        return &captureDevices;
-    else if (KMIXPA_APP_PLAYBACK == type) {
-        if (id.startsWith("restore:"))
-            return &outputRoles;
-        return &outputStreams;
-    } else if (KMIXPA_APP_CAPTURE == type)
-        return &captureStreams;
-
-    Q_ASSERT(0);
-    return NULL;
-}
-static devmap* get_widget_map(int type, int index)
-{
-    if (PA_INVALID_INDEX == (uint32_t)index)
-        return get_widget_map(type, "restore:");
-    return get_widget_map(type);
-}
-
-void Mixer_PULSE::emitControlsReconfigured()
-{
-       //      emit controlsReconfigured(_mixer->id());
-    // Do not emit directly to ensure all connected slots are executed
-    // in their own event loop.
-
-       /*
-        * Bug 309464:
-        *
-        * Comment by cesken: I am not really sure what the comment above means.
-        *  1) IIRC coling told me "otherwise KMix crashes".
-        *  2) There are also bug reports that heavily indicate the crash when operation the "move stream" from a popup
-        *     menu.
-        *  3) I don't know what the "executed in their own event loop" means. Are we in a "wrong" thread here (PA),
-        *     which is not suitable for GUI code?!?
-        *
-        * Work note: Ouch. it means PA thread makes direct calls via announce(), and do even GUI code. OUCH. Redo this comments!
-        *
-        *  Conclusions:
-        *  a) It seems there seems to be some object deletion hazard with a QMenu (the one for "move stream")
-        *  b)  I do not see why executing it Queued is better, because you can never know when it is actually being
-        *      executed: it could be "right now". It looks like Qt currently executes it after the QMenu hazard has
-        *      resolved itselves miracously.
-        *  c) I am definitely strongly opposed on this "execute later" approach. It is pure gambling IMO and might be
-        *     broken any time (from DEBUG to RELEASE build, or by a new Qt or KDE version).
-        *
-        *     TODO Somebody with more Qt and PA internal insight might help to clear up things here.
-        *
-        *  Temporary solution: Do the QueuedConnection until we really know hat is going on. But the called code
-        *                      pulseControlsReconfigured() will then do the standard announce() so that every part of
-        *                      KMix automatically gets updated.
-        *
-        */
-    QMetaObject::invokeMethod(this,
-                              "pulseControlsReconfigured",
-                              Qt::QueuedConnection);
-
-//    QMetaObject::invokeMethod(this,
-//                              "pulseControlsReconfigured",
-//                              Qt::QueuedConnection,
-//                              Q_ARG(QString, _mixer->id()));
-}
-
-void Mixer_PULSE::pulseControlsReconfigured()
-{
-       kDebug() << "Reconfigure " << _mixer->id();
-    ControlManager::instance().announce(_mixer->id(), ControlChangeType::ControlList, getDriverName());
-}
-
-void Mixer_PULSE::pulseControlsReconfigured(QString mixerId)
-{
-       kDebug() << "Reconfigure " << mixerId;
-    ControlManager::instance().announce(mixerId, ControlChangeType::ControlList, getDriverName());
-}
-
-void Mixer_PULSE::updateRecommendedMaster(devmap* map)
-{
-    unsigned int prio = 0;
-    std::shared_ptr<MixDevice> res;
-    MixSet::iterator iter;
-
-    for (iter = m_mixDevices.begin(); iter != m_mixDevices.end(); ++iter) {
-        unsigned int devprio = map->value( id2num((*iter)->id()) ).priority;
-        if (( devprio > prio ) || !res ) {
-            prio = devprio;
-            res = *iter;
-        }
-    }
-
-    if (res)
-         kDebug(67100) << "Selecting master " << res->id()
-                       << " for type " << m_devnum;
-    m_recommendedMaster = res;
-}
-
-void Mixer_PULSE::addWidget(int index, bool isAppStream)
-{
-    devmap* map = get_widget_map(m_devnum, index);
-
-    if (!map->contains(index)) {
-        kWarning(67100) << "New " << m_devnum << " widget notified for index "
-                        << index << " but I cannot find it in my list :s";
-        return;
-    }
-
-    if (addDevice((*map)[index], isAppStream))
-        updateRecommendedMaster(map);
-    emitControlsReconfigured();
-}
-
-void Mixer_PULSE::removeWidget(int index)
-{
-    devmap* map = get_widget_map(m_devnum);
-
-    if (!map->contains(index)) {
-        kDebug(67100) << "Removing " << m_devnum << " widget notified for index "
-                      << index << " but I cannot find it in my list :s";
-        // Sometimes we ignore things (e.g. event sounds) so don't be too noisy here.
-        return;
-    }
-
-    QString id = (*map)[index].name;
-    map->remove(index);
-
-    // We need to find the MixDevice that goes with this widget and remove it.
-    MixSet::iterator iter;
-    std::shared_ptr<MixDevice> md;
-    for (iter = m_mixDevices.begin(); iter != m_mixDevices.end(); ++iter)
-    {
-        if ((*iter)->id() == id)
-        {
-            md = m_mixDevices.get(id);
-            kDebug() << "MixDevice 1 useCount=" << md.use_count();
-            md->close();
-            kDebug() << "MixDevice 2 useCount=" << md.use_count();
-            m_mixDevices.erase(iter);
-            kDebug() << "MixDevice 3 useCount=" << md.use_count();
-            break;
-        }
-    }
-
-    if (md)
-        updateRecommendedMaster(map);
-    emitControlsReconfigured();
-    kDebug() << "MixDevice 4 useCount=" << md.use_count();
-}
-
-void Mixer_PULSE::removeAllWidgets()
-{
-    devmap* map = get_widget_map(m_devnum);
-    map->clear();
-
-    // Special case
-    if (KMIXPA_APP_PLAYBACK == m_devnum)
-        outputRoles.clear();
-
-    freeMixDevices();
-    emitControlsReconfigured();
-}
-
-bool Mixer_PULSE::addDevice(devinfo& dev, bool isAppStream)
-{
-    if (dev.chanMask == Volume::MNONE)
-        return false;
-
-        MixSet *ms = 0;
-        if (m_devnum == KMIXPA_APP_PLAYBACK && s_mixers.contains(KMIXPA_PLAYBACK))
-            ms = s_mixers[KMIXPA_PLAYBACK]->getMixSet();
-        else if (m_devnum == KMIXPA_APP_CAPTURE && s_mixers.contains(KMIXPA_CAPTURE))
-            ms = s_mixers[KMIXPA_CAPTURE]->getMixSet();
-
-        int maxVol = GlobalConfig::instance().data.volumeOverdrive ? PA_VOLUME_UI_MAX : PA_VOLUME_NORM;
-        Volume v(maxVol, PA_VOLUME_MUTED, true, false);
-        v.addVolumeChannels(dev.chanMask);
-        setVolumeFromPulse(v, dev);
-        MixDevice* md = new MixDevice( _mixer, dev.name, dev.description, dev.icon_name, ms);
-        if (isAppStream)
-            md->setApplicationStream(true);
-
-        kDebug(67100) << "Adding Pulse volume " << dev.name << ", isCapture= "
-                      << (m_devnum == KMIXPA_CAPTURE || m_devnum == KMIXPA_APP_CAPTURE)
-                      << ", isAppStream= " << isAppStream << "=" << md->isApplicationStream() << ", devnum=" << m_devnum;
-        md->addPlaybackVolume(v);
-        md->setMuted(dev.mute);
-        m_mixDevices.append(md->addToPool());
-    return true;
-}
-
-Mixer_Backend* PULSE_getMixer( Mixer *mixer, int devnum )
-{
-   Mixer_Backend *l_mixer;
-   l_mixer = new Mixer_PULSE( mixer, devnum );
-   return l_mixer;
-}
-
-bool Mixer_PULSE::connectToDaemon()
-{
-    Q_ASSERT(NULL == s_context);
-
-    kDebug(67100) <<  "Attempting connection to PulseAudio sound daemon";
-    pa_mainloop_api *api = pa_glib_mainloop_get_api(s_mainloop);
-    Q_ASSERT(api);
-
-    s_context = pa_context_new(api, "KMix");
-    Q_ASSERT(s_context);
-
-    if (pa_context_connect(s_context, NULL, PA_CONTEXT_NOFAIL, 0) < 0) {
-        pa_context_unref(s_context);
-        s_context = NULL;
-        return false;
-    }
-    pa_context_set_state_callback(s_context, &context_state_callback, NULL);
-    return true;
-}
-
-
-Mixer_PULSE::Mixer_PULSE(Mixer *mixer, int devnum) : Mixer_Backend(mixer, devnum)
-{
-    if ( devnum == -1 )
-        m_devnum = 0;
-
-    // We require a glib event loop
-    if (!QByteArray(QAbstractEventDispatcher::instance()->metaObject()->className()).contains("EventDispatcherGlib")) {
-        kDebug(67100) << "Disabling PulseAudio integration for lack of GLib event loop";
-        s_pulseActive = INACTIVE;
-    }
-
-
-    ++refcount;
-    if (INACTIVE != s_pulseActive && 1 == refcount)
-    {
-        // First of all conenct to PA via simple/blocking means and if that succeeds,
-        // use a fully async integrated mainloop method to connect and get proper support.
-        pa_mainloop *p_test_mainloop;
-        if (!(p_test_mainloop = pa_mainloop_new())) {
-            kDebug(67100) << "PulseAudio support disabled: Unable to create mainloop";
-            s_pulseActive = INACTIVE;
-            goto endconstruct;
-        }
-
-        pa_context *p_test_context;
-        if (!(p_test_context = pa_context_new(pa_mainloop_get_api(p_test_mainloop), "kmix-probe"))) {
-            kDebug(67100) << "PulseAudio support disabled: Unable to create context";
-            pa_mainloop_free(p_test_mainloop);
-            s_pulseActive = INACTIVE;
-            goto endconstruct;
-        }
-
-        kDebug(67100) << "Probing for PulseAudio...";
-        // (cg) Convert to PA_CONTEXT_NOFLAGS when PulseAudio 0.9.19 is required
-        if (pa_context_connect(p_test_context, NULL, static_cast<pa_context_flags_t>(0), NULL) < 0) {
-            kDebug(67100) << QString("PulseAudio support disabled: %1").arg(pa_strerror(pa_context_errno(p_test_context)));
-            pa_context_disconnect(p_test_context);
-            pa_context_unref(p_test_context);
-            pa_mainloop_free(p_test_mainloop);
-            s_pulseActive = INACTIVE;
-            goto endconstruct;
-        }
-
-        // Assume we are inactive, it will be set to active if appropriate
-        s_pulseActive = INACTIVE;
-        pa_context_set_state_callback(p_test_context, &context_state_callback, NULL);
-        for (;;) {
-          pa_mainloop_iterate(p_test_mainloop, 1, NULL);
-
-          if (!PA_CONTEXT_IS_GOOD(pa_context_get_state(p_test_context))) {
-            kDebug(67100) << "PulseAudio probe complete.";
-            break;
-          }
-        }
-        pa_context_disconnect(p_test_context);
-        pa_context_unref(p_test_context);
-        pa_mainloop_free(p_test_mainloop);
-
-
-        if (INACTIVE != s_pulseActive)
-        {
-            // Reconnect via integrated mainloop
-            s_mainloop = pa_glib_mainloop_new(NULL);
-            Q_ASSERT(s_mainloop);
-
-            connectToDaemon();
-
-#if defined(HAVE_CANBERRA)
-            int ret = ca_context_create(&s_ccontext);
-            if (ret < 0) {
-                kDebug(67100) << "Disabling Sound Feedback. Canberra context failed.";
-                s_ccontext = NULL;
-            } else
-                ca_context_set_driver(s_ccontext, "pulse");
-#endif
-        }
-
-        kDebug(67100) <<  "PulseAudio status: " << (s_pulseActive==UNKNOWN ? "Unknown (bug)" : (s_pulseActive==ACTIVE ? "Active" : "Inactive"));
-    }
-
-endconstruct:
-    s_mixers[m_devnum] = this;
-}
-
-Mixer_PULSE::~Mixer_PULSE()
-{
-    s_mixers.remove(m_devnum);
-
-    if (refcount > 0)
-    {
-        --refcount;
-        if (0 == refcount)
-        {
-#if defined(HAVE_CANBERRA)
-            if (s_ccontext) {
-                ca_context_destroy(s_ccontext);
-                s_ccontext = NULL;
-            }
-#endif
-
-            if (s_context) {
-                pa_context_unref(s_context);
-                s_context = NULL;
-            }
-
-            if (s_mainloop) {
-                pa_glib_mainloop_free(s_mainloop);
-                s_mainloop = NULL;
-            }
-        }
-    }
-
-    closeCommon();
-}
-
-int Mixer_PULSE::open()
-{
-    //kDebug(67100) <<  "Trying Pulse sink";
-
-    if (ACTIVE == s_pulseActive && m_devnum <= KMIXPA_APP_CAPTURE)
-    {
-        // Make sure the GUI layers know we are dynamic so as to always paint us
-        _mixer->setDynamic();
-
-        devmap::iterator iter;
-        if (KMIXPA_PLAYBACK == m_devnum)
-        {
-               _id = "Playback Devices";
-               registerCard(i18n("Playback Devices"));
-            for (iter = outputDevices.begin(); iter != outputDevices.end(); ++iter)
-                addDevice(*iter);
-            updateRecommendedMaster(&outputDevices);
-        }
-        else if (KMIXPA_CAPTURE == m_devnum)
-        {
-               _id = "Capture Devices";
-               registerCard(i18n("Capture Devices"));
-            for (iter = captureDevices.begin(); iter != captureDevices.end(); ++iter)
-                addDevice(*iter);
-            updateRecommendedMaster(&outputDevices);
-        }
-        else if (KMIXPA_APP_PLAYBACK == m_devnum)
-        {
-               _id = "Playback Streams";
-               registerCard(i18n("Playback Streams"));
-            for (iter = outputRoles.begin(); iter != outputRoles.end(); ++iter)
-                addDevice(*iter, true);
-            updateRecommendedMaster(&outputRoles);
-            for (iter = outputStreams.begin(); iter != outputStreams.end(); ++iter)
-                addDevice(*iter, true);
-            updateRecommendedMaster(&outputStreams);
-        }
-        else if (KMIXPA_APP_CAPTURE == m_devnum)
-        {
-               _id = "Capture Streams";
-            registerCard(i18n("Capture Streams"));
-            for (iter = captureStreams.begin(); iter != captureStreams.end(); ++iter)
-                addDevice(*iter);
-            updateRecommendedMaster(&captureStreams);
-        }
-
-        kDebug(67100) <<  "Using PulseAudio for mixer: " << getName();
-        m_isOpen = true;
-    }
-
-    return 0;
-}
-
-int Mixer_PULSE::close()
-{
-       closeCommon();
-    return 1;
-}
-
-int Mixer_PULSE::id2num(const QString& id) {
-    int num = -1;
-    // todo: Store this in a hash or similar
-    int i;
-    for (i = 0; i < m_mixDevices.size(); ++i) {
-        if (m_mixDevices[i]->id() == id) {
-            num = i;
-            break;
-        }
-    }
-    //kDebug(67100) << "id2num() num=" << num;
-    return num;
-}
-
-int Mixer_PULSE::readVolumeFromHW( const QString& id, std::shared_ptr<MixDevice> md )
-{
-    devmap *map = get_widget_map(m_devnum, id);
-
-    devmap::iterator iter;
-    for (iter = map->begin(); iter != map->end(); ++iter)
-    {
-        if (iter->name == id)
-        {
-            setVolumeFromPulse(md->playbackVolume(), *iter);
-            md->setMuted(iter->mute);
-            break;
-        }
-    }
-
-    return 0;
-}
-
-int Mixer_PULSE::writeVolumeToHW( const QString& id, std::shared_ptr<MixDevice> md )
-{
-    devmap::iterator iter;
-    if (KMIXPA_PLAYBACK == m_devnum)
-    {
-        for (iter = outputDevices.begin(); iter != outputDevices.end(); ++iter)
-        {
-            if (iter->name == id)
-            {
-                pa_operation *o;
-
-                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-                if (!(o = pa_context_set_sink_volume_by_index(s_context, iter->index, &volume, NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_sink_volume_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-
-                if (!(o = pa_context_set_sink_mute_by_index(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_sink_mute_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-
-#if defined(HAVE_CANBERRA)
-                if (s_ccontext && Mixer::getBeepOnVolumeChange() ) {
-                    int playing = 0;
-                    int cindex = 2; // Note "2" is simply the index we've picked. It's somewhat irrelevant.
-
-                    
-                    ca_context_playing(s_ccontext, cindex, &playing);
-
-                    // NB Depending on how this is desired to work, we may want to simply
-                    // skip playing, or cancel the currently playing sound and play our
-                    // new one... for now, let's do the latter.
-                    if (playing) {
-                        ca_context_cancel(s_ccontext, cindex);
-                        playing = 0;
-                    }
-                    
-                    if (!playing) {
-                        char dev[64];
-
-                        snprintf(dev, sizeof(dev), "%lu", (unsigned long) iter->index);
-                        ca_context_change_device(s_ccontext, dev);
-
-                        // Ideally we'd use something like ca_gtk_play_for_widget()...
-                        ca_context_play(
-                            s_ccontext,
-                            cindex,
-                            CA_PROP_EVENT_DESCRIPTION, i18n("Volume Control Feedback Sound").toUtf8().constData(),
-                            CA_PROP_EVENT_ID, "audio-volume-change",
-                            CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
-                            CA_PROP_CANBERRA_ENABLE, "1",
-                            NULL
-                        );
-
-                        ca_context_change_device(s_ccontext, NULL);
-                    }
-                }
-#endif
-
-                return 0;
-            }
-        }
-    }
-    else if (KMIXPA_CAPTURE == m_devnum)
-    {
-        for (iter = captureDevices.begin(); iter != captureDevices.end(); ++iter)
-        {
-            if (iter->name == id)
-            {
-                pa_operation *o;
-
-                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-                if (!(o = pa_context_set_source_volume_by_index(s_context, iter->index, &volume, NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_source_volume_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-
-                if (!(o = pa_context_set_source_mute_by_index(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_source_mute_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-
-                return 0;
-            }
-        }
-    }
-    else if (KMIXPA_APP_PLAYBACK == m_devnum)
-    {
-        if (id.startsWith("stream:"))
-        {
-            for (iter = outputStreams.begin(); iter != outputStreams.end(); ++iter)
-            {
-                if (iter->name == id)
-                {
-                    pa_operation *o;
-
-                    pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-                    if (!(o = pa_context_set_sink_input_volume(s_context, iter->index, &volume, NULL, NULL))) {
-                        kWarning(67100) <<  "pa_context_set_sink_input_volume() failed";
-                        return Mixer::ERR_READ;
-                    }
-                    pa_operation_unref(o);
-
-                    if (!(o = pa_context_set_sink_input_mute(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
-                        kWarning(67100) <<  "pa_context_set_sink_input_mute() failed";
-                        return Mixer::ERR_READ;
-                    }
-                    pa_operation_unref(o);
-
-                    return 0;
-                }
-            }
-        }
-        else if (id.startsWith("restore:"))
-        {
-            for (iter = outputRoles.begin(); iter != outputRoles.end(); ++iter)
-            {
-                if (iter->name == id)
-                {
-                    restoreRule &rule = s_RestoreRules[iter->stream_restore_rule];
-                    pa_ext_stream_restore_info info;
-                    info.name = iter->stream_restore_rule.toUtf8().constData();
-                    info.channel_map = rule.channel_map;
-                    info.volume = genVolumeForPulse(*iter, md->playbackVolume());
-                    info.device = rule.device.isEmpty() ? NULL : rule.device.toUtf8().constData();
-                    info.mute = (md->isMuted() ? 1 : 0);
-
-                    pa_operation* o;
-                    if (!(o = pa_ext_stream_restore_write(s_context, PA_UPDATE_REPLACE, &info, 1, true, NULL, NULL))) {
-                        kWarning(67100) <<  "pa_ext_stream_restore_write() failed" << info.channel_map.channels << info.volume.channels << info.name;
-                        return Mixer::ERR_READ;
-                    }
-                    pa_operation_unref(o);
-
-                    return 0;
-                }
-            }
-        }
-    }
-    else if (KMIXPA_APP_CAPTURE == m_devnum)
-    {
-        for (iter = captureStreams.begin(); iter != captureStreams.end(); ++iter)
-        {
-            if (iter->name == id)
-            {
-                pa_operation *o;
-
-#if HAVE_SOURCE_OUTPUT_VOLUMES
-                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-                if (!(o = pa_context_set_source_output_volume(s_context, iter->index, &volume, NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_source_output_volume_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-
-                if (!(o = pa_context_set_source_output_mute(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_source_output_mute_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-#else                
-                // NB Note that this is different from APP_PLAYBACK in that we set the volume on the source itself.
-                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-                if (!(o = pa_context_set_source_volume_by_index(s_context, iter->device_index, &volume, NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_source_volume_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-
-                if (!(o = pa_context_set_source_mute_by_index(s_context, iter->device_index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
-                    kWarning(67100) <<  "pa_context_set_source_mute_by_index() failed";
-                    return Mixer::ERR_READ;
-                }
-                pa_operation_unref(o);
-#endif
-
-                return 0;
-            }
-        }
-    }
-
-    return 0;
-}
-
-/**
-* Move the stream to a new destination
-*/
-bool Mixer_PULSE::moveStream( const QString& id, const QString& destId ) {
-    Q_ASSERT(KMIXPA_APP_PLAYBACK == m_devnum || KMIXPA_APP_CAPTURE == m_devnum);
-
-    kDebug(67100) <<  "Mixer_PULSE::moveStream(): Move Stream Requested - Stream: " << id << ", Destination: " << destId;
-
-    // Lookup the stream index.
-    uint32_t stream_index = PA_INVALID_INDEX;
-    QString stream_restore_rule = "";
-    devmap::iterator iter;
-    devmap *map = get_widget_map(m_devnum);
-    for (iter = map->begin(); iter != map->end(); ++iter) {
-        if (iter->name == id) {
-            stream_index = iter->index;
-            stream_restore_rule = iter->stream_restore_rule;
-            break;
-        }
-    }
-
-    if (PA_INVALID_INDEX == stream_index) {
-        kError(67100) <<  "Mixer_PULSE::moveStream(): Cannot find stream index";
-        return false;
-    }
-
-    if (destId.isEmpty()) {
-        // We want to remove any specific device in the stream restore rule.
-        if (stream_restore_rule.isEmpty() || !s_RestoreRules.contains(stream_restore_rule)) {
-            kWarning(67100) <<  "Mixer_PULSE::moveStream(): Trying to set Automatic on a stream with no rule";
-        } else {
-            restoreRule &rule = s_RestoreRules[stream_restore_rule];
-            pa_ext_stream_restore_info info;
-            info.name = stream_restore_rule.toUtf8().constData();
-            info.channel_map = rule.channel_map;
-            info.volume = rule.volume;
-            info.device = NULL;
-            info.mute = rule.mute ? 1 : 0;
-
-            pa_operation* o;
-            if (!(o = pa_ext_stream_restore_write(s_context, PA_UPDATE_REPLACE, &info, 1, true, NULL, NULL))) {
-                kWarning(67100) <<  "pa_ext_stream_restore_write() failed" << info.channel_map.channels << info.volume.channels << info.name;
-                return Mixer::ERR_READ;
-            }
-            pa_operation_unref(o);
-        }
-    } else {
-        pa_operation* o;
-        if (KMIXPA_APP_PLAYBACK == m_devnum) {
-            if (!(o = pa_context_move_sink_input_by_name(s_context, stream_index, destId.toUtf8().constData(), NULL, NULL))) {
-                kWarning(67100) <<  "pa_context_move_sink_input_by_name() failed";
-                return false;
-            }
-        } else {
-            if (!(o = pa_context_move_source_output_by_name(s_context, stream_index, destId.toUtf8().constData(), NULL, NULL))) {
-                kWarning(67100) <<  "pa_context_move_source_output_by_name() failed";
-                return false;
-            }
-        }
-        pa_operation_unref(o);
-    }
-
-    return true;
-}
-
-void Mixer_PULSE::reinit()
-{
-    // We only support reinit on our primary mixer.
-    Q_ASSERT(KMIXPA_PLAYBACK == m_devnum);
-    connectToDaemon();
-}
-
-void Mixer_PULSE::triggerUpdate()
-{
-    readSetFromHWforceUpdate();
-    readSetFromHW();
-}
-
-// Please see KMixWindow::initActionsAfterInitMixer(), it uses the driverName
-
-QString PULSE_getDriverName() {
-        return "PulseAudio";
-}
-
-QString Mixer_PULSE::getDriverName()
-{
-        return "PulseAudio";
-}
-
-#include "moc_mixer_pulse.cpp"
diff --git a/kmix/backends/mixer_pulse.h b/kmix/backends/mixer_pulse.h
deleted file mode 100644 (file)
index d63060f..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *              KMix -- KDE's full featured mini mixer
- *
- *
- *              Copyright (C) 2008 Helio Chissini de Castro <helio@kde.org>
- *                       
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-#ifndef MIXER_PULSE_H
-#define MIXER_PULSE_H
-
-#include <QString>
-
-#include "mixer_backend.h"
-#include <pulse/pulseaudio.h>
-
-typedef QMap<uint8_t,Volume::ChannelID> chanIDMap;
-typedef struct {
-    int index;
-    int device_index;
-    QString name;
-    QString description;
-    QString icon_name;
-    pa_cvolume volume;
-    pa_channel_map channel_map;
-    bool mute;
-    QString stream_restore_rule;
-
-    Volume::ChannelMask chanMask;
-    chanIDMap chanIDs;
-    unsigned int priority;
-} devinfo;
-typedef QMap<int,devinfo> devmap;
-
-class Mixer_PULSE : public Mixer_Backend
-{
-    Q_OBJECT
-
-    public:
-        Mixer_PULSE(Mixer *mixer, int devnum);
-        virtual ~Mixer_PULSE();
-
-        virtual int readVolumeFromHW( const QString& id, std::shared_ptr<MixDevice> );
-        virtual int writeVolumeToHW ( const QString& id, std::shared_ptr<MixDevice> );
-
-        virtual bool moveStream( const QString& id, const QString& destId );
-
-        virtual QString getDriverName();
-        virtual QString getId() const { return _id; };
-
-        virtual bool needsPolling() { return false; }
-
-        void triggerUpdate();
-        void addWidget(int index, bool = false);
-        void removeWidget(int index);
-        void removeAllWidgets();
-        MixSet *getMixSet() { return &m_mixDevices; }
-        int id2num(const QString& id);
-
-    protected:
-        virtual int open();
-        virtual int close();
-
-        int fd;
-        QString _id;
-
-    private:
-        bool addDevice(devinfo& dev, bool isAppStream = false);
-        bool connectToDaemon();
-        void emitControlsReconfigured();
-        void updateRecommendedMaster(devmap* map);
-
-   protected slots:
-        void pulseControlsReconfigured(QString mixerId);
-        void pulseControlsReconfigured();
-
-public:
-        void reinit();
-
-};
-
-#endif
index bece77f..9074b1e 100644 (file)
@@ -29,8 +29,6 @@ GlobalConfig::GlobalConfig() :
        // General
        addItemBool("Tickmarks", data.showTicks, true);
        addItemBool("Labels", data.showLabels, true);
-       addItemBool("VolumeOverdrive", data.volumeOverdrive, false);
-       addItemBool("VolumeFeedback", data.beepOnVolumeChange, true);
        ItemString* is = addItemString("Orientation", data.orientationMainGUIString, "Vertical");
        kDebug() << is->name() << is->value();
        addItemString("Orientation.TrayPopup", data.orientationTrayPopupString, QLatin1String("Vertical"));
@@ -43,7 +41,6 @@ GlobalConfig::GlobalConfig() :
 
        // Startup
        addItemBool("AutoStart", data.allowAutostart, true);
-       addItemBool("VolumeFeedback", data.volumeFeedback, true);
        addItemBool("startkdeRestore", data.startkdeRestore, true);
 
        // Debug options: Not in dialog
index 2fc7ab5..ee41427 100644 (file)
@@ -37,11 +37,6 @@ public:
        bool showLabels;
        bool showOSD;
 
-       bool volumeFeedback;
-
-       bool volumeOverdrive; // whether more than recommended volume (typically 0dB) is allowed
-       bool beepOnVolumeChange;
-
        // Startup
        bool allowAutostart;
        bool showDockWidget;
index 747d79c..5841e77 100644 (file)
@@ -40,7 +40,6 @@
 QList<Mixer *> Mixer::s_mixers;
 MasterControl Mixer::_globalMasterCurrent;
 MasterControl Mixer::_globalMasterPreferred;
-bool Mixer::m_beepOnVolumeChange = false;
 
 int Mixer::numDrivers()
 {
@@ -77,17 +76,6 @@ bool Mixer::dynamicBackendsPresent()
   return false;
 }
 
-bool Mixer::pulseaudioPresent()
-{
-  foreach ( Mixer* mixer, Mixer::mixers() )
-  {
-    if ( mixer->getDriverName() == "PulseAudio" )
-      return true;
-  }
-  return false;
-}
-
-
 Mixer::Mixer( QString& ref_driverName, int device )
     : m_balance(0), _mixerBackend(0L), m_dynamic(false)
 {
@@ -346,11 +334,6 @@ QString Mixer::translateKernelToWhatsthis(const QString &kernelName)
 
 /* ------- WRAPPER METHODS. END -------------------------------- */
 
-void Mixer::setBeepOnVolumeChange(bool beepOnVolumeChange)
-{
-       m_beepOnVolumeChange = beepOnVolumeChange;
-}
-
 int Mixer::balance() const {
     return m_balance;
 }
index f4db678..636c8b1 100644 (file)
@@ -116,9 +116,6 @@ public:
     // Returns the name of the driver, e.g. "OSS" or "ALSA0.9"
     static QString driverName(int num);
 
-    static void setBeepOnVolumeChange(bool m_beepOnVolumeChange);
-    static bool getBeepOnVolumeChange() { return m_beepOnVolumeChange; }
-
     /**
      * Returns an unique ID of the Mixer. It currently looks like "<soundcard_descr>::<hw_number>:<driver>"
      */
@@ -170,7 +167,6 @@ public:
     virtual bool isDynamic();
 
     static bool dynamicBackendsPresent();
-    static bool pulseaudioPresent();
 
     virtual bool moveStream( const QString id, const QString& destId );
 
@@ -206,8 +202,6 @@ private:
 
     bool m_dynamic;
 
-    static bool m_beepOnVolumeChange;
-
 };
 
 #endif
index 76e36ca..c40e822 100644 (file)
@@ -148,7 +148,7 @@ void MixerToolBox::initMixerInternal(MultiDriverMode multiDriverMode, QList<QStr
       }
       
 
-      bool regularBackend =  driverName != "MPRIS2"  && driverName != "PulseAudio";
+      bool regularBackend =  driverName != "MPRIS2";
       if (regularBackend && regularBackendFound)
       {
          // Only accept one regular backend => skip this one
@@ -190,12 +190,6 @@ void MixerToolBox::initMixerInternal(MultiDriverMode multiDriverMode, QList<QStr
                                 {
                                         backendMprisFound = true;
                                 }
-                                else if ( driverName == "PulseAudio" )
-                                {
-                                        // PulseAudio is not useful together with MPRIS2. Treat it as "single"
-                                        if ( foundSomethingAndLastControlReached )
-                                                autodetectionFinished = true;
-                                }
                                 else
                                 {
                                         // same check as in SINGLE
index 538ae0b..9eb9526 100644 (file)
@@ -204,7 +204,7 @@ GUIProfile* GUIProfile::find(Mixer* mixer, QString profileName, bool profileName
         return 0;
 
     if ( mixer->isDynamic() ) {
-        kDebug(67100) << "GUIProfile::find() Not loading GUIProfile for Dynamic Mixer (e.g. PulseAudio)";
+        kDebug(67100) << "GUIProfile::find() Not loading GUIProfile for Dynamic Mixer";
         return 0;
     }
 
index e10d792..ebafe9d 100644 (file)
@@ -126,7 +126,7 @@ void KMixPrefDlg::createStartupTab()
        addWidgetToLayout(m_onLogin, layoutStartupTab, 10, i18n("Restore all volume levels and switches."), "startkdeRestore");
 
        dynamicControlsRestoreWarning = new QLabel(
-               i18n("Dynamic controls from Pulseaudio and MPRIS2 will not be restored."), m_startupTab);
+               i18n("Dynamic controls from MPRIS2 will not be restored."), m_startupTab);
        dynamicControlsRestoreWarning->setEnabled(false);
        addWidgetToLayout(dynamicControlsRestoreWarning, layoutStartupTab, 10, "", "");
 
@@ -188,25 +188,6 @@ void KMixPrefDlg::createGeneralTab()
        layout->setMargin(0);
        layout->setSpacing(KDialog::spacingHint());
 
-       // --- Behavior ---------------------------------------------------------
-       QLabel* label = new QLabel(i18n("Behavior"), m_generalTab);
-       layout->addWidget(label);
-
-       // [CONFIG]
-       m_beepOnVolumeChange = new QCheckBox(i18n("Volume Feedback"), m_generalTab);
-       addWidgetToLayout(m_beepOnVolumeChange, layout, 10, "", "VolumeFeedback");
-
-       volumeFeedbackWarning = new QLabel(i18n("Volume feedback is only available for Pulseaudio."), m_generalTab);
-       volumeFeedbackWarning->setEnabled(false);
-       addWidgetToLayout(volumeFeedbackWarning, layout, 20, "", "");
-
-       // [CONFIG]
-       m_volumeOverdrive = new QCheckBox(i18n("Volume Overdrive"), m_generalTab);
-       addWidgetToLayout(m_volumeOverdrive, layout, 10, i18nc("@info:tooltip", "Raise volume maximum to 150% (PulseAudio only)"), "VolumeOverdrive");
-       volumeOverdriveWarning = new QLabel(i18n("You must restart KMix for this setting to take effect."), m_generalTab);
-       volumeOverdriveWarning->setEnabled(false);
-       addWidgetToLayout(volumeOverdriveWarning, layout, 20, "", "");
-
        // --- Visual ---------------------------------------------------------
        QLabel* label2 = new QLabel(i18n("Visual"), m_generalTab);
        layout->addWidget(label2);
@@ -380,16 +361,6 @@ void KMixPrefDlg::showEvent(QShowEvent * event)
        // As GUI can change, the warning will only been shown on demand
        dynamicControlsRestoreWarning->setVisible(Mixer::dynamicBackendsPresent());
 
-       // Pulseaudio supports volume feedback. Disable the configuaration option for all other backends
-       // and show a warning.
-       bool volumeFeebackAvailable = Mixer::pulseaudioPresent();
-       volumeFeedbackWarning->setVisible(!volumeFeebackAvailable);
-       m_beepOnVolumeChange->setDisabled(!volumeFeebackAvailable);
-
-       bool overdriveAvailable = volumeFeebackAvailable; // "shortcut" for Mixer::pulseaudioPresent() (see above)
-       m_volumeOverdrive->setVisible(overdriveAvailable);
-       volumeOverdriveWarning->setVisible(overdriveAvailable);
-
        QString autostartConfigFilename = KGlobal::dirs()->findResource("autostart", QString("kmix_autostart.desktop"));
        kDebug()
        << "autostartConfigFilename = " << autostartConfigFilename;
index d9e633b..06df490 100644 (file)
@@ -108,10 +108,6 @@ private:
        QCheckBox *m_onLogin;
        QCheckBox *allowAutostart;
        QLabel *allowAutostartWarning;
-       QCheckBox *m_beepOnVolumeChange;
-       QCheckBox *m_volumeOverdrive;
-       QLabel *volumeFeedbackWarning;
-       QLabel *volumeOverdriveWarning;
 
        QBoxLayout *layoutControlsTab;
        DialogChooseBackends* dvc;
index 7fef907..69e32c4 100644 (file)
@@ -258,25 +258,14 @@ bool ViewBase::isDynamic() const
   return false;
 }
 
-bool ViewBase::pulseaudioPresent() const
-{
-  foreach (Mixer* mixer , _mixers )
-  {
-         if ( mixer->getDriverName() == "PulseAudio" )
-                 return true;
-  }
-  return false;
-}
-
-
 void ViewBase::resetMdws()
 {
-      // We need to delete the current MixDeviceWidgets so we can redraw them
-      while (!_mdws.isEmpty())
-             delete _mdws.takeFirst();
+    // We need to delete the current MixDeviceWidgets so we can redraw them
+    while (!_mdws.isEmpty())
+        delete _mdws.takeFirst();
 
-      // _mixSet contains std::shared_ptr instances, so clear() should be enough to prevent mem leak
-      _mixSet.clear(); // Clean up our _mixSet so we can reapply our GUIProfile
+    // _mixSet contains std::shared_ptr instances, so clear() should be enough to prevent mem leak
+    _mixSet.clear(); // Clean up our _mixSet so we can reapply our GUIProfile
 }
 
 
@@ -298,7 +287,6 @@ int ViewBase::visibleControls()
 void ViewBase::configureView()
 {
     Q_ASSERT( !isDynamic() );
-    Q_ASSERT( !pulseaudioPresent() );
     
     DialogViewConfiguration* dvc = new DialogViewConfiguration(0, *this);
     dvc->show();
index 5363129..520ab34 100644 (file)
@@ -101,7 +101,6 @@ public:
     int visibleControls();
     
     bool isDynamic() const;
-    bool pulseaudioPresent() const;
 
     /**
      * Popup stuff
index ca03520..45b4a3a 100644 (file)
@@ -394,8 +394,6 @@ void ViewDockAreaPopup::refreshVolumeLevels()
 
 void ViewDockAreaPopup::configureView()
 {
-//    Q_ASSERT( !pulseaudioPresent() );
-
 //    QSet<QString> currentlyActiveMixersInDockArea;
 //     foreach ( Mixer* mixer, _mixers )
 //     {
index f0eb129..ce3be04 100644 (file)
@@ -330,7 +330,6 @@ void ViewSliders::_setMixSet()
 
 void ViewSliders::constructionFinished() {
     configurationUpdate();
-    //if ( !pulseaudioPresent() ) // TODO 11 Dynamic view configuration
     if ( !isDynamic() )
     {
                _configureViewButton = createConfigureViewButton();
index 136bdf4..08d884f 100644 (file)
@@ -22,23 +22,17 @@ add_executable(profiletest ${profiletest_SRCS}
     ${CMAKE_CURRENT_SOURCE_DIR}/../core/mixset.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/../core/kmixdevicemanager.cpp 
     ${kmix_adaptor_SRCS}
-    )
+)
 
-target_link_libraries(profiletest  ${KDE4_KDECORE_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} )
+target_link_libraries(profiletest ${KDE4_KDECORE_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
 
 if (ALSA_FOUND)
     target_link_libraries(profiletest ${ALSA_LIBRARIES})
 endif (ALSA_FOUND)
 
-if (PULSEAUDIO_FOUND)
-    target_link_libraries(profiletest ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY} ${GLIB2_LIBRARIES})
-endif (PULSEAUDIO_FOUND)
-
 ########### next target ###############
-set(dialogtest_SRCS dialogtest.cpp )
+set(dialogtest_SRCS dialogtest.cpp)
 
-add_executable( dialogtest ${dialogtest_SRCS} )
+add_executable(dialogtest ${dialogtest_SRCS})
     
-target_link_libraries(dialogtest  ${KDE4_KDEUI_LIBS} )
-
-
+target_link_libraries(dialogtest ${KDE4_KDEUI_LIBS})