profilesservices/FileList/Src/CFLDPlayerBase.h
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     CFLDPlayerBase is used to play sound files. It takes into account
       
    16 *     the current volume and ringing type settings.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef __CFLDPLAYERBASE_H__
       
    23 #define __CFLDPLAYERBASE_H__
       
    24 
       
    25 // INTERNAL INCLUDES
       
    26 #include "MFLDFileProcessor.h"
       
    27 
       
    28 // EXTERNAL INCLUDES
       
    29 #include <e32def.h>
       
    30 #include <coemain.h>
       
    31 #include <apgcli.h>
       
    32 #include <cenrepnotifyhandler.h>
       
    33 
       
    34 //	FORWARD DECLARATIONS
       
    35 class C3DRingingToneInterface;
       
    36 
       
    37 //  CONSTANTS
       
    38 const TInt KFLDMinVolumeLevel( 1 );
       
    39 
       
    40 //  CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * CFLDPlayerBase is used to play sound files. It takes into account the current
       
    44 * volume and ringing type settings.
       
    45 *
       
    46 * @lib filelist.lib
       
    47 * @since 2.1
       
    48 */
       
    49 NONSHARABLE_CLASS( CFLDPlayerBase )
       
    50     : public CBase,
       
    51       public MFLDFileProcessor,
       
    52 	  public MCenRepNotifyHandlerCallback,
       
    53       public MCoeForegroundObserver
       
    54     {
       
    55     protected:     // Destructor
       
    56 
       
    57         /**
       
    58          * Destructor
       
    59          */
       
    60         virtual ~CFLDPlayerBase();
       
    61 
       
    62     protected:    // Constructors
       
    63 
       
    64         /**
       
    65          * C++ constructor
       
    66          * @param aShowErrorMsgs Show an error note if the file format is not supported
       
    67          */
       
    68         CFLDPlayerBase( TBool aShowErrorMsgs );
       
    69 
       
    70         /**
       
    71          * Second phase constructor
       
    72          */
       
    73         void BaseConstructL();
       
    74 
       
    75     public:		// From MFLDFileProcessor
       
    76 
       
    77         /**
       
    78         * Set the volume level on which the sound is played
       
    79         * If this method is not called, player uses the setting in active profile.
       
    80         * @param aVolume The volume level
       
    81         */
       
    82         void SetVolume( TInt aVolume );
       
    83 
       
    84         /**
       
    85         * Sets the ringing type
       
    86         * If this method is not called, player uses the setting in active profile.
       
    87         * @param aRingingType The ringing type (see enum TRingingTypes)
       
    88         */
       
    89         void SetRingingType( TInt aRingingType );
       
    90 
       
    91         /**
       
    92         * Sets vibrating alert on or off.
       
    93         * If this method is not called, player uses the setting in active profile.
       
    94         * @param aVibra True: Vibra is on. False: Vibra is off.
       
    95         */
       
    96         void SetVibra( TBool aVibra );
       
    97         
       
    98         /**
       
    99         * Sets 3d-effects on or off.
       
   100         * If this method is called using parameter EFalse 3d-effects are 
       
   101         * always disabled even though those are set in active profile.
       
   102         * Otherwise toneplayer uses the setting in active profile.
       
   103         * @param a3dEffects True: 3dEffects are on. False: 3dEffects are off.
       
   104         */
       
   105         void Set3dEffects( TBool a3dEffects );
       
   106 
       
   107     protected:    // New methods
       
   108 
       
   109         /** See if a call is ongoing.
       
   110         * @return ETrue if a call is ongoing, EFalse otherwise.
       
   111         */
       
   112         TBool IsCallOngoing() const;
       
   113 
       
   114         /**
       
   115          * Helper method to adapt the Profiles volume to player volume.
       
   116          * @param aVolume the volume value to be converted.
       
   117          * @param aMaxVolume maximum volume level of the player used.
       
   118          * @return the converted volume.
       
   119          */
       
   120         TInt BaseConvertVolume( TInt aVolume, TInt aMaxVolume );
       
   121 
       
   122         /**
       
   123         * Show note "Tone format not supported"
       
   124         */
       
   125         void DisplayErrorNoteL();
       
   126 
       
   127         /**
       
   128          * Gets the data type of the given file.
       
   129          * @param aFileName path to the file which data type must be found out
       
   130          * @param aDataType value return parameter to hold the data type
       
   131          * @return system-wide error code
       
   132          */
       
   133         TInt DataType( const TDesC& aFileName, TDataType& aDataType );
       
   134 
       
   135 	private: 	// Methods derived from MCenRepNotifyHandlerCallback
       
   136         void HandleNotifyInt(TUint32 aId, TInt aNewValue);
       
   137 
       
   138     private:    // Methods derived from MCoeForegroundObserver
       
   139 
       
   140         /**
       
   141         * Derived from MCoeForegroundObserver. Called when application gains foreground.
       
   142         */
       
   143         void HandleGainingForeground();
       
   144 
       
   145         /**
       
   146         * Derived from MCoeForegroundObserver. Stops playing the file if
       
   147         * this application loses focus.
       
   148         */
       
   149         void HandleLosingForeground();
       
   150 
       
   151     protected:    // Data
       
   152 
       
   153 		/// Ringingvolume
       
   154         TInt iRingingVolume;
       
   155 		/// Ringingtype
       
   156         TInt iRingingType;
       
   157 		/// Vibrasetting (on/off)
       
   158         TBool iVibra;
       
   159 		/// Own: pointer to error message
       
   160         HBufC* iErrorMessage;
       
   161         /// Prevent tone playing, if application has lost focus
       
   162         TBool iFocusLost;
       
   163         /// Default tone
       
   164         TFileName iDefaultTone;
       
   165         // Ringingtone Plugin (should be created/deleted by subclass)
       
   166 		C3DRingingToneInterface* i3dRingingTonePlugin;
       
   167 		/// 3DSettings (on/off)		
       
   168 		TBool i3dEffects;
       
   169 
       
   170     private:    // Data
       
   171 
       
   172 		/// Own: Pointer to volumenotifyhandler
       
   173 		CCenRepNotifyHandler* iVolumeNotifyHandler;
       
   174 		/// Own: Pointer to typenotifyhandler
       
   175 		CCenRepNotifyHandler* iTypeNotifyHandler;
       
   176 		/// Own: Pointer to vibranotifyhandler
       
   177 		CCenRepNotifyHandler* iVibraNotifyHandler;
       
   178 		/// Own: Pointer to CR session
       
   179         CRepository* iSession;
       
   180 		/// Own: Pointer to CR vibra session
       
   181         CRepository* iVibraSession;
       
   182         /// Show an error, if the file format is not supported
       
   183         TBool iShowErrorMsgs;
       
   184 		// Find out tone MIME -type
       
   185         RApaLsSession iApaSession;
       
   186 
       
   187     };
       
   188 
       
   189 #endif      //  __CFLDPLAYERBASE_H__
       
   190 
       
   191 // End of File
       
   192