srsf/ttsutility/src/ttsutilitybody.h
branchRCL_3
changeset 23 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
22:cad71a31b7fc 23:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2004-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:  Body behind TTS Utility API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TTSUTILITYBODY_H
       
    20 #define TTSUTILITYBODY_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <nssttsutility.h>
       
    24 #include <mdaaudiosampleplayer.h>
       
    25 #include <nssttscustomcommands.h>
       
    26 #include "srsfbldvariant.hrh"
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 * Implementation for TTS Utility API.
       
    32 *
       
    33 * @lib TtsUtility.lib
       
    34 * @since 2.8
       
    35 */
       
    36 NONSHARABLE_CLASS( CTtsUtilityBody ) : public CBase, 
       
    37                                        public MMdaAudioPlayerCallback, 
       
    38                                        public MMMFControllerEventMonitorObserver
       
    39     {
       
    40     public: // Constructors and destructor
       
    41         
       
    42         /**
       
    43         * Two-phased constructor.
       
    44         */
       
    45         static CTtsUtilityBody* NewL( MTtsClientUtilityObserver& aObserver );
       
    46         
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         virtual ~CTtsUtilityBody();
       
    51         
       
    52     public: // New functions
       
    53         
       
    54         
       
    55         /**
       
    56         * Opens connection to a specific plugin.
       
    57         *
       
    58         * @param "TUid aUid" Plugin UID which will be instantiated
       
    59         */
       
    60         void OpenPluginL( TUid aUid );
       
    61         
       
    62         /**
       
    63         * Lists UIDs of available Text-To-Speech plugins.
       
    64         *
       
    65         * @param "RArray<TUid>& aUids" Output parameter which will contain the
       
    66         *                              list of plugin UIDs after function call.
       
    67         */
       
    68         void ListPluginsL( RArray<TUid>& aUids );        
       
    69        
       
    70         /**
       
    71         * Sets the default style parameters for synthesis.
       
    72         *
       
    73         * @param "const TTtsStyle& aStyle" Style created by the client
       
    74         */
       
    75         void SetDefaultStyleL( const TTtsStyle& aStyle );
       
    76         
       
    77         /**
       
    78         * Returns the registered default style
       
    79         *
       
    80         * @return Style reference
       
    81         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
    82         */
       
    83         TTtsStyle& DefaultStyleL();
       
    84         
       
    85         /**
       
    86         * Sets the speaking rate of synthesizer.
       
    87         *
       
    88         * @param TInt aRate Speaking rate value
       
    89         * @leave KErrNotSupported if synthesizer does not support speaking rate setting
       
    90         */        
       
    91         void SetSpeakingRateL( TInt aRate );
       
    92         
       
    93         /**
       
    94         * Returns the current speaking rate value.
       
    95         *
       
    96         * @return Speaking rate value
       
    97         * @leave KErrNotSupported if synthesizer does not support speaking rate setting
       
    98         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
    99         */
       
   100         TInt SpeakingRateL();
       
   101        
       
   102         /**
       
   103         * Returns the list of supported languages.
       
   104         * 
       
   105         * @param "RArray<TLanguage>& aLanguages" Output parameter which contains the languages
       
   106         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
   107         */
       
   108         void GetSupportedLanguagesL( RArray<TLanguage>& aLanguages );
       
   109         
       
   110         /**
       
   111         * Returns the list of supported voices for a certain language.
       
   112         * 
       
   113         * @param "TLanguage aLanguage" Language
       
   114         * @param "RArray<TVoice>& aVoices" Output parameter which contains the voices
       
   115         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
   116         */
       
   117         void GetSupportedVoicesL( TLanguage aLanguage, RArray<TTtsStyle>& aVoices );
       
   118         
       
   119         /**
       
   120         * Open a descriptor ready for playback
       
   121         *
       
   122         * @param "const TDesC& aDescriptor" Descriptor containing the text to be synthesized.
       
   123         * @since 3.2        
       
   124         */
       
   125         void OpenDesL( const TDesC& aDescriptor ); 
       
   126 
       
   127         /**
       
   128         * Opens a descriptor and plays it.
       
   129         *
       
   130         * @param "const TDesC& aDescriptor" Descriptor to play 
       
   131         * @since 3.2
       
   132         */
       
   133         void OpenAndPlayDesL( const TDesC& aDescriptor );          
       
   134         
       
   135         /**
       
   136         * Directing output of a next synthesis to the specified file
       
   137         *
       
   138         * @param "RFile& aFile" Open file handle to save output of next synthesis.
       
   139         * @since 3.2
       
   140         */
       
   141         void SetOutputFileL( const RFile& aFile );
       
   142         
       
   143         /**
       
   144         * Adds new style to style collection.
       
   145         *
       
   146         * @param "TTtsStyle& aStyle" Reference to style.
       
   147         * @return Assigned style ID.
       
   148         */
       
   149         TTtsStyleID AddStyleL( const TTtsStyle& aStyle );
       
   150 
       
   151         /**
       
   152         * Deletes style from the style collection.
       
   153         *
       
   154         * @param "TTtsStyle& aStyle" Reference to style.
       
   155         * @return Error code.
       
   156         */
       
   157         TInt DeleteStyle( TTtsStyleID aID );
       
   158 
       
   159         /**
       
   160         * Returns number of styles.
       
   161         *
       
   162         * @return Number of styles.
       
   163         */
       
   164         TUint16 NumberOfStyles();
       
   165 
       
   166         /**
       
   167         * Returns style based on style ID
       
   168         *
       
   169         * @param "TTtsStyleID aStyleID" Style identifier.
       
   170         * @return Reference to found style.
       
   171         */
       
   172         TTtsStyle& StyleL( TTtsStyleID aStyleID );
       
   173 
       
   174         /**
       
   175         * Returns style based on index.
       
   176         *
       
   177         * @param "TUint16 aIndex" Index.
       
   178         * @return Reference to found style.
       
   179         */
       
   180         TTtsStyle& StyleL( TUint16 aIndex );
       
   181 
       
   182         /**
       
   183         * Begins playback of the initialised audio sample at the current volume
       
   184         * and priority levels.
       
   185         *
       
   186         * When playing of the audio sample is complete, successfully or
       
   187         * otherwise, the callback function
       
   188         * <code>MMdaAudioPlayerCallback::MapcPlayComplete()</code> is
       
   189         * called. This function raises a CMdaAudioPlayerUtility 1 panic if the
       
   190         * audio player utility is not initialised.
       
   191         */
       
   192         void Play();
       
   193 
       
   194         /**
       
   195         * Stops playback of the audio sample as soon as possible.
       
   196         *
       
   197         * If the audio sample is playing, playback is stopped as soon as
       
   198         * possible. If playback is already complete, nothing further happens as
       
   199         * a result of calling this function. The callback function
       
   200         * <code>MMdaAudioPlayerCallback::MapcPlayComplete()</code> is not
       
   201         * called.The function raises a CMdaAudioPlayerUtility 1 panic if the
       
   202         * audio player utility is not initialised.
       
   203         */
       
   204         void Stop();
       
   205         
       
   206         /**
       
   207         * Changes the current playback volume to a specified value.
       
   208         *
       
   209         * The volume can be changed before or during playback and is effective
       
   210         * immediately. The function raises a CMdaAudioPlayerUtility 1 panic if
       
   211         * the audio player utility is not initialised.
       
   212         *
       
   213         * @param	"TInt aVolume"
       
   214         *          The volume setting. This can be any value from zero to
       
   215         *          the value returned by a call to
       
   216         *          <code>CMdaAudioPlayerUtility::MaxVolume()</code>.
       
   217         *          Setting a zero value mutes the sound. Setting the
       
   218         *          maximum value results in the loudest possible sound.
       
   219         */
       
   220         void SetVolume( TInt aVolume );
       
   221         
       
   222         /**
       
   223         * Sets the number of times the audio sample is to be repeated during the
       
   224         * playback operation.
       
   225         *
       
   226         * A period of silence can follow each playing of the sample. The audio
       
   227         * sample can be repeated indefinitely.
       
   228         *
       
   229         * @param	"TInt aRepeatNumberOfTimes"
       
   230         *          The number of times the audio sample, together with
       
   231         *          the trailing silence, is to be repeated. If this is
       
   232         *          set to <code>KMdaRepeatForever</code>, then the audio
       
   233         *          sample, together with the trailing silence, is
       
   234         *          repeated indefinitely or until <code>Stop()</code> is
       
   235         *          called. If this is set to zero, then the audio sample
       
   236         *          is not repeated.
       
   237         * @param   "const TTimeIntervalMicroSeconds& aTrailingSilence"
       
   238         *          The time interval of the trailing silence.
       
   239         */
       
   240         void SetRepeats( TInt aRepeatNumberOfTimes, 
       
   241                                   const TTimeIntervalMicroSeconds& aTrailingSilence );
       
   242         
       
   243         /**
       
   244         * Returns the duration of the audio sample.
       
   245         *
       
   246         * The function raises a CMdaAudioPlayerUtility 1 panic if the audio
       
   247         * player utility is not initialised.
       
   248         *
       
   249         * @returns "TTimeIntervalMicroSeconds&"
       
   250         *          The duration in microseconds
       
   251         */
       
   252         const TTimeIntervalMicroSeconds& Duration();
       
   253         
       
   254         /**
       
   255         * Returns an integer representing the maximum volume.
       
   256         *
       
   257         * This is the maximum value which can be passed to
       
   258         * <code>CMdaAudioPlayerUtility::SetVolume()</code>. The function raises a
       
   259         * CMdaAudioPlayerUtility 1 panic if the audio player utility is not
       
   260         * initialised.
       
   261         *
       
   262         * @returns "TInt"
       
   263         *          The maximum volume. This value is platform dependent
       
   264         *          but is always greater than or equal to one.
       
   265         */
       
   266         TInt MaxVolume();
       
   267 
       
   268         /**
       
   269         * Opens a descriptor source and plays it.
       
   270         *
       
   271         * @param "TDesC8& aDescriptor" Descriptor to play.
       
   272         */
       
   273         void OpenAndPlayDesL( const TDesC8& aDescriptor );
       
   274 
       
   275         /**
       
   276         * Opens a file source and plays it.
       
   277         *
       
   278         * @param "TDesC& aFileName" File to play.
       
   279         */
       
   280         void OpenAndPlayFileL( const TDesC& aFileName );
       
   281 
       
   282         /**
       
   283         * Opens a parsed text source and plays it.
       
   284         *
       
   285         * @param "CTtsParsedText& aText" Parsed text object to play.
       
   286         */
       
   287         void OpenAndPlayParsedTextL( CTtsParsedText& aText );
       
   288 
       
   289         /**
       
   290         * Open a clip from a file
       
   291         *
       
   292         * @param	"const TDesC& aFileName" 
       
   293         *			File to open
       
   294         * @leave	Leaves with one of the system wide error codes if a problem is encountered
       
   295         *			opening the file
       
   296         */
       
   297         void OpenFileL( const TDesC& aFileName );
       
   298 
       
   299         /**
       
   300         * Open a clip from a descriptor
       
   301         *
       
   302         * @param	"const TDesC8& aDescriptor" 
       
   303         *			Descriptor containing audio clip
       
   304         * @leave	Leaves with one of the system wide error codes if a problem is encountered
       
   305         *			opening the file
       
   306         */
       
   307         void OpenDesL( const TDesC8& aDescriptor );
       
   308 
       
   309         /**
       
   310         * Open parsed text source.
       
   311         *
       
   312         * @param "CTtsParsedText& aText" Reference to parsed text object.
       
   313         */
       
   314         void OpenParsedTextL( CTtsParsedText& aText );
       
   315 
       
   316         /**
       
   317         * Pauses playback of the audio clip
       
   318         * @returns One of the system-wide error codes
       
   319         */
       
   320         TInt Pause();
       
   321         
       
   322         /**
       
   323         * Closes the current audio clip (allowing another clip to be opened)
       
   324         */
       
   325         void Close();
       
   326         
       
   327         /**
       
   328         * Returns the current playback position in microseconds
       
   329         *
       
   330         * @retval "TTimeIntervalMicroSeconds& aPosition"
       
   331         *          The current time position in microseconds from the start of the file
       
   332         * @returns One of the global error codes
       
   333         */
       
   334         TInt GetPosition( TTimeIntervalMicroSeconds& aPosition );
       
   335         
       
   336         /**
       
   337         * Returns the current playback position in word index.
       
   338         *
       
   339         * @retval "TInt& aWordIndex" The current position in words.
       
   340         * @return Error code.
       
   341         */
       
   342         TInt GetPosition( TInt& aWordIndex );
       
   343 
       
   344         /**
       
   345         * Set the current playback position in microseconds from the start of the file
       
   346         *
       
   347         * @param "TTimeIntervalMicroSeconds& aPosition"
       
   348         *          The position to move to in microseconds past the start of the file
       
   349         */
       
   350         void SetPosition( const TTimeIntervalMicroSeconds& aPosition );
       
   351         
       
   352         /**
       
   353         * Set the current playback position in word index.
       
   354         *
       
   355         * @param "TInt aWordIndex" Playback position.
       
   356         */
       
   357         void SetPosition( TInt aWordIndex );
       
   358 
       
   359         /**
       
   360         *
       
   361         * Set the priority for playback. This is used to arbitrate between multiple 
       
   362         * objects trying to access a single sound device
       
   363         *
       
   364         * @param "TInt aPriority"
       
   365         * @param "TMdaPriorityPreference aPref"
       
   366         *         Quality/time preference tradeoff
       
   367         * 
       
   368         * @returns "TInt" One of the global error codes
       
   369         */
       
   370         TInt SetPriority( TInt aPriority, TMdaPriorityPreference aPref );
       
   371         
       
   372         /**
       
   373         * Returns the current playback volume
       
   374         *
       
   375         * @retval "TInt& aVolume"
       
   376         *          A volume value between 0 and the value returned by <code>MaxVolume()</code>
       
   377         * @returns "TInt" One of the global error codes
       
   378         */
       
   379         TInt GetVolume( TInt& aVolume );
       
   380         
       
   381         /**
       
   382         * Sets the current playback balance
       
   383         *
       
   384         * @param "TInt& aBalance"
       
   385         *        A value between <code>KMMFBalanceMaxLeft</code> 
       
   386         *        and <code>KMMFBalanceMaxRight</code>. The default value is 
       
   387         *        <code>KMMFBalanceCenter</code>
       
   388         * @returns "TInt" One of the global error codes
       
   389         */
       
   390         TInt SetBalance( TInt aBalance = KMMFBalanceCenter );
       
   391         
       
   392         /**
       
   393         * Returns the current playback balance
       
   394         *
       
   395         * @retval "TInt& aBalance"
       
   396         *         A value between <code>KMMFBalanceMaxLeft</code> 
       
   397         *         and <code>KMMFBalanceMaxRight</code>
       
   398         * @returns "TInt" One of the global error codes
       
   399         */
       
   400         TInt GetBalance( TInt& aBalance );
       
   401         
       
   402         /**
       
   403         * Send a synchronous custom command to the controller
       
   404         * @param "aDestination"	"The destination of the message, consisting of the uid of
       
   405         *        the interface of this message."
       
   406         * @param "aFunction" "The function number to indicate which function is to be called
       
   407         *        on the interface defined in the aDestination parameter."
       
   408         * @param "aDataTo1" "A reference to the first chunk of data to be copied to the controller 
       
   409         *        framework. The exact contents of the data are dependent on the 
       
   410         *        interface being called.  Can be KNullDesC8."
       
   411         * @param "aDataTo2" "A reference to the second chunk of data to be copied to the controller 
       
   412         *        framework. The exact contents of the data are dependent on the 
       
   413         *        interface being called.  Can be KNullDesC8."
       
   414         * @param "aDataFrom" "A reference to an area of memory to which the controller framework will 
       
   415         *        write any data to be passed back to the client.  Can't be KNullDesC8."
       
   416         * @return "The result of the request. Exact range of values is dependent on the interface."
       
   417         */
       
   418         TInt CustomCommandSync( const TMMFMessageDestinationPckg& aDestination, 
       
   419                                          TInt aFunction, 
       
   420                                          const TDesC8& aDataTo1, 
       
   421                                          const TDesC8& aDataTo2, 
       
   422                                          TDes8& aDataFrom);
       
   423         /**
       
   424         * Send a synchronous custom command to the controller
       
   425         * @param "aDestination" "The destination of the message, consisting of the uid of
       
   426         *		 the interface of this message."
       
   427         * @param "aFunction" "The function number to indicate which function is to be called
       
   428         *        on the interface defined in the aDestination parameter."
       
   429         * @param "aDataTo1" "A reference to the first chunk of data to be copied to the controller 
       
   430         *         framework. The exact contents of the data are dependent on the 
       
   431         *         interface being called.  Can be KNullDesC8."
       
   432         * @param "aDataTo2" "A reference to the second chunk of data to be copied to the controller 
       
   433         *         framework. The exact contents of the data are dependent on the 
       
   434         *         interface being called.  Can be KNullDesC8."
       
   435         * @return "The result of the request. Exact range of values is dependent on the interface."
       
   436         */
       
   437         TInt CustomCommandSync( const TMMFMessageDestinationPckg& aDestination, 
       
   438                                          TInt aFunction, 
       
   439                                          const TDesC8& aDataTo1, 
       
   440                                          const TDesC8& aDataTo2 );
       
   441         /**
       
   442         * Send a asynchronous custom command to the controller
       
   443         * Note: This method will return immediately.  The RunL of the active object owning the 
       
   444         * <code>aStatus<\code> parameter will be called when the command is completed by the 
       
   445         * controller framework.
       
   446         * @param "aDestination" "The destination of the message, consisting of the uid of
       
   447         *        the interface of this message."
       
   448         * @param "aFunction" "The function number to indicate which function is to be called
       
   449         *        on the interface defined in the aDestination parameter."
       
   450         * @param "aDataTo1" "A reference to the first chunk of data to be copied to the controller 
       
   451         *        framework. The exact contents of the data are dependent on the 
       
   452         *        interface being called.  Can be KNullDesC8."
       
   453         * @param "aDataTo2" "A reference to the second chunk of data to be copied to the controller 
       
   454         *        framework. The exact contents of the data are dependent on the 
       
   455         *        interface being called.  Can be KNullDesC8."
       
   456         * @param "aDataFrom" "A reference to an area of memory to which the controller framework will 
       
   457         *        write any data to be passed back to the client.  Can't be KNullDesC8."
       
   458         * @param "aStatus" "The TRequestStatus of an active object.  This will contain the 
       
   459         *        result of the request on completion.  The exact range of 
       
   460         *        result values is dependent on the interface."
       
   461         */
       
   462         void CustomCommandAsync( const TMMFMessageDestinationPckg& aDestination,  
       
   463                                           TInt aFunction, 
       
   464                                           const TDesC8& aDataTo1, 
       
   465                                           const TDesC8& aDataTo2, 
       
   466                                           TDes8& aDataFrom, 
       
   467                                           TRequestStatus& aStatus );
       
   468         /**
       
   469         * Send a asynchronous custom command to the controller
       
   470         * Note: This method will return immediately.  The RunL of the active object owning the 
       
   471         * <code>aStatus<\code> parameter will be called when the command is completed by the 
       
   472         * controller framework.
       
   473         * @param 	"aDestination"	"The destination of the message, consisting of the uid of
       
   474         *							the interface of this message."
       
   475         * @param	"aFunction"		"The function number to indicate which function is to be called
       
   476         *							on the interface defined in the aDestination parameter."
       
   477         * @param	"aDataTo1"		"A reference to the first chunk of data to be copied to the controller 
       
   478         *							framework. The exact contents of the data are dependent on the 
       
   479         *							interface being called.  Can be KNullDesC8."
       
   480         * @param	"aDataTo2"		"A reference to the second chunk of data to be copied to the controller 
       
   481         *							framework. The exact contents of the data are dependent on the 
       
   482         *							interface being called.  Can be KNullDesC8."
       
   483         * @param 	"aStatus"		"The TRequestStatus of an active object.  This will contain the 
       
   484         *							result of the request on completion.  The exact range of 
       
   485         * 							result values is dependent on the interface."
       
   486         * @since					7.0s
       
   487         */
       
   488         void CustomCommandAsync( const TMMFMessageDestinationPckg& aDestination, 
       
   489                                           TInt aFunction, 
       
   490                                           const TDesC8& aDataTo1, 
       
   491                                           const TDesC8& aDataTo2, 
       
   492                                           TRequestStatus& aStatus );
       
   493 
       
   494     public: // Functions from MMdaAudioPlayerCallback
       
   495         
       
   496         void MapcInitComplete( TInt /*aError*/, const TTimeIntervalMicroSeconds& /*aDuration*/ ) {}
       
   497         void MapcPlayComplete( TInt /*aError*/ ) {}
       
   498 
       
   499 
       
   500     public: // Functions from MMMFControllerEventMonitorObserver
       
   501 
       
   502         void HandleEvent( const TMMFEvent& aEvent );
       
   503       
       
   504     private:
       
   505         
       
   506         /**
       
   507         * C++ default constructor.
       
   508         *
       
   509         * @param "MTtsClientUtilityObserver& aObserver" Reference to observer.
       
   510         */
       
   511         CTtsUtilityBody( MTtsClientUtilityObserver& aObserver );
       
   512         
       
   513         /**
       
   514         * By default Symbian 2nd phase constructor is private.
       
   515         */
       
   516         void ConstructL();
       
   517         
       
   518         // Prohibit copy constructor if not deriving from CBase.
       
   519         CTtsUtilityBody( const CTtsUtilityBody& );
       
   520         // Prohibit assigment operator if not deriving from CBase.
       
   521         CTtsUtilityBody& operator=( const CTtsUtilityBody& );
       
   522 
       
   523         /**
       
   524         * Utility function to open connection to controller plugin.
       
   525         *
       
   526         * @param "TUid aPluginUid" Plugin UID
       
   527         */
       
   528         void OpenControllerConnectionL( TUid aPluginUid );
       
   529 
       
   530         /**
       
   531         * Utility function to copy parsed text structure and convert style ids.
       
   532         *
       
   533         * @param "CTtsParsedText& aText" Parsed text which is copied
       
   534         */        
       
   535         void CopyParsedTextL( CTtsParsedText& aText );
       
   536 
       
   537         /**
       
   538         * Checks if there is an existing connection to some controller plugin
       
   539         * 
       
   540         * @return ETrue if there is an connection
       
   541         */
       
   542         TBool IsPluginOpen();
       
   543         
       
   544         /**
       
   545         * Stores priority settings but does not send them to the controller
       
   546         * plugin just yet.
       
   547         *
       
   548         * @param "TInt aPriority" Audio priority 
       
   549         * @param "TMdaPriorityPreference aPref" Audio preference
       
   550         */
       
   551         void StorePriority( TInt aPriority, TMdaPriorityPreference aPref );
       
   552         
       
   553         /**
       
   554         * Handles conversion from unicode to utf-8
       
   555         *
       
   556         * @param "const TDesC& aDes" Unicode descriptor
       
   557         * @return Pointer to created buffer, pushed to cleanupstack
       
   558         */
       
   559         HBufC8* ConvertToUtf8LC( const TDesC& aDes );
       
   560         
       
   561         /**
       
   562         * Adds data sink to controller according iUidOfDataSink and iOutputFile. 
       
   563         */
       
   564         void AddDataSinkL();
       
   565         
       
   566         /**
       
   567         * Responds that the correct plugin is loaded 
       
   568         *
       
   569         * @param "TTtsQuality aQuality" Synthesis quality parameter
       
   570         * @param "TLanguage aLanguage" Synthesis language
       
   571         * @param "const TTtsVoice& aVoice" Synthesis voice
       
   572         */
       
   573         void CheckAndLoadCorrectPluginL( TTtsQuality aQuality, TLanguage aLanguage, 
       
   574                                          const TTtsVoice& aVoice );
       
   575         
       
   576         /**
       
   577         * Tells if currently loaded plugin can handle synthesis with given parameters
       
   578         * 
       
   579         * @param "TLanguage aLanguage" Language to be used
       
   580         * @param "const TTtsVoice& aVoice" Voice to be used
       
   581         * @return ETrue if parameters are supported
       
   582         */
       
   583         TBool IsSupportedSpeaker( TLanguage aLanguage, const TTtsVoice& aVoice );
       
   584 
       
   585     private: // Data
       
   586 
       
   587         // Client side representation of controller plugin in use
       
   588         RMMFController iController;
       
   589 
       
   590         // Audio custom commands
       
   591         RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCommands;
       
   592         RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCommands;
       
   593         
       
   594         // Tts custom commands
       
   595         RTtsCustomCommands iTtsCustomCommands;
       
   596         
       
   597         // Pointer to controller event monitor
       
   598         CMMFControllerEventMonitor* iControllerEventMonitor;
       
   599         
       
   600         // Reference to observer
       
   601         MTtsClientUtilityObserver& iObserver;
       
   602         
       
   603         // Source and sink handle info
       
   604         TMMFMessageDestination iSourceHandle;
       
   605         TMMFMessageDestination iSinkHandle;
       
   606         
       
   607         // Duration of the current TTS "clip"
       
   608         TTimeIntervalMicroSeconds iDuration;
       
   609         
       
   610         // Latest read position of synthesising
       
   611         TTimeIntervalMicroSeconds iPosition;
       
   612         
       
   613         // Plugin priority settings.
       
   614         TMMFPrioritySettings iPrioritySettings;
       
   615 
       
   616         // Duration of current TTS 'clip'
       
   617         TTimeIntervalMicroSeconds iTime;
       
   618 
       
   619         // Registered styles, these will be kept in two places: locally
       
   620         // in TtsUtility and in TtsHwDevice in server side.
       
   621         RArray<TTtsStyle> iStyles;
       
   622 
       
   623         // Registered style IDs. (internal to TtsUtility)
       
   624         RArray<TTtsStyleID> iInternalStyleIDs;
       
   625 
       
   626         // Registered style IDs. (plugin id)
       
   627         RArray<TTtsStyleID> iControllerStyleIDs;
       
   628 
       
   629         // Increased numbering for style ids
       
   630         TTtsStyleID iCurrentStyleID;
       
   631 
       
   632         // Flag to tell if playback should be started immediately after priming
       
   633         // has finished.
       
   634         TBool iPlayImmediately;
       
   635 
       
   636         // Counter to tell how many times playback should be repeated.
       
   637         TInt iRepeats;
       
   638 
       
   639         // Trailing silence when repeating the playback
       
   640         TTimeIntervalMicroSeconds32 iTrailingSilence;
       
   641 
       
   642         // UID of controller plugin which has been created
       
   643         TUid iOpenPlugin;
       
   644         
       
   645         // Etrue if user has opened plugin by calling function OpenPluginL()
       
   646         TBool iPluginOpenedExplicitly;
       
   647     
       
   648         // Parsed text which is given to the controller plugin
       
   649         CTtsParsedText* iParsedText;
       
   650     
       
   651         // Default style structure
       
   652         TTtsStyle iDefaultStyle;
       
   653         
       
   654         // Uid of data sink to be used 
       
   655         TUid iUidOfDataSink;
       
   656         
       
   657         // Output file handle if data sink is set to file output
       
   658         RFile iFile;
       
   659     };
       
   660 
       
   661 #endif // TTSUTILITY_H   
       
   662 
       
   663 // End of File
       
   664 
       
   665 
       
   666