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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/engine/phonon
From:       Maximilian Kossick <maximilian.kossick () googlemail ! com>
Date:       2007-12-01 17:58:57
Message-ID: 1196531937.922521.19906.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 743703 by mkossick:

initial code for supporting fadeout in the phonon engine.
currently disabled because it triggers a crash in phonon


 M  +5 -4      CMakeLists.txt  
 M  +22 -7     phonon-engine.cpp  
 M  +6 -1      phonon-engine.h  


--- trunk/extragear/multimedia/amarok/src/engine/phonon/CMakeLists.txt #743702:743703
@@ -1,8 +1,9 @@
 
-include_directories( ../..
-	../../plugin
-	../../amarokcore
-	../.. ${KDE4_INCLUDE_DIR}
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../..
+     ${CMAKE_CURRENT_SOURCE_DIR}/../../plugin
+     ${CMAKE_CURRENT_SOURCE_DIR}/../../amarokcore
+     ${CMAKE_CURRENT_BINARY_DIR}/../..
+     ${KDE4_INCLUDE_DIR}
      ${QT_INCLUDES} )
 
 
--- trunk/extragear/multimedia/amarok/src/engine/phonon/phonon-engine.cpp #743702:743703
@@ -14,6 +14,8 @@
 
 #include "phonon-engine.h"
 //these files are from libamarok
+#include "amarok.h"
+#include "amarokconfig.h"
 #include "enginecontroller.h"
 #include "meta/MetaConstants.h"
 
@@ -28,6 +30,7 @@
 #include <phonon/path.h>
 #include <phonon/audiooutput.h>
 #include <phonon/backendcapabilities.h>
+#include <Phonon/VolumeFaderEffect>
 
 #include <QHash>
 
@@ -36,6 +39,7 @@
         : EngineBase()
         , m_mediaObject( 0 )
         , m_audioOutput( 0 )
+        , m_fader( 0 )
 {
     debug() << "Yay for Phonon being constructed";
 }
@@ -57,7 +61,7 @@
 
     m_mediaObject->setTickInterval( 100 ); // Needed for position() to work
 
-    Phonon::createPath(m_mediaObject, m_audioOutput);
+    m_path = Phonon::createPath(m_mediaObject, m_audioOutput);
 
     connect( m_mediaObject, SIGNAL( finished() ), SIGNAL( trackEnded() ) );
     //connect( m_mediaObject, SIGNAL( length(qint64)), SLOT( length() ) );
@@ -83,6 +87,7 @@
     Q_UNUSED( offset );
     DEBUG_BLOCK
 
+    delete m_fader;
     m_mediaObject->play();
     emit stateChanged( Engine::Playing );
 
@@ -116,6 +121,22 @@
     emit stateChanged( Engine::Playing );
 }
 
+void
+PhononEngine::beginFadeOut()
+{
+    if( m_fader )
+    {
+        return;
+    }
+    //this code causes a crash in phonon code in insertEffect
+    //i haven't had time to ask the phonon guys about it yet
+    //but the code *seems* to be right - max
+    /*m_fader = new Phonon::VolumeFaderEffect( this );
+    m_path.insertEffect( m_fader );
+    m_fader->setFadeCurve( Phonon::VolumeFaderEffect::Fade9Decibel );
+    m_fader->fadeOut( AmarokConfig::fadeoutLength() );*/
+}
+
 Engine::State
 PhononEngine::convertState( Phonon::State s ) const
 {
@@ -168,19 +189,13 @@
 uint
 PhononEngine::length() const
 {
-    DEBUG_BLOCK
-
     const uint t = ( m_mediaObject->totalTime() == -1 ) ? 0 : m_mediaObject->totalTime();
-    debug() << "Length: " << t;
-
     return t;
 }
 
 void
 PhononEngine::seek( uint ms )
 {
-    DEBUG_BLOCK
-    
     m_mediaObject->seek( ms );
 }
 
--- trunk/extragear/multimedia/amarok/src/engine/phonon/phonon-engine.h #743702:743703
@@ -16,11 +16,12 @@
 #include "enginebase.h"
 
 #include <phonon/phononnamespace.h>
+#include <Phonon/Path>
 
 namespace Phonon {
     class MediaObject;
-    class AudioPath;
     class AudioOutput;
+    class VolumeFaderEffect;
 }
 
 class /*AMAROK_PHONON_ENGINE_EXPORT*/ PhononEngine : public Engine::Base
@@ -36,6 +37,7 @@
     virtual void stop();
     virtual void pause();
     virtual void unpause();
+    virtual void beginFadeOut();
     virtual uint position() const;
     virtual uint length() const;
     virtual void seek( uint );
@@ -50,7 +52,10 @@
 
     Phonon::MediaObject *m_mediaObject;
     Phonon::AudioOutput *m_audioOutput;
+    Phonon::Path        m_path;
 
+    Phonon::VolumeFaderEffect *m_fader;
+
 // private slots:
 //     void configChanged();
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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