mpserviceplugins/localaudio/src/mpxlocalaudioplayback.cpp
changeset 32 c163ef0b758d
parent 29 8192e5b5c935
--- a/mpserviceplugins/localaudio/src/mpxlocalaudioplayback.cpp	Thu May 27 12:49:57 2010 +0300
+++ b/mpserviceplugins/localaudio/src/mpxlocalaudioplayback.cpp	Fri Jun 11 13:36:36 2010 +0300
@@ -433,14 +433,19 @@
             {
             // Re-init audio effects
             MPX_DEBUG1("CMPXLocalAudioPlayback::CommandL EPbApplyEffect");
-            iAudioEffects->DestroyAudioEffect();
             if( ( aData == KAudioEffectsID || aData == KEqualizerID ) &&
                 ( EStateInitialised == iState ) )
                 {
+                // Here we rely on CreateAudioEffectsL() to be safe to be called 
+                // in order to just set values again     
                 TRAPD(err, iAudioEffects->CreateAudioEffectsL() );
                 if(err)
                     {
                     MPX_DEBUG2("EPbApplyEffect err = %d", err);
+                    // Sometimes we get KErrAccessDenied, then destroying effects
+                    // and setting them again should help. This is a work-around, 
+                    // and would be good to be fixed more properly.   
+                    iAudioEffects->DestroyAudioEffect(); 
                     TRAPD(err, iAudioEffects->CreateAudioEffectsL() );
                     if(err)
                         {