Bug 69220 - kmix icon should reflect volume
Summary: kmix icon should reflect volume
Status: RESOLVED FIXED
Alias: None
Product: kmix
Classification: Applications
Component: Obsolete component. Do NOT use!!! (ex: KMix Panel Applet). (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: HI wishlist
Target Milestone: ---
Assignee: Christian Esken
URL:
Keywords:
: 127860 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-28 16:26 UTC by Moritz Moeller-Herrmann
Modified: 2006-12-22 21:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
three states of the gnome mixer icon (2.61 KB, image/png)
2003-11-28 16:31 UTC, Moritz Moeller-Herrmann
Details
Volume graphical feedback in gnome (25.18 KB, image/png)
2006-09-23 17:58 UTC, Manuel López-Ibáñez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Moeller-Herrmann 2003-11-28 16:26:03 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

I just played around with GNOME-2.4 and in general I do not like it. Their mixer panel applet has a nice feature though: I reflects the volume setting by changing the icon. The higher the volume the more sound waves are shown. I have attached a screenshot.

This is a nice way to show the volume and it would not need much space. Maybe we could copy this feature?
Comment 1 Moritz Moeller-Herrmann 2003-11-28 16:31:43 UTC
Created attachment 3460 [details]
three states of the gnome mixer icon

See how the volume is shown by number of sound waves.
Comment 2 Christian Esken 2004-06-20 19:04:43 UTC
Nice idea. I think I will implement it after KDE3.3.
Comment 3 Christian Esken 2005-12-29 20:05:59 UTC
Feature is tarageted for KDE4.
Comment 4 Christian Esken 2006-05-23 09:33:49 UTC
*** Bug 127860 has been marked as a duplicate of this bug. ***
Comment 5 Manuel López-Ibáñez 2006-09-23 17:38:30 UTC
Actually, it is much better than that. Get a recent GNOME and set the keyboard shortcuts for volume-up and volume-down. Then, use the keyboard shortcuts to change the volume and see what happens. That is really nice!
Comment 6 Manuel López-Ibáñez 2006-09-23 17:58:08 UTC
Created attachment 17889 [details]
Volume graphical feedback in gnome

This is from an old gnome. Recent versions look much better. I cannot get a
more recent screenshot since I don't have gnome in any near computer.
Comment 7 Christian Esken 2006-11-22 22:39:11 UTC
SVN commit 607044 by esken:

Make ALSA polling work again.
Clean up the master-device code.
KMix icon reflects volume change now (KDE4).
CCBUGS: 69220


 M  +1 -0      CMakeLists.txt  
 M  +9 -0      TODO  
 M  +1 -2      kmix.cpp  
 M  +3 -4      kmixdockwidget.cpp  
 M  +15 -19    mixer.cpp  
 M  +3 -4      mixer.h  
 M  +2 -3      mixer_alsa9.cpp  
 M  +0 -1      mixer_backend.cpp  


--- trunk/KDE/kdemultimedia/kmix/CMakeLists.txt #607043:607044
@@ -93,6 +93,7 @@
 ########### next target ###############
 
 set(kmixd_KMIXD_SRCS
+   kmixd.cpp
    kmixdevicemanager.cpp )
 
 kde4_automoc(${kmixd_KMIXD_SRCS})
--- trunk/KDE/kdemultimedia/kmix/TODO #607043:607044
@@ -20,6 +20,15 @@
 5) Move balance slider out of bottom and make it a virtual control.
 Status: Pending
 
+6) Change everything in the source code to a consistent terminology:
+   The piece of hardware is now called:                  Card
+   The devices/slider/controllable-thingy is now called: Control
+Status: pending
+
+7) Several bug reports, including the Audigy stuff.
+Status: Always pending, but ongoing
+
+
 ------------------------------------------------------------------------------------
 
 Bug2 in KMix2.1pre:
