[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    [PATCH] fix kaiman volume decrease
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2000-09-30 18:35:36
[Download RAW message or body]

Hi!

I honestly don't know what the purpose of these lines is:

    _volumeControl = Arts::StereoVolumeControl::null();
    _soundServer = Arts::SimpleSoundServer::null();

especially not in the stop() of kaiman. However, what they do is lead to
ever decreasing volume.

Why? You play a song. A volume control effect gets created and inserted in
initArts(). You stop it. The soundserer and volumecontrol effect get assigned
to null(). (WHY THIS?). Note that this doesn't actually kill the volume
control effect, as this still lives happily in the effect stack.

When you push play again, then kaiman sees: ah, got no soundserver. And goes
creating yet another volume control effect. And so on. Of course, if you do
turn up the volume to the maximum this doesn't impact you (like audio signal
* 1 * 1 * 1 * 1 = audio signal), but if you don't the overall volume steadily
decreases.

The patch also happens to do other stuff like setting default fragment size
to -F 5 -S 8192 (which is the kcontrol default, also), and replacing the
monolithic sleep(5) with segmented sleeps. Please anybody, review, commit.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         

["kaiman.cpp.diff" (text/plain)]

Index: kaiman.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/kaiman/kaiman.cpp,v
retrieving revision 1.46
diff -u -u -r1.46 kaiman.cpp
--- kaiman.cpp	2000/09/24 01:48:35	1.46
+++ kaiman.cpp	2000/09/30 18:27:52
@@ -152,7 +152,9 @@
     // remove effect from effect chain
     if ( !_soundServer.isNull() && !_soundServer.error() &&
          !_volumeControl.isNull() && !_volumeControl.error() )
+	{
         _soundServer.outstack().remove( _volumeEffectID );
+	}
 
     // destroy aRts objects
     _playObject = Arts::PlayObject::null();
@@ -204,7 +206,7 @@
               cmdline += \
QFile::encodeName(KStandardDirs::findExe(QString::fromLatin1("artsd")));  
             cmdline += " ";
-            cmdline += config->readEntry("Arguments", "-F 7 -S 8192").utf8();
+            cmdline += config->readEntry("Arguments", "-F 5 -S 8192").utf8();
 
             int status=system(cmdline);
 
@@ -214,9 +216,13 @@
                 // make artsd fork-and-exit after starting to listen to connections
                 // (and running artsd directly instead of using kdeinit),
                 // but this is better than nothing.
-                sleep(5);
-                _soundServer = Reference("global:Arts_SimpleSoundServer");
-                _playObjectFactory = \
Arts::Reference("global:Arts_PlayObjectFactory"); +		int time = 0;
+		do
+		{
+               	    sleep(1);
+               	    _soundServer = Reference("global:Arts_SimpleSoundServer");
+               	    _playObjectFactory = \
Arts::Reference("global:Arts_PlayObjectFactory"); +		} while(++time < 5 && \
(_soundServer.isNull() || _playObjectFactory.isNull()));  }
 
             if( _playObjectFactory.isNull() )
@@ -438,8 +444,6 @@
     }
 
     _playObject = Arts::PlayObject::null();
-    _volumeControl = Arts::StereoVolumeControl::null();
-    _soundServer = Arts::SimpleSoundServer::null();
     _lastPolledState = Arts::posIdle;
 
     _mediaManager->reset();
@@ -546,7 +550,9 @@
     _volume = vol;
 
     if ( !_volumeControl.isNull() )
+	{
         _volumeControl.scaleFactor(vol/100.0);
+	}
 
     KaimanStyleSlider* l_elem_volslider = \
                static_cast<KaimanStyleSlider*>(_style->find("Volume_Slider"));
     KaimanStyleValue* l_elem_volitem = \
static_cast<KaimanStyleValue*>(_style->find("Volume_Item"));


_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic