voiceui/voiceuivoicerecognition/inc/vuicttsplayer.h
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VUICTTSPLAYER_H
       
    20 #define VUICTTSPLAYER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <nssttsutility.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MTtsClientUtilityObserver;
       
    29 
       
    30 // CONSTANTS
       
    31 const TInt KMaxSegments = 6;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35 * 
       
    36 *
       
    37 */
       
    38 NONSHARABLE_CLASS( CTTSPlayer ) : public CBase
       
    39 {
       
    40     public:     // Constructors and destructor
       
    41 
       
    42         /**
       
    43         * Symbian two-phased constructor.
       
    44         */
       
    45         static CTTSPlayer* NewL( MTtsClientUtilityObserver* aObserver );
       
    46 
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         virtual ~CTTSPlayer();
       
    51                                 
       
    52     public:     // New functions
       
    53     
       
    54         /**
       
    55         * Starts the playback
       
    56         * @param aText Complete text to be played
       
    57         * @param aPosition First possible index of the segment
       
    58         * @param aMaxLength Maximum possible length of the segment
       
    59         * @param aSegment Text to be segmented from aText
       
    60         */
       
    61         void PlayL( const TDesC& aText, TInt aPosition = 0,
       
    62                     TInt aMaxLength = 0, const TDesC& aSegment = KNullDesC );
       
    63         
       
    64         /**
       
    65         * Starts the playback
       
    66         * @param aText Start of the text to be played
       
    67         * @param aPosition First possible index of the segment
       
    68         * @param aMaxLength Maximum possible length of the segment
       
    69         * @param aSegment Text to be segmented from aText
       
    70         * @param aNewSegment1 New segment to be added to end of text
       
    71         * @param aNewSegment2 New segment to be added to end of text
       
    72         * @param aNewSegment3 New segment to be added to end of text
       
    73         */
       
    74         void PlayL( const TDesC& aText, TInt aPosition,
       
    75                     TInt aMaxLength, const TDesC& aSegment,
       
    76                     const TDesC& aNewSegment1,
       
    77                     const TDesC& aNewSegment2 = KNullDesC,
       
    78                     const TDesC& aNewSegment3 = KNullDesC );
       
    79         
       
    80         /**
       
    81         * Stops the playback
       
    82         */
       
    83         void Stop();
       
    84              
       
    85     protected:  // New functions
       
    86         
       
    87         /**
       
    88         * C++ default constructor.
       
    89         */
       
    90         CTTSPlayer( MTtsClientUtilityObserver* aObserver );
       
    91         
       
    92         /**
       
    93         * Symbian OS 2nd phase constructor.
       
    94         */
       
    95         virtual void ConstructL();
       
    96         
       
    97     private:    // Data
       
    98     
       
    99         /**
       
   100         * Creates segments from given text
       
   101         * @param aText Complete text to be played
       
   102         * @param aPosition First possible index of the segment
       
   103         * @param aMaxLength Maximum possible length of the segment
       
   104         * @param aSegment Text to be segmented from aText
       
   105         */
       
   106         void CreateSegmentsL( const TDesC& aText, TInt aPosition,
       
   107                               TInt aMaxLength, const TDesC& aSegment );
       
   108     
       
   109     struct TTtsData
       
   110         {
       
   111         // TTS speech styles
       
   112         TTtsStyle* iStyle[KMaxSegments];
       
   113 
       
   114         // TTS speech style handles
       
   115         TTtsStyleID* iStyleId[KMaxSegments];
       
   116 
       
   117         // TTS speech segments
       
   118         TTtsSegment* iSegment[KMaxSegments];
       
   119 
       
   120         // TTS player
       
   121         CTtsUtility* iTts;
       
   122 
       
   123         // Parsed text
       
   124         CTtsParsedText* iParsedText;
       
   125 
       
   126         // Initializes everything to zero
       
   127         TTtsData();
       
   128         };
       
   129         
       
   130     // Play observer
       
   131     MTtsClientUtilityObserver*      iObserver;
       
   132     
       
   133     // TTS Data
       
   134     TTtsData*                       iTtsData;
       
   135 };
       
   136 
       
   137 #endif  // VUICTTSPLAYER_H
       
   138 
       
   139 // End of File