alarmui/inc/AlmAlarmPlayer.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:   This class provides audio playback for Alarm UI.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef ALMALARMPLAYER_H
       
    21 #define ALMALARMPLAYER_H
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include <mdaaudiotoneplayer.h>
       
    26 #include <mdaaudiosampleplayer.h>
       
    27 
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CAlarmUtils;
       
    31 
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  Audio player for Alarm UI.
       
    37 *  This class reads alarm tone settings (volume, ringing type, etc.) and
       
    38 *  starts playing the alarm tone.
       
    39 *
       
    40 *  @lib AknAlarmService.lib
       
    41 *  @since 1.0
       
    42 */
       
    43 NONSHARABLE_CLASS( CAlmAlarmPlayer ) : public CBase, 
       
    44                                        public MMdaAudioToneObserver, 
       
    45                                        private MMdaAudioPlayerCallback
       
    46 {
       
    47  public:  // Constructors and destructor
       
    48     // Symbian two-phased constructor
       
    49     static CAlmAlarmPlayer* NewL(CAlarmUtils* aAlarmUtils);
       
    50 
       
    51     // Destructor
       
    52     ~CAlmAlarmPlayer();
       
    53 
       
    54  private:
       
    55     // C++ constructor
       
    56     CAlmAlarmPlayer(CAlarmUtils* aAlarmUtils);
       
    57 
       
    58     // Symbian 2nd phase constructor.
       
    59     void ConstructL();
       
    60 
       
    61     /**
       
    62     * Play appropriate alarm type using profile ringing type setting.
       
    63     * @param aIsRNGTone ETrue, if alarm tone is a RNG file.
       
    64     * @since 3.0
       
    65     */
       
    66     void PlayCalendarAlarmL(TBool aIsRngTone);
       
    67 
       
    68     /**
       
    69     * Play silent calendar alarm. (needed to for vibra)
       
    70     * @since 2.1
       
    71     */
       
    72     void PlaySilentCalendarAlarmL();
       
    73 
       
    74     /**
       
    75     * Play normal clock alarm.
       
    76     * @since 2,0
       
    77     */
       
    78     void PlayClockAlarmL();
       
    79 
       
    80     /**
       
    81     * Play calendar alarm tone. (KRngMimeType files only)
       
    82     * @since 2.0
       
    83     */
       
    84     void PlayCalendarAlarmToneL();
       
    85 
       
    86     /**
       
    87     * Play calendar alarm tone. (KRngMimeType files only)
       
    88     * @since 2,0
       
    89     */
       
    90     void PlayClockAlarmToneL();
       
    91 
       
    92     /**
       
    93     * Play beep alarm for calendar.
       
    94     * @since 2,0
       
    95     */
       
    96     void PlayCalendarBeepL();
       
    97 
       
    98     /**
       
    99     * Play beep alarm for clock.
       
   100     * @since 2,0
       
   101     */
       
   102     void PlayClockBeepL();
       
   103 
       
   104     /**
       
   105     * Check the file and alarm type and try to play the alarm.
       
   106     * @since 3.0
       
   107     */
       
   108     void PlayAlarmL();
       
   109 
       
   110     /**
       
   111     * Common fallback functionality for prepare/play errors.
       
   112     * @since 3.0
       
   113     * @param aError Error id.
       
   114     */
       
   115     void HandlePlayErrorL(TInt aError);
       
   116 
       
   117     /**
       
   118     * Calculate player volume.
       
   119     * @since s60 3.2
       
   120     * @param aPlayerMaxVol Maximum volume for the player.
       
   121     * @param aVol Requested profile volume.
       
   122     * @return Adjusted player volume.
       
   123     */
       
   124     TInt PlayerVolume(TInt aPlayerMaxVol, TInt aVol);
       
   125 
       
   126  private: // from MMdaAudioToneObserver
       
   127     /**
       
   128     * From MMdaAudioToneObserver. Called after tone has been initialized.
       
   129     * @since 1.0
       
   130     * @param aError Error code
       
   131     */
       
   132     void MatoPrepareComplete(TInt aError);
       
   133 
       
   134     /**
       
   135     * From MMdaAudioToneObserver. Called after tone has been played.
       
   136     * @since 1.0
       
   137     * @param aError Error code
       
   138     */
       
   139     void MatoPlayComplete(TInt aError);
       
   140 
       
   141  private: // from MMdaAudioPlayerCallback
       
   142     /**
       
   143     * From MMdaAudioPlayerCallback. Called after sample initialization is complete
       
   144     * @since 2.0
       
   145     * @param aError Error code
       
   146     * @param aDuration Duration of the sample
       
   147     */
       
   148     void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
       
   149 
       
   150     /**
       
   151     * From MMdaAudioPlayerCallback. Called after sample has been played.
       
   152     * @since 2.0
       
   153     * @param aError Error code
       
   154     */
       
   155     void MapcPlayComplete(TInt aError);
       
   156 
       
   157  private:
       
   158     // Audio tone player
       
   159     CMdaAudioToneUtility* iSequencePlayer;
       
   160 
       
   161     // Beep tone player
       
   162     CMdaAudioToneUtility* iBeepPlayer;
       
   163 
       
   164     // Audio sample player
       
   165     CMdaAudioPlayerUtility* iSamplePlayer;
       
   166 
       
   167     /**
       
   168     * Pointer to alarm utils class.
       
   169     * Now own.
       
   170     */
       
   171     CAlarmUtils* iAlarmUtils;
       
   172 
       
   173 };
       
   174 
       
   175 #endif  // ALMALARMPLAYER_H
       
   176 
       
   177 
       
   178 // End of File