--- trunk/KDE/kdemultimedia/kmix/kmix.cpp #607043:607044
@@ -266,9 +266,8 @@
    m_gridView    = config->readEntry("Experimental-ViewGrid", false );
    const QString& orientationString = config->readEntry("Orientation", "Horizontal");
    QString mixerMasterCard = config->readEntry( "MasterMixer", "" );
-   Mixer::setMasterCard(mixerMasterCard);
    QString masterDev = config->readEntry( "MasterMixerDevice", "" );
-   Mixer::setMasterCardDevice(masterDev);
+   Mixer::setGlobalMaster(mixerMasterCard, masterDev);
 
 
    if ( orientationString == "Vertical" )
--- trunk/KDE/kdemultimedia/kmix/kmixdockwidget.cpp #607043:607044
@@ -154,17 +154,16 @@
 }
 
 
-void KMixDockWidget::handleNewMaster(int soundcard_id, QString& channel_id)
+void KMixDockWidget::handleNewMaster(int soundcard_id, QString& control_id)
 {
-  //kDebug(67100) << "KMixDockWidget::handleNewMaster() soundcard_id=" << soundcard_id << " , channel_id=" << channel_id << endl;
+  //kDebug(67100) << "KMixDockWidget::handleNewMaster() soundcard_id=" << soundcard_id << " , control_id=" << control_id << endl;
   Mixer *mixer = Mixer::mixers().at(soundcard_id);
   if ( mixer == 0 ) {
     kError(67100) << "KMixDockWidget::createPage(): Invalid Mixer (soundcard_id=" << soundcard_id << ")" << endl;
     return; // can not happen
   }
   m_mixer = mixer;
-  Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere".
-  Mixer::setMasterCardDevice( channel_id );
+  Mixer::setGlobalMaster(mixer->id(), control_id); // We must save this information "somewhere".
   createMasterVolWidget();
 }
 
--- trunk/KDE/kdemultimedia/kmix/mixer.cpp #607043:607044
@@ -151,16 +151,17 @@
  *
  * @return 0, if OK. An Mixer::ERR_ error code otherwise
  */
-int Mixer::open()
-{
-      int err = _mixerBackend->open();
+bool Mixer::openIfValid() {
+   bool ok = _mixerBackend->openIfValid();
+   if ( ok ) {
       // A better ID is now calculated in mixertoolbox.cpp, and set via setID(),
-      // but we want a somhow usable fallback just in case.
+      // but we want a somehow usable fallback just in case.
       _id = baseName();
 
       MixDevice* recommendedMaster = _mixerBackend->recommendedMaster();
       if ( recommendedMaster != 0 ) {
          setMasterDevice(recommendedMaster->id() );
+         kDebug() << "Mixer::open() detected master: " << recommendedMaster->id() << endl;
       }
       else {
          kError(67100) << "Mixer::open() no master detected." << endl;
@@ -176,8 +177,9 @@
            // poll once to give the GUI a chance to rebuild it's info
            QTimer::singleShot( 50, this, SLOT( readSetFromHW() ) );
        }
+   } // cold be opened
 
-      return err;
+   return ok;
 }
 
 
@@ -212,9 +214,6 @@
   return _mixerBackend->m_mixDevices;
 }
 
