mpxplugins/serviceplugins/playbackplugins/localaudio/src/mpxlocalaudioplayback.cpp
branchRCL_3
changeset 18 56b11cf8addb
parent 15 a1247965635c
child 19 a12246c97fcc
equal deleted inserted replaced
17:70a8526f03f2 18:56b11cf8addb
   493     TBool isSupported=ETrue;
   493     TBool isSupported=ETrue;
   494     switch(aProperty)
   494     switch(aProperty)
   495         {
   495         {
   496         case EPbPropertyVolume:
   496         case EPbPropertyVolume:
   497             {
   497             {
   498             SetVolume( aValue );
   498             SetVolume( aValue, EFalse ); // don't notify MPX because playback engine converts EPSetComplete to EPropertyChanged
   499             break;
   499             break;
   500             }
   500             }
   501         case EPbPropertyVolumeRamp:
   501         case EPbPropertyVolumeRamp:
   502             iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(TInt64(aValue)));
   502             iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(TInt64(aValue)));
   503             break;
   503             break;
   504         case EPbPropertyMute:
   504         case EPbPropertyMute:
   505             SetMute( aValue );
   505             SetMute( aValue, EFalse ); // don't notify MPX because playback engine converts EPSetComplete to EPropertyChanged
   506             break;
   506             break;
   507         case EPbPropertyBalance:
   507         case EPbPropertyBalance:
   508             iPlayer->SetBalance(MMFBalance(aValue));
   508             iPlayer->SetBalance(MMFBalance(aValue));
   509             break;
   509             break;
   510         case EPbPropertyPosition:
   510         case EPbPropertyPosition:
  1108 
  1108 
  1109 // ----------------------------------------------------------------------------
  1109 // ----------------------------------------------------------------------------
  1110 // Sets the volume level in audio controller
  1110 // Sets the volume level in audio controller
  1111 // ----------------------------------------------------------------------------
  1111 // ----------------------------------------------------------------------------
  1112 //
  1112 //
  1113 void CMPXLocalAudioPlayback::SetVolume( TInt aVolume )
  1113 void CMPXLocalAudioPlayback::SetVolume( TInt aVolume, TBool aNotifyChange )
  1114     {
  1114     {
  1115     MPX_DEBUG3("-->CMPXLocalAudioPlayback::SetVolume 0x%08x vol (%d)", this, aVolume);
  1115     MPX_DEBUG3("-->CMPXLocalAudioPlayback::SetVolume 0x%08x vol (%d)", this, aVolume);
  1116 
  1116 
  1117     // Ensure that level is within min and max values
  1117     // Ensure that level is within min and max values
  1118     if ( aVolume > KPbPlaybackVolumeLevelMax )
  1118     if ( aVolume > KPbPlaybackVolumeLevelMax )
  1160                 {
  1160                 {
  1161                 MPX_TRAP( volError, iMuteWatcher->SetValueL( EFalse ) );
  1161                 MPX_TRAP( volError, iMuteWatcher->SetValueL( EFalse ) );
  1162                 }
  1162                 }
  1163             }
  1163             }
  1164         }
  1164         }
       
  1165     else if ( volError == KErrNone && aVolume == currentVol && changed )
       
  1166         {
       
  1167         // volume changed only to player after it has been initialised, 
       
  1168         // no need to reflect this to upper layers as the stored setting haven't changed
       
  1169         changed = EFalse;
       
  1170         }
  1165 
  1171 
  1166     // Notify observer if value changed
  1172     // Notify observer if value changed
  1167     if ( changed )
  1173     if ( changed && aNotifyChange )
  1168         {
  1174         {
  1169         iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPVolumeChanged,
  1175         iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPVolumeChanged,
  1170                                  aVolume,
  1176                                  aVolume,
  1171                                  KErrNone);
  1177                                  KErrNone);
  1172         }
  1178         }
  1176 
  1182 
  1177 // ----------------------------------------------------------------------------
  1183 // ----------------------------------------------------------------------------
  1178 // Sets the volume level in audio controller
  1184 // Sets the volume level in audio controller
  1179 // ----------------------------------------------------------------------------
  1185 // ----------------------------------------------------------------------------
  1180 //
  1186 //
  1181 void CMPXLocalAudioPlayback::SetMute( TBool aMute )
  1187 void CMPXLocalAudioPlayback::SetMute( TBool aMute, TBool aNotifyChange )
  1182     {
  1188     {
  1183     MPX_DEBUG3("-->CMPXLocalAudioPlayback::SetMute 0x%08x vol (%d)", this, aMute);
  1189     MPX_DEBUG3("-->CMPXLocalAudioPlayback::SetMute 0x%08x vol (%d)", this, aMute);
  1184 
  1190 
  1185     TBool changed( EFalse );
  1191     TBool changed( EFalse );
  1186     // Change MMF Audio player's volume
  1192     // Change MMF Audio player's volume
  1212             }
  1218             }
  1213         else if ( !aMute && currentMute )
  1219         else if ( !aMute && currentMute )
  1214             {
  1220             {
  1215             MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
  1221             MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
  1216             }
  1222             }
       
  1223         else if ( changed ) // Cenrep setting hasn't changed, no need to propagate to MPX
       
  1224             {
       
  1225             changed = EFalse;
       
  1226             }
  1217         }
  1227         }
  1218 
  1228 
  1219     // Notify observer if value changed
  1229     // Notify observer if value changed
  1220     if ( changed )
  1230     if ( changed  && aNotifyChange )
  1221         {
  1231         {
  1222         iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
  1232         iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
  1223                                  aMute,
  1233                                  aMute,
  1224                                  KErrNone);
  1234                                  KErrNone);
  1225         }
  1235         }