Bug 104882

Summary: Pre-amp in equalizer doesn't work with the XINE engine
Product: [Applications] amarok Reporter: Adeodato Simó <dato>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.2.3   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Adeodato Simó 2005-05-01 03:57:03 UTC
Debian Bug #283750 (http://bugs.debian.org/283750), reported by Diwaker Gupta 
<dgupta@cs.ucsd.edu>: 
 
---------------------------8<---------------------------------------------- 
When using the Xine engine, the preamp control in the equalizer doesn't 
seem to have any affect. It works fine with gstreamer. 
---------------------------8<----------------------------------------------
Comment 1 Mark Kretschmann 2005-07-04 19:23:26 UTC
SVN commit 431546 by markey:

xine-engine: pre-amp for the equalizer works now.

BUG: 104882



 M  +2 -1      ChangeLog  
 M  +7 -3      src/engine/xine/xine-engine.cpp  
 M  +1 -0      src/engine/xine/xine-engine.h  


--- trunk/extragear/multimedia/amarok/ChangeLog #431545:431546
@@ -7,7 +7,7 @@
   FEATURES:
     * "Open in External Browser" button for Lyrics Tab, patch from Nick
       Tryon (Dhraakellian) <dhraak@gmail.com>
-    * Funky shadow effect for the album cover @ Context-Browser and OSD. 
+    * Funky shadow effect for the album cover @ Context-Browser and OSD.
       (BR 108334)
     * Create playlists by dragging tracks onto the Playlist Category in the
       PlaylistBrowser. (BR 75029)
@@ -19,6 +19,7 @@
     * Systray tooltip now shows "elapsed time / total time" for the length.
 
   BUGFIXES:
+    * xine-engine: pre-amp for the equalizer works now. (BR 104882)
     * Crash when changing the number of minimum upcoming tracks right after
       starting amaroK (BR 108251)
 
--- trunk/extragear/multimedia/amarok/src/engine/xine/xine-engine.cpp #431545:431546
@@ -56,6 +56,7 @@
         , m_audioPort( 0 )
         , m_eventQueue( 0 )
         , m_post( 0 )
+        , m_preamp( 1.0 )
 {
     addPluginProperty( "StreamingMode", "NoStreaming" );
     addPluginProperty( "HasConfigure", "true" );
@@ -350,7 +351,7 @@
 void
 XineEngine::setVolumeSW( uint vol )
 {
-    xine_set_param( m_stream, XINE_PARAM_AUDIO_AMP_LEVEL, vol );
+    xine_set_param( m_stream, XINE_PARAM_AUDIO_AMP_LEVEL, static_cast<uint>( vol * m_preamp ) );
 }
 
 void
@@ -360,12 +361,12 @@
       QValueList<int> gains;
       for( uint x = 0; x < 10; x++ )
          gains += 0;
-      setEqualizerParameters( 0, gains );
+      setEqualizerParameters( -100, gains );
    }
 }
 
 void
-XineEngine::setEqualizerParameters( int /*preamp*/, const QValueList<int> &gains )
+XineEngine::setEqualizerParameters( int preamp, const QValueList<int> &gains )
 {
    QValueList<int>::ConstIterator it = gains.begin();
 
@@ -379,6 +380,9 @@
    xine_set_param( m_stream, XINE_PARAM_EQ_4000HZ, *++it );
    xine_set_param( m_stream, XINE_PARAM_EQ_8000HZ, *++it );
    xine_set_param( m_stream, XINE_PARAM_EQ_16000HZ, *++it );
+
+   m_preamp = ( preamp / 2 + 150 ) / 100.0;
+   setVolume( m_volume );
 }
 
 bool
--- trunk/extragear/multimedia/amarok/src/engine/xine/xine-engine.h #431545:431546
@@ -61,6 +61,7 @@
     xine_post_t        *m_post;
 
     int64_t             m_currentVpts;
+    float               m_preamp;
 
 public:
     XineEngine();