mmserv/tms/tmsserver/inc/tmsaudioinbandtoneplayer.h
branchRCL_3
changeset 19 095bea5f582e
equal deleted inserted replaced
18:a36789189b53 19:095bea5f582e
       
     1 /*
       
     2  * Copyright (c) 2009 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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef TMSAUDIOINBANDTONEPLAYER_H
       
    19 #define TMSAUDIOINBANDTONEPLAYER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <AudioPreference.h>
       
    23 #include <mdaaudiotoneplayer.h>
       
    24 #include <barsc.h>
       
    25 #include <barsread.h>
       
    26 #include <ccpdefs.h>
       
    27 #include <tms.h>
       
    28 
       
    29 namespace TMS {
       
    30 
       
    31 // CONSTANTS
       
    32 const gint KPhoneInbandToneZero = 0;
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class TMSAudioToneUtility;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  *  This class is used to play inband tones using media server.
       
    41  *
       
    42  */
       
    43 class TMSAudioInbandTonePlayer : public MMdaAudioToneObserver
       
    44     {
       
    45 public:
       
    46     // Constructors and destructor
       
    47 
       
    48     /**
       
    49      * Two-phased constructor.
       
    50      */
       
    51     static TMSAudioInbandTonePlayer* NewL();
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     virtual ~TMSAudioInbandTonePlayer();
       
    57 
       
    58     /**
       
    59      * Plays given tone. Originates from CCP plugin.
       
    60      * @param aTone inband tone needed to play
       
    61      */
       
    62     void PlayInbandTone(TMSInbandToneType tone);
       
    63 
       
    64     /**
       
    65      * Cancels playing.
       
    66      */
       
    67     void Cancel();
       
    68 
       
    69     /**
       
    70      * Sets volume.
       
    71      * @param    aVolume     Volume in 0...10 scale.
       
    72      */
       
    73     void SetVolume(gint volume);
       
    74 
       
    75 private:
       
    76 
       
    77     /**
       
    78      * C++ default constructor.
       
    79      */
       
    80     TMSAudioInbandTonePlayer();
       
    81 
       
    82     /**
       
    83      * By default Symbian 2nd phase constructor is private.
       
    84      */
       
    85     void ConstructL();
       
    86 
       
    87     /**
       
    88      * Create inband tone sequences from resources.
       
    89      */
       
    90     void CreateToneSequencesL();
       
    91 
       
    92     /**
       
    93      * Playes current tone.
       
    94      * @param None.
       
    95      * @return None.
       
    96      */
       
    97     void PlayCurrentTone();
       
    98 
       
    99     /**
       
   100      * Configure tone player utility for current sequence playback.
       
   101      */
       
   102     void SetToneAttributes(const guint pref,
       
   103             const guint priority = KAudioPriorityNetMsg,
       
   104             const gint repeatTimes = KMdaAudioToneRepeatForever,
       
   105             const gint trailSilence = KPhoneInbandToneZero);
       
   106 
       
   107     /**
       
   108      * Allocate tone sequence from resource.
       
   109      */
       
   110     void AllocSeqFromResourceL(const gint resource);
       
   111 
       
   112     //From MMdaAudioToneObserver
       
   113 
       
   114     /**
       
   115      * Handles completion of preparation.
       
   116      * @param aError Isn't used.
       
   117      * @return None.
       
   118      */
       
   119     void MatoPrepareComplete(TInt aError);
       
   120 
       
   121     //From MMdaAudioToneObserver
       
   122     /**
       
   123      * Handles completion of playing.
       
   124      * @param aError Isn't used.
       
   125      * @return None.
       
   126      */
       
   127     void MatoPlayComplete(TInt aError);
       
   128 
       
   129     /**
       
   130      * Calculates media server volume level.
       
   131      * @param   aVolume     Volume level in 0...10 scale.
       
   132      * @return  Volume level in media server scale.
       
   133      */
       
   134     gint CalculateMediaServerVolume(gint volume) const;
       
   135 
       
   136     /**
       
   137      * Updates tone player's volume to the current audio volume level.
       
   138      */
       
   139     void UpdateTonePlayerVolume();
       
   140 
       
   141 private:
       
   142     // Data
       
   143 
       
   144     // Currently playing, NULL or tone sequence.
       
   145     TMSAudioToneUtility* iPlayer;
       
   146     // Member variable for inband tone
       
   147     TMSInbandToneType iToneName;
       
   148     // Ringing type
       
   149     // TProfileRingingType iRingingType;
       
   150     // Handle to a file server session
       
   151     RFs iFsSession;
       
   152 	// For reading sequence tones from resource file
       
   153     TFileName iFileName;
       
   154     RResourceFile iResourceFile;
       
   155     TResourceReader iReader;
       
   156     // Array of tone pointers
       
   157     RPointerArray<HBufC8> iTones;
       
   158     };
       
   159 
       
   160 } // namespace TMS
       
   161 
       
   162 #endif // TMSAUDIOINBANDTONEPLAYER_H
       
   163 
       
   164 // End of File