-bool Mixer::openIfValid() {
-  return _mixerBackend->openIfValid();
-}
 
 /**
  * Returns the driver name, that handles this Mixer.
@@ -350,13 +349,15 @@
   return _id;
 }
 
-void Mixer::setMasterCard(QString& ref_id)
+void Mixer::setGlobalMaster(QString& ref_card, QString& ref_control)
 {
   // The value is taken over without checking on existence. This allows the User to define
   // a MasterCard that is not always available (e.g. it is an USB hotplugging device).
   // Also you can set the master at any time you like, e.g. after reading the KMix configuration file
   // and before actually constructing the Mixer instances (hint: this mehtod is static!).
-  _masterCard = ref_id;
+  _masterCard       = ref_card;
+  _masterCardDevice = ref_control;
+  kDebug() << "Mixer::setGlobalMaster() card=" <<ref_card<< " control=" << ref_control << endl;
 }
 
 Mixer* Mixer::masterCard()
@@ -366,21 +367,14 @@
   {
      mixer = Mixer::mixers()[i];
      if ( mixer != 0 && mixer->id() == _masterCard ) {
+        kDebug() << "Mixer::masterCard() found " << _masterCard << endl;
         break;
      }
   }
+  kDebug() << "Mixer::masterCard() returns " << mixer << endl;
   return mixer;
 }
 
-void Mixer::setMasterCardDevice(QString& ref_id)
-{
-  // The value is taken over without checking on existence. This allows the User to define
-  // a MasterCard that is not always available (e.g. it is an USB hotplugging device).
-  // Also you can set the master at any time you like, e.g. after reading the KMix configuration file
-  // and before actually constructing the Mixer instances (hint: this mehtod is static!).
-  _masterCardDevice = ref_id;
-}
-
 MixDevice* Mixer::masterCardDevice()
 {
   MixDevice* md = 0;
@@ -390,9 +384,11 @@
    {
        md = mixer->_mixerBackend->m_mixDevices[i];
        if ( md->id() == _masterCardDevice )
+          kDebug() << "Mixer::masterCardDevice() found " << _masterCardDevice << endl;
           break;
      }
   }
+  kDebug() << "Mixer::masterCardDevice() returns " << md << endl;
   return md;
 }
 
--- trunk/KDE/kdemultimedia/kmix/mixer.h #607043:607044
@@ -61,7 +61,6 @@
        /// Tells the number of the mixing devices
       unsigned int size() const;
 
-      bool openIfValid();
 
       /// Returns a pointer to the mix device with the given number
       MixDevice* operator[](int val_i_num);
@@ -72,7 +71,8 @@
       MixDevice *getMixdeviceById( const QString& deviceID );
 
       /// Open/grab the mixer for further intraction
-      virtual int open();
+      bool openIfValid();
+
       /// Close/release the mixer
       virtual int close();
 
@@ -100,10 +100,9 @@
       /// The KMix global master card. Please note that KMix and KMixPanelApplet can have a
       /// different MasterCard's at the moment (but actually KMixPanelApplet does not read/save this yet).
       /// At the moment it is only used for selecting the Mixer to use in KMix's DockIcon.
-      static void setMasterCard(QString& ref_id);
+      static void setGlobalMaster(QString& ref_card, QString& ref_control);
       static Mixer* masterCard();
       /// The global Master Device inside the current MasterCard (as returned by masterCard()).
-      static void setMasterCardDevice(QString& ref_id);
       static MixDevice* masterCardDevice();
 
 
--- trunk/KDE/kdemultimedia/kmix/mixer_alsa9.cpp #607043:607044
@@ -487,12 +487,12 @@
 }
 
 int Mixer_ALSA::id2num(const QString& id) {
-   kDebug(67100) << "id2num() id=" << id << endl;
+   //kDebug(67100) << "id2num() id=" << id << endl;
    int num = -1;
    if ( m_id2numHash.contains(id) ) {
       num = m_id2numHash[id];
    }
-   kDebug(67100) << "id2num() num=" << num << endl;
+   //kDebug(67100) << "id2num() num=" << num << endl;
    return num;
 }
 
@@ -701,7 +701,6 @@
 	int elem_sw;
 	long left, right;
 
-#warning Must translate from id to mixerIdx here
 	snd_mixer_elem_t *elem = getMixerElem( devnum );
 	if ( !elem )
 	{
--- trunk/KDE/kdemultimedia/kmix/mixer_backend.cpp #607043:607044
@@ -109,7 +109,6 @@
 
 int Mixer_Backend::id2num(const QString& id)
 {
-#warning This is wrong for the ALSA backend
    return id.toInt();
 }
 
Comment 8 Christian Esken 2006-12-22 21:04:35 UTC
Done for KDE4