messagingappbase/ncnlist/inc/NcnHandlerAudio.h
changeset 0 72b543305e3a
child 16 fa7d37e3fdf4
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004 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 *       This class contains all audio the handling for NcnList
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef NCNHANDLERAUDIO_H
       
    23 #define NCNHANDLERAUDIO_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <mdaaudiosampleplayer.h>   // For playing the alert tone
       
    27 #include <AudioPreference.h>
       
    28 
       
    29 #include    <MProfile.h>
       
    30 #include    <MProfileEngine.h>
       
    31 #include    <MProfileTones.h>
       
    32 #include    <MProfileExtraTones.h>
       
    33 #include    <TProfileToneSettings.h>
       
    34 
       
    35 // CONSTANTS
       
    36 // MACROS
       
    37 // DATA TYPES
       
    38 // FUNCTION PROTOTYPES
       
    39 // FORWARD DECLARATIONS
       
    40 class CNcnModelBase;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  This class contains all the audio handling in NcnList
       
    46 */
       
    47 class CNcnHandlerAudio : public CBase, 
       
    48                          public MMdaAudioPlayerCallback
       
    49     {
       
    50     public:  // Constructors and destructor
       
    51         
       
    52         /**
       
    53         * Two-phased constructor.
       
    54         */
       
    55         static CNcnHandlerAudio* NewL( CNcnModelBase* aModel );
       
    56         
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         virtual ~CNcnHandlerAudio();
       
    61 
       
    62     public: // New functions
       
    63         
       
    64         /**
       
    65         * Start playing the tone
       
    66         * @since    Series60 2.1
       
    67         * @param    aMessageType   Type of received message
       
    68         * @return   KErrNone or error number
       
    69         */
       
    70         TInt PlayAlertToneL( const TUint& aMessageType ); 
       
    71 
       
    72         /**
       
    73         * From MMdaAudioPlayerCallback 
       
    74         *   Stops playing the audio
       
    75         * @since    Series60 2.1
       
    76         */
       
    77         void StopMsgReceivedTonePlaying();
       
    78 
       
    79     public: // Functions from base classes
       
    80 
       
    81         /**
       
    82         * From MMdaAudioPlayerCallback 
       
    83         *   Completes playing the file
       
    84         * @since    Series60 2.1
       
    85         * @param    aError      Errorcode for failed cases
       
    86         * @return   aDuration   Duration of audiosample
       
    87         */
       
    88         void MapcInitComplete(
       
    89             TInt                                aError, 
       
    90             const TTimeIntervalMicroSeconds&    aDuration);
       
    91 
       
    92         /**
       
    93         * From MMdaAudioPlayerCallback 
       
    94         *   Stops playing file
       
    95         * @since    Series60 2.1
       
    96         * @param    aError      Errorcode for failed cases
       
    97         * @return ?description
       
    98         */
       
    99         void MapcPlayComplete( TInt aError );
       
   100         
       
   101     protected:  // New functions        
       
   102     protected:  // Functions from base classes
       
   103     private:
       
   104 
       
   105         /**
       
   106         * C++ default constructor.
       
   107         */
       
   108         CNcnHandlerAudio( CNcnModelBase* aModel );
       
   109 
       
   110         /**
       
   111         * By default Symbian 2nd phase constructor is private.
       
   112         */
       
   113         void ConstructL();
       
   114 
       
   115     private:
       
   116 
       
   117         /**
       
   118         * Fetches the sound and volume for received messagetype
       
   119         * @since    Series60 2.1
       
   120         * @param    aProfile Current profile.
       
   121         * @param    aVolume     The variable to store the volume
       
   122         * @param    aMessageType Type of received message (sms or email)
       
   123         * @return   KErrNone when no problems found
       
   124         */
       
   125         TInt GetSoundFileL(
       
   126             const MProfile& aProfile, 
       
   127             TFileName&      aSound, 
       
   128             const TUint&    aMessageType ) const;
       
   129         
       
   130         /**
       
   131         * Removes the audio player and sends required information to shareddata
       
   132         * @since    Series60 2.1
       
   133         */
       
   134         void RemoveAudioPlayer();
       
   135 
       
   136         /**
       
   137         * Plays next alerttone from queue
       
   138         * @since    Series60 2.1
       
   139         * @return   KErrNone, when no errors.
       
   140         */
       
   141         TInt PlayAlertToneFromQueueL();
       
   142 
       
   143 	    /**
       
   144         * Handles audio initialisation errors.
       
   145         * @since    Series60 2.6
       
   146         * @return   KErrNone, when no errors.
       
   147         */
       
   148 		TInt PlayDefaultAlertToneL();
       
   149 		
       
   150 		/**
       
   151 		 * Returns ETrue if beep-once is set in profile. If it is,
       
   152 		 * beep sequence should be played instead of message alert tone.
       
   153 		 * @param Active profile.
       
   154 		 * @return ETrue if beep-once is set in profile.
       
   155 		 */
       
   156 		TBool IsBeepOnceSetL( const MProfile& aProfile ) const;	
       
   157 		 /* Plays Alert tone */
       
   158 		void CNcnHandlerAudio::StartPlayToneL();	
       
   159 		
       
   160     public:     // Data   
       
   161     protected:  // Data
       
   162     private:    // Data
       
   163 
       
   164         // A pointer to the CNcnModel instance
       
   165         CNcnModelBase* iNcnModel;
       
   166         // A pointer to the audio player instance
       
   167         CMdaAudioPlayerUtility* iAudioPlayer;
       
   168         
       
   169         // A pointer to the MProfileEngine instance
       
   170         MProfileEngine* iProfileEngine;               
       
   171         // Tone to be played
       
   172         RArray<TUint> iToneQueue;
       
   173         // State of audioplayer
       
   174         TUint iAlertTonePlaying;
       
   175 		// Play default tone
       
   176 		TBool iDefaultTonePlayed;
       
   177 		//The tone that is selected to be played
       
   178 		TFileName iSelectedTone;
       
   179     };
       
   180 
       
   181 #endif      // NCNHANDLERAUDIO_H   
       
   182             
       
   183 // End of File