javauis/mmapi_akn/baseline/inc/cmmavolumecontrol.h
branchRCL_3
changeset 21 4376525cdefb
parent 14 04becd199f91
child 24 6c158198356e
equal deleted inserted replaced
19:71c436fe3ce0 21:4376525cdefb
    20 #define CMMAVOLUMECONTROL_H
    20 #define CMMAVOLUMECONTROL_H
    21 
    21 
    22 //  INCLUDES
    22 //  INCLUDES
    23 #include "cmmacontrol.h"
    23 #include "cmmacontrol.h"
    24 #include "mmmaplayerstatelistener.h"
    24 #include "mmmaplayerstatelistener.h"
       
    25 #include <mprofilechangeobserver.h>
    25 
    26 
    26 // CONSTANS
    27 // CONSTANS
    27 _LIT(KMMAVolumeControlName, "VolumeControl");
    28 _LIT(KMMAVolumeControlName, "VolumeControl");
    28 const TInt KMMAVolumeMaxLevel = 100;
    29 const TInt KMMAVolumeMaxLevel = 100;
    29 
    30 
    30 class CMMAPlayer;
    31 class CMMAPlayer;
    31 
    32 class CProfileChangeNotifyHandler;
    32 //  CLASS DECLARATION
    33 //  CLASS DECLARATION
    33 /**
    34 /**
    34 *   This class is used for volume setting
    35 *   This class is used for volume setting
    35 *
    36 *
    36 *
    37 *
    37 */
    38 */
    38 
    39 
    39 class CMMAVolumeControl : public CMMAControl,
    40 class CMMAVolumeControl : public CMMAControl,
    40         public MMMAPlayerStateListener
    41         public MMMAPlayerStateListener,
       
    42         public MProfileChangeObserver
    41 {
    43 {
    42 public:
    44 public:
    43     static void StaticSetLevelL(CMMAVolumeControl* aVolumeControl,
    45     static void StaticSetLevelL(CMMAVolumeControl* aVolumeControl,
    44                                 TInt aLevel);
    46                                 TInt aLevel);
    45     static void StaticGetLevelL(CMMAVolumeControl* aVolumeControl,
    47     static void StaticGetLevelL(CMMAVolumeControl* aVolumeControl,
    72     void RefreshControl();
    74     void RefreshControl();
    73 
    75 
    74 public: // From MMMAPlayerStateListener
    76 public: // From MMMAPlayerStateListener
    75     void StateChanged(TInt aState);
    77     void StateChanged(TInt aState);
    76 
    78 
       
    79 public: // from MProfileChangeObserver
       
    80     void HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId );
    77 
    81 
    78 public: // New methods
    82 public: // New methods
    79     /**
    83     /**
    80      * Adds new volume level to volume control. Actual volume level will
    84      * Adds new volume level to volume control. Actual volume level will
    81      * be calculated using all levels added to the control.
    85      * be calculated using all levels added to the control.
    93      */
    97      */
    94     IMPORT_C void SetVolumeLevelL(TInt aLevelIndex,
    98     IMPORT_C void SetVolumeLevelL(TInt aLevelIndex,
    95                                   TInt aVolumeLevel);
    99                                   TInt aVolumeLevel);
    96     void GetVolumeLevelL(TInt aLevelIndex,
   100     void GetVolumeLevelL(TInt aLevelIndex,
    97                          TInt* aVolumeLevel);
   101                          TInt* aVolumeLevel);
    98 
   102     void SetProfilesBasedSoundMutingL();
    99 
   103     /**
       
   104      * Sets the audio o/p preference. Based on this the profile based
       
   105      * volume setting is done.
       
   106      */
       
   107     IMPORT_C void SetAudioOutputPreferenceL( TInt aRoutingPreference);
   100 
   108 
   101 private: // New methods
   109 private: // New methods
   102 
   110 
   103     /**
   111     /**
   104      * Refresh volume level, basically set the volume level again.
   112      * Refresh volume level, basically set the volume level again.
   115     /**
   123     /**
   116      * Calculates new overall level using all values in iLevels array.
   124      * Calculates new overall level using all values in iLevels array.
   117      * @return Current level.
   125      * @return Current level.
   118      */
   126      */
   119     TInt CalculateLevel();
   127     TInt CalculateLevel();
       
   128     
       
   129     void SetJavaSoundVolumeLevelL();
       
   130     
       
   131     void SetProfileSoundVolumeLevelL();
   120 protected: // data
   132 protected: // data
   121     CMMAPlayer* iPlayer;
   133     CMMAPlayer* iPlayer;
   122 
   134 
   123     // Previous level setted to player. Used to check if level is changed.
   135     // Previous level setted to player. Used to check if level is changed.
   124     TInt iLevel;
   136     TInt iLevel;
   125 
   137 
   126     // Array containing all levels.
   138     // Array containing all levels.
   127     RArray< TInt > iLevels;
   139     RArray< TInt > iLevels;
   128 
   140     // profile change notifier 
       
   141     // Owning
       
   142     CProfileChangeNotifyHandler* iProfChangeNotifier;
       
   143     // Current audio o/p preference.
       
   144     TInt iAudioOutputPreference;
       
   145     // Current profile Id.
       
   146     TInt iProfileId;
   129 };
   147 };
   130 
   148 
   131 #endif // CMMAVOLUMECONTROL_H
   149 #endif // CMMAVOLUMECONTROL_H