voicerecorder/RecViewSrc/CVRTonePlayer.h
branchRCL_3
changeset 20 072a5fa0c63b
parent 19 2f5c9ee7098c
child 21 c6bafb5162d8
equal deleted inserted replaced
19:2f5c9ee7098c 20:072a5fa0c63b
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Class that handles playback of tones in Voice Recorder application
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CVRTONEPLAYER_H
       
    20 #define CVRTONEPLAYER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <mdaaudiotoneplayer.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CAknKeySoundSystem;
       
    27 class CAknSoundInfo;
       
    28 
       
    29 /**
       
    30  *  Class that handles playback of tones in Voice Recorder application
       
    31  *
       
    32  *  @lib VoiceRecorderRecView.lib
       
    33  *  @since S60 v3.0
       
    34  */
       
    35 NONSHARABLE_CLASS( CVRTonePlayer )
       
    36 	: public CBase, public MMdaAudioToneObserver
       
    37     {
       
    38 
       
    39 private:
       
    40 	enum TVRTonePlayerState
       
    41 		{
       
    42 		EVRToneIdle,
       
    43 		EVRTonePreparing,
       
    44 		EVRTonePlaying
       
    45 		};
       
    46 
       
    47 public:
       
    48 
       
    49     static CVRTonePlayer* NewL();
       
    50     virtual ~CVRTonePlayer();
       
    51 
       
    52     /**
       
    53      * Prepares a tone for playback. This does not guarantee
       
    54      * that preparing is ready after completion.
       
    55      *
       
    56      * @since S60 v3.0
       
    57      * @param aToneId Predefined id of the tone to be prepared
       
    58      */
       
    59     void PrepareToneL( TInt aToneId );
       
    60 
       
    61     /**
       
    62      * Non-leaving method that calls PrepareToneL and ignores all leaves
       
    63      *
       
    64      * @since S60 v3.0
       
    65      * @param aToneId Predefined id of the tone to be prepared
       
    66      */
       
    67     void PrepareTone( TInt aToneId );
       
    68 
       
    69     /**
       
    70      * Starts playback of tone. Playback starts immediately if the tone
       
    71      * specified has been already been prepared. Otherwise the tone
       
    72      * is first prepared.
       
    73      *
       
    74      * @since S60 v3.0
       
    75      * @param aToneId Predefined id of the tone to be played
       
    76      */
       
    77     void PlayTone( TInt aToneId );
       
    78 
       
    79 // from base class MMdaAudioToneObserver
       
    80 
       
    81     /**
       
    82      * From MMdaAudioToneObserver.
       
    83      * Defines required client behaviour when an attempt to configure the
       
    84 	 * audio tone player utility has completed, successfully or otherwise.
       
    85      *
       
    86 	 * @param     aError KErrNone if successful. One of the system
       
    87 	 *            wide error codes if the attempt failed. The possible
       
    88 	 *            values depend on the EPOC platform.
       
    89      */
       
    90     void MatoPrepareComplete(TInt aError);
       
    91 
       
    92     /**
       
    93      * From MMdaAudioToneObserver.
       
    94 	 * Defines required client behaviour when the tone playing operation has
       
    95 	 * completed, successfully or otherwise.
       
    96      *
       
    97 	 * @param     aError KErrNone if successful. One of the system
       
    98 	 *            wide error codes if the attempt failed. The possible
       
    99 	 *            values depend on the EPOC platform.
       
   100      */
       
   101     void MatoPlayComplete(TInt aError);
       
   102 
       
   103 private:
       
   104 
       
   105     CVRTonePlayer();
       
   106     void ConstructL();
       
   107 
       
   108 private: // data
       
   109 
       
   110     /**
       
   111      * Instance of the player class.
       
   112      * Own.
       
   113      */
       
   114      CMdaAudioToneUtility* iPlayer;
       
   115 
       
   116 	/**
       
   117 	 * Pointer to sound system utility that retrieves the sound data.
       
   118 	 * Not owned.
       
   119 	 */
       
   120 	 CAknKeySoundSystem* iSoundSystem;
       
   121 
       
   122 	/**
       
   123 	 * The id of the tone that is currently prepared
       
   124 	 */
       
   125 	 TInt iPreparedTone;
       
   126 
       
   127 	/**
       
   128 	 * The id of the tone that is in queue
       
   129 	 */
       
   130 	 TInt iQueuedTone;	
       
   131 	 
       
   132 	/**	
       
   133 	 * Is a tone currently in preparation
       
   134 	 */
       
   135 	 TVRTonePlayerState iState;
       
   136 	 
       
   137 	 /**
       
   138 	 * Used for waiting tone play comlete until continuing
       
   139 	 */
       
   140 	 CActiveSchedulerWait iShedulerWait;
       
   141     
       
   142     };
       
   143 
       
   144 #endif // CVRTONEPLAYER_H