phoneengine/audiohandling/inc/cpeaudiodtmftoneplayer.h
changeset 0 5f000ab63145
child 21 92ab7f8d0eab
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002-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 file contains the header file of the class CPEAudioDtmfTonePlayer, 
       
    15 *                that plays DTMF tones using media server.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPEAUDIODTMFTONEPLAYER_H
       
    21 #define CPEAUDIODTMFTONEPLAYER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <sounddevice.h>
       
    26 
       
    27 // CONSTANTS
       
    28 // None.
       
    29 
       
    30 // MACROS
       
    31 // None.
       
    32 
       
    33 // DATA TYPES
       
    34 // None.
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 // None.
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CMMFDevSound;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  plays DTMF tones using media server
       
    46 *
       
    47 *  @lib audiohandling.lib
       
    48 *  @since Series60_2.7
       
    49 */
       
    50 class CPEAudioDtmfTonePlayer 
       
    51     : public CBase, 
       
    52       public MDevSoundObserver
       
    53     {
       
    54     public:  // Constructors and destructor      
       
    55         
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         */
       
    59         static CPEAudioDtmfTonePlayer* NewL();
       
    60         
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CPEAudioDtmfTonePlayer();
       
    65 
       
    66     public:
       
    67 
       
    68         /**
       
    69         * Sets volume.
       
    70         * @since Series60_2.7
       
    71         * @param aVolume volume value or KDtmfSilent.
       
    72         * @return None.
       
    73         */
       
    74         void SetVolume( TInt aVolume );
       
    75 
       
    76         /**
       
    77         * Starts playing given dtmf tone infinitely.
       
    78         * @since Series60_2.7
       
    79         * @param aTone Tone to be played.
       
    80         * @return None.
       
    81         */
       
    82         void PlayDtmfTone( TChar aTone );
       
    83 
       
    84         /**
       
    85         * Cancels playing.
       
    86         * @since Series60_2.7
       
    87         * @param None.
       
    88         * @return None.
       
    89         */
       
    90         void Cancel();
       
    91         
       
    92     public: //From MDevSoundObserver
       
    93           /**
       
    94           * See MDevSoundObserver
       
    95           */
       
    96            void InitializeComplete( TInt aError );
       
    97 
       
    98           /**
       
    99           * See MDevSoundObserver
       
   100           */
       
   101            void ToneFinished( TInt aError );
       
   102 
       
   103           /**
       
   104           * See MDevSoundObserver
       
   105           */
       
   106            void BufferToBeFilled( CMMFBuffer* aBuffer );
       
   107 
       
   108           /**
       
   109           * See MDevSoundObserver
       
   110           */
       
   111            void PlayError( TInt aError );
       
   112 
       
   113           /**
       
   114           * See MDevSoundObserver
       
   115           */
       
   116            void BufferToBeEmptied( CMMFBuffer* aBuffer );
       
   117 
       
   118           /**
       
   119           * See MDevSoundObserver
       
   120           */
       
   121            void RecordError( TInt aError );
       
   122 
       
   123           /**
       
   124           * See MDevSoundObserver
       
   125           */
       
   126            void ConvertError( TInt aError );
       
   127           /**
       
   128           * See MDevSoundObserver
       
   129           */       
       
   130           void DeviceMessage( TUid aMessageType, const TDesC8& aMsg );   
       
   131           
       
   132     protected:
       
   133 
       
   134         /**
       
   135         * C++ default constructor.
       
   136         */
       
   137         CPEAudioDtmfTonePlayer();
       
   138 
       
   139         void ConstructL();
       
   140 
       
   141 
       
   142         /**
       
   143         * Normalize tone.
       
   144 		* @since Series60_2.7
       
   145 		* @param aTone dtmf tone.
       
   146         * @return None.
       
   147         */
       
   148         void Normalize( TChar& aTone );
       
   149 
       
   150   
       
   151         
       
   152     private: //new functions
       
   153         
       
   154         /**
       
   155          * Converts the given value to the one that matches tha range used by 
       
   156          * CMMFDevSound. The CMMFDevSound uses valuess that can from 0 to the
       
   157          * value returned by a call to CMMFDevSound::MaxVolume().
       
   158          */
       
   159     	TInt ConvertVolume( TInt aVolume );
       
   160     
       
   161     protected:    // Data
       
   162 
       
   163         // Current volume setting.
       
   164         TInt iVolume;
       
   165         
       
   166         // DTMF player instance
       
   167         CMMFDevSound*        iDTMFPlayer;
       
   168 
       
   169     };
       
   170 
       
   171 #endif      // CPEAUDIODTMFTONEPLAYER_H
       
   172             
       
   173 // End of File