srsf/ttscontrollerplugin/src/ttspluginbody.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:  Class CTtsControllerPluginBody
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef TTSPLUGINBODY_H
       
    21 #define TTSPLUGINBODY_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <mmfcontroller.h>
       
    25 #include <nssdevtts.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CTtsControllerPlugin;
       
    29 class CTTSDataLoader;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 * Implementation class for Tts controller plugin.
       
    35 *
       
    36 * @lib TtsPlugin.lib
       
    37 * @since 2.8
       
    38 */
       
    39 class CTtsControllerPluginBody : public CActive, public MDevTTSObserver
       
    40     {
       
    41     public: // Constructors and destructor
       
    42         
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         */
       
    46         static CTtsControllerPluginBody* NewL( CTtsControllerPlugin* aObserver );
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CTtsControllerPluginBody();
       
    52         
       
    53     public: // New functions
       
    54         
       
    55         /**
       
    56         * Add a data source to the controller plugin.
       
    57         *
       
    58         *  @param "aDataSource"	"A reference to the data source to be added.
       
    59         *         The controller plugin may call <code>aDataSource.DataSourceType()
       
    60         *         <\code> to find out exactly what type of source it is."
       
    61         * @leave "" "The controller plugin may leave during this method.  
       
    62         *        If the controller plugin does not support the data source, it 
       
    63         *         should leave with <code>KErrNotSupported<\code>.
       
    64         */
       
    65         void AddDataSourceL( MDataSource& aDataSource );
       
    66         
       
    67         /**
       
    68         * Add a data sink to the controller plugin.
       
    69         *
       
    70         * @param "aDatasink" "A reference to the data sink to be added.
       
    71         *        The controller plugin may call <code>aDatasink.DatasinkType()
       
    72         *        <\code> to find out exactly what type of sink it is."
       
    73         * @leave "" "The controller plugin may leave during this method.
       
    74         *        If the controller plugin does not support the data sink, it 
       
    75         * should leave with <code>KErrNotSupported<\code>.
       
    76         */
       
    77         void AddDataSinkL( MDataSink& aDataSink );
       
    78         
       
    79         /**
       
    80         * Remove a data source from the controller plugin.
       
    81         *
       
    82         * @param "aDataSource" A reference to the data source to be removed.
       
    83         * @leave "" "The controller plugin may leave during this method.
       
    84         *        If the controller plugin does not support the removal of data 
       
    85         *        sources, it should leave with <code>KErrNotSupported<\code>.
       
    86         *        If the controller plugin leaves, the data source will not be 
       
    87         *        destroyed by the controller framework.  If it does not leave, 
       
    88         *        the data source will be destroyed.
       
    89         */
       
    90         void RemoveDataSourceL( MDataSource& aDataSource );
       
    91         
       
    92         /**
       
    93         * Remove a data sink from the controller plugin.
       
    94         *
       
    95         * @param "aDatasink" A reference to the data sink to be removed.
       
    96         * @leave "" "The controller plugin may leave during this method.
       
    97         * If the controller plugin does not support the removal of data sinks, 
       
    98         * it should leave with <code>KErrNotSupported<\code>. If the 
       
    99         * controller plugin leaves, the data sink will not be destroyed by 
       
   100         * the controller framework.  If it does not leave, the data sink
       
   101         * will be destroyed.
       
   102         */
       
   103         void RemoveDataSinkL( MDataSink& aDataSink );
       
   104         
       
   105         /**
       
   106         * Reset the controller plugin.
       
   107         *
       
   108         * The controller should revert back to its newly constructed state. If 
       
   109         * the Reset is successful (i.e. it doesn't leave), the controller 
       
   110         * framework will delete all objects added to the MMFObjectManager 
       
   111         * including any sources and sinks.
       
   112         *
       
   113         * @leave "" "The controller plugin may leave during this method.
       
   114         *        If the controller plugin does not support being reset, 
       
   115         *        it should leave with <code>KErrNotSupported<\code>."
       
   116         */
       
   117         void ResetL();
       
   118         
       
   119         /**
       
   120         * Prime the controller plugin.
       
   121         *
       
   122         * The controller must prepare to start playing, by initialising its 
       
   123         * sources, sinks and buffers. This moves the controller from the 
       
   124         * STOPPED to the PRIMED state.
       
   125         *
       
   126         * @leave "" "The controller plugin may leave during this method with
       
   127         * any of the standard system-wide error codes."
       
   128         */
       
   129         void PrimeL();
       
   130         
       
   131         /**
       
   132         * Commence playback.
       
   133         *
       
   134         * The controller must now begin transferring data from its source(s) 
       
   135         * to its sink(s). This moves the controller from the PRIMED to the 
       
   136         * PLAYING state.
       
   137         *
       
   138         * Note: this method must return once playing has commenced, and not 
       
   139         * wait until playing is complete.
       
   140         *
       
   141         * @leave "" "The controller plugin may leave during this method with 
       
   142         *        any of the standard system-wide error codes."
       
   143         */
       
   144         void PlayL();
       
   145         
       
   146         /**
       
   147         * Pause the controller plugin.
       
   148         *
       
   149         * The controller must now cease transferring data from its source(s) 
       
   150         * to its sink(s). This moves the controller from the PLAYING back to 
       
   151         * the PRIMED state.
       
   152         *
       
   153         * A subsequent call to <code>Play()<\code> will cause the controller 
       
   154         * plugin to resume playback from the point it was paused (unless 
       
   155         * there has been a call to <code>SetPosition()<\code> in the meantime.
       
   156         *
       
   157         * @leave "" "The controller plugin may leave during this method with 
       
   158         *        any of the standard system-wide error codes."
       
   159         */
       
   160         void PauseL();
       
   161         
       
   162         /**
       
   163         * Stop the controller plugin.
       
   164         *
       
   165         * The controller must now undo anything that occurred during the call 
       
   166         * to <code>Prime()<\code>. This moves the controller from the PRIMED 
       
   167         * back to the STOPPED state.
       
   168         *
       
   169         * @leave "" "The controller plugin may leave during this method with 
       
   170         *        any of the standard system-wide error codes."
       
   171         */
       
   172         void StopL();
       
   173         
       
   174         /**
       
   175         * Get the current position.
       
   176         *
       
   177         * The controller plugin should calculate the current position in microseconds.
       
   178         *
       
   179         * @return "The current position in microseconds."
       
   180         * @leave "" "The controller plugin may leave during this method with 
       
   181         *        any of the standard system-wide error codes."
       
   182         */
       
   183         TTimeIntervalMicroSeconds PositionL() const;
       
   184         
       
   185         /**
       
   186         * Set the current position.
       
   187         *
       
   188         * The controller plugin should reposition itself to the position provided.
       
   189         *
       
   190         * @param "The desired position in microseconds."
       
   191         * @leave "" "The controller plugin may leave during this method with
       
   192         *         any of the standard system-wide error codes."
       
   193         */
       
   194         void SetPositionL( const TTimeIntervalMicroSeconds& aPosition );
       
   195         
       
   196         /**
       
   197         * Get the duration of the clip.
       
   198         *
       
   199         * The controller plugin should calculate the clip duration in microseconds.
       
   200         *
       
   201         * @return "The clip duration in microseconds."
       
   202         * @leave "" "The controller plugin may leave during this method with
       
   203         *         any of the standard system-wide error codes."
       
   204         */
       
   205         TTimeIntervalMicroSeconds DurationL() const;
       
   206         
       
   207         /**
       
   208         * Set the priority settings.
       
   209         *
       
   210         * The new priority settings must be applied to any resource being used 
       
   211         * by the controller plugin that requires priority settings (for example 
       
   212         * the sound device).
       
   213         *
       
   214         * @param "aPrioritySettings" "The new priority settings"
       
   215         */
       
   216         void SetPrioritySettings( const TMMFPrioritySettings& aPrioritySettings );
       
   217         
       
   218         /**
       
   219         * Handle a custom command.
       
   220         *
       
   221         * Custom commands allow a controller plugin to define its own API.
       
   222         * If the controller framework does not understand a message from the 
       
   223         * client, it is assumed this is a custom command for the plugin and 
       
   224         * passed into this interface.
       
   225         *
       
   226         * The more common custom commands can be handled by Custom Command 
       
   227         * Parsers on behalf of the controller plugin.  This allows the 
       
   228         * controller plugin to implement a concrete interface (defined by 
       
   229         * mixin classes) rather than having to decode the command itself.
       
   230         * For more information, @see CMMFCustomCommandParserBase.
       
   231         *
       
   232         * The controller plugin must always complete the message passed 
       
   233         * into this method, even if it does not support the interface 
       
   234         * required by the message.
       
   235         *
       
   236         * @param "aMessage" "The message to be handled by the controller plugin."
       
   237         */
       
   238         void CustomCommand( TMMFMessage& aMessage );
       
   239         
       
   240         /**
       
   241         * Retrieve the number of meta data entries in the clip.
       
   242         *
       
   243         * @param "aNumberOfEntries" "The controller plugin must set this to 
       
   244         * the number of meta data entries in the clip."
       
   245         *
       
   246         * @leave "" "The controller plugin may leave during this method with 
       
   247         *        any of the standard system-wide error codes."
       
   248         */
       
   249         void GetNumberOfMetaDataEntriesL( TInt& aNumberOfEntries );
       
   250         
       
   251         /**
       
   252         * Retrieve a meta data entry from the clip.
       
   253         *
       
   254         * @param "aIndex" "The index of the meta data entry to retrieve."
       
   255         * @return "A pointer to a newly created CMMFMetaDataEntry object 
       
   256         *         containing the meta information. The controller framework 
       
   257         *         will take ownership of the object when this method returns."
       
   258         * @leave "" "The controller plugin may leave during this method with 
       
   259         *        any of the standard system-wide error codes."
       
   260         */
       
   261         CMMFMetaDataEntry* GetMetaDataEntryL( TInt aIndex );
       
   262 
       
   263        
       
   264     public: // MMMFAudioControllerCustomCommandImplementor
       
   265         
       
   266         /**
       
   267         Set the sample rate of the data source in samples per second.
       
   268         @param	"aSampleRate"	"The sample rate, in samples per second."
       
   269         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   270         completed with the leave code."
       
   271         @since 7.0s
       
   272         */
       
   273         virtual void MacSetSourceSampleRateL(TUint aSampleRate);
       
   274         
       
   275         /**
       
   276         Set the bit rate of the data source in bits per second.
       
   277         @param	"aSampleRate"	"The bit rate, in bits per second."
       
   278         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   279         completed with the leave code."
       
   280         @since 7.0s
       
   281         */
       
   282         virtual void MacSetSourceBitRateL(TUint aBitRate);
       
   283         
       
   284         /**
       
   285         Set the number of channels in the data source.
       
   286         For example, one channel for mono, two channels for stereo etc.
       
   287         @param	"aNumChannels"	"The number of channels."
       
   288         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   289         completed with the leave code."
       
   290         @since 7.0s
       
   291         */
       
   292         virtual void MacSetSourceNumChannelsL(TUint aNumChannels);
       
   293         
       
   294         /**
       
   295         Set the format of the data source.  
       
   296         The UID corresponds to the uid of the CMMFFormat-derived ECOM plugin to be used.
       
   297         @param	"aFormatUid"	"The format plugin to be used."
       
   298         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   299         completed with the leave code."
       
   300         @since 7.0s
       
   301         */
       
   302         virtual void MacSetSourceFormatL(TUid aFormatUid);
       
   303         
       
   304         /**
       
   305         Set the fourCC code of the source.
       
   306         @param	"aDataType"	"The fourCC code."
       
   307         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   308         completed with the leave code."
       
   309         @since 7.0s
       
   310         */
       
   311         virtual void MacSetSourceDataTypeL(TFourCC aDataType);
       
   312         
       
   313         /**
       
   314         Set the sample rate of the data sink in samples per second.
       
   315         @param	"aSampleRate"	"The sample rate, in samples per second."
       
   316         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   317         completed with the leave code."
       
   318         @since 7.0s
       
   319         */
       
   320         virtual void MacSetSinkSampleRateL(TUint aSampleRate);
       
   321         
       
   322         /**
       
   323         Set the bit rate of the data sink in bits per second.
       
   324         @param	"aSampleRate"	"The bit rate, in bits per second."
       
   325         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   326         completed with the leave code."
       
   327         @since 7.0s
       
   328         */
       
   329         virtual void MacSetSinkBitRateL(TUint aRate);
       
   330         
       
   331         /**
       
   332         Set the number of channels in the data sink.
       
   333         For example, one channel for mono, two channels for stereo etc.
       
   334         @param	"aNumChannels"	"The number of channels."
       
   335         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   336         completed with the leave code."
       
   337         @since 7.0s
       
   338         */
       
   339         virtual void MacSetSinkNumChannelsL(TUint aNumChannels);
       
   340         
       
   341         /**
       
   342         Set the format of the data sink.  
       
   343         The UID corresponds to the uid of the CMMFFormat-derived ECOM plugin to be used.
       
   344         @param	"aFormatUid"	"The format plugin to be used."
       
   345         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   346         completed with the leave code."
       
   347         @since 7.0s
       
   348         */
       
   349         virtual void MacSetSinkFormatL(TUid aFormatUid);
       
   350         
       
   351         /**
       
   352         Set the fourCC code of the sink.
       
   353         @param	"aDataType"	"The fourCC code."
       
   354         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   355         completed with the leave code."
       
   356         @since 7.0s
       
   357         */
       
   358         virtual void MacSetSinkDataTypeL(TFourCC aDataType);
       
   359         
       
   360         /**
       
   361         Set the codec to be used.  Useful when recording data.
       
   362         @param	"aSourceDataType"	"The data type of the source of the codec."
       
   363         @param	"aSinkDataType"		"The data type of the sink of the codec."
       
   364         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   365         completed with the leave code."
       
   366         @since 7.0s
       
   367         */
       
   368         virtual void MacSetCodecL(TFourCC aSourceDataType, TFourCC aSinkDataType);
       
   369         
       
   370         
       
   371         /**
       
   372         Get the sample rate of the data source in samples per second.
       
   373         @param	"aRate"	"The sample rate, in samples per second."
       
   374         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   375         completed with the leave code."
       
   376         @since 7.0s
       
   377         */
       
   378         virtual void MacGetSourceSampleRateL(TUint& aRate);
       
   379         
       
   380         /**
       
   381         Get the bit rate of the data source in bits per second.
       
   382         @param	"aRate"	"The bit rate, in bits per second."
       
   383         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   384         completed with the leave code."
       
   385         @since 7.0s
       
   386         */
       
   387         virtual void MacGetSourceBitRateL(TUint& aRate);
       
   388         
       
   389         /**
       
   390         Get the number of channels in the data source.
       
   391         For example, one channel for mono, two channels for stereo etc.
       
   392         @param	"aNumChannels"	"The number of channels."
       
   393         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   394         completed with the leave code."
       
   395         @since 7.0s
       
   396         */
       
   397         virtual void MacGetSourceNumChannelsL(TUint& aNumChannels);
       
   398         
       
   399         /**
       
   400         Get the format of the data source.  
       
   401         The UID corresponds to the uid of the CMMFFormat-derived ECOM plugin being used.
       
   402         @param	"aFormatUid"	"The format plugin being used."
       
   403         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   404         completed with the leave code."
       
   405         @since 7.0s
       
   406         */
       
   407         virtual void MacGetSourceFormatL(TUid& aFormat);
       
   408         
       
   409         /**
       
   410         Get the fourCC code of the source.
       
   411         @param	"aDataType"	"The fourCC code."
       
   412         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   413         completed with the leave code."
       
   414         @since 7.0s
       
   415         */
       
   416         virtual void MacGetSourceDataTypeL(TFourCC& aDataType);
       
   417         
       
   418         /**
       
   419         Get the sample rate of the data sink in samples per second.
       
   420         @param	"aRate"	"The sample rate, in samples per second."
       
   421         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   422         completed with the leave code."
       
   423         @since 7.0s
       
   424         */
       
   425         virtual void MacGetSinkSampleRateL(TUint& aRate);
       
   426         
       
   427         /**
       
   428         Get the bit rate of the data sink in bits per second.
       
   429         @param	"aRate"	"The bit rate, in bits per second."
       
   430         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   431         completed with the leave code."
       
   432         @since 7.0s
       
   433         */
       
   434         virtual void MacGetSinkBitRateL(TUint& aRate);
       
   435         
       
   436         /**
       
   437         Get the number of channels in the data sink.
       
   438         For example, one channel for mono, two channels for stereo etc.
       
   439         @param	"aNumChannels"	"The number of channels."
       
   440         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   441         completed with the leave code."
       
   442         @since 7.0s
       
   443         */
       
   444         virtual void MacGetSinkNumChannelsL(TUint& aNumChannels);
       
   445         
       
   446         /**
       
   447         Get the format of the data sink.  
       
   448         The UID corresponds to the uid of the CMMFFormat-derived ECOM plugin being used.
       
   449         @param	"aFormatUid"	"The format plugin being used."
       
   450         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   451         completed with the leave code."
       
   452         @since 7.0s
       
   453         */
       
   454         virtual void MacGetSinkFormatL(TUid& aFormat);
       
   455         
       
   456         /**
       
   457         Get the fourCC code of the sink.
       
   458         @param	"aDataType"	"The fourCC code."
       
   459         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   460         completed with the leave code."
       
   461         @since 7.0s
       
   462         */
       
   463         virtual void MacGetSinkDataTypeL(TFourCC& aDataType);
       
   464         
       
   465         
       
   466         /**
       
   467         Get the list of sample rates supported by the data source.
       
   468         @param	"aSupportedRates"	"The supported rates.  Warning: Existing objects in this array will be removed by this method."
       
   469         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   470         completed with the leave code."
       
   471         @since 7.0s
       
   472         */
       
   473         virtual void MacGetSupportedSourceSampleRatesL(RArray<TUint>& aSupportedRates);
       
   474         
       
   475         /**
       
   476         Get the list of bit rates supported by the data source.
       
   477         @param	"aSupportedRates"	"The supported rates.  Warning: Existing objects in this array will be removed by this method."
       
   478         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   479         completed with the leave code."
       
   480         @since 7.0s
       
   481         */
       
   482         virtual void MacGetSupportedSourceBitRatesL(RArray<TUint>& aSupportedRates);
       
   483         
       
   484         /**
       
   485         Get the list of channels supported by the data source L(ie mono, stereo etc).
       
   486         @param	"aSupportedChannels"	"The supported channels.  Warning: Existing objects in this array will be removed by this method."
       
   487         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   488         completed with the leave code."
       
   489         @since 7.0s
       
   490         */
       
   491         virtual void MacGetSupportedSourceNumChannelsL(RArray<TUint>& aSupportedChannels);
       
   492         
       
   493         /**
       
   494         Get the list of fourCC codes supported by the data source.
       
   495         @param	"aSupportedDataTypes"	"The supported data types.  Warning: Existing objects in this array will be removed by this method."
       
   496         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   497         completed with the leave code."
       
   498         @since 7.0s
       
   499         */
       
   500         virtual void MacGetSupportedSourceDataTypesL(RArray<TFourCC>& aSupportedDataTypes);
       
   501         
       
   502         /**
       
   503         Get the list of sample rates supported by the data sink.
       
   504         @param	"aSupportedRates"	"The supported rates.  Warning: Existing objects in this array will be removed by this method."
       
   505         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   506         completed with the leave code."
       
   507         @since 7.0s
       
   508         */
       
   509         virtual void MacGetSupportedSinkSampleRatesL(RArray<TUint>& aSupportedRates);
       
   510         
       
   511         /**
       
   512         Get the list of bit rates supported by the data sink.
       
   513         @param	"aSupportedRates"	"The supported rates.  Warning: Existing objects in this array will be removed by this method."
       
   514         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   515         completed with the leave code."
       
   516         @since 7.0s
       
   517         */
       
   518         virtual void MacGetSupportedSinkBitRatesL(RArray<TUint>& aSupportedRates);
       
   519         
       
   520         /**
       
   521         Get the list of channels supported by the data sink L(ie mono, stereo etc).
       
   522         @param	"aSupportedChannels"	"The supported channels.  Warning: Existing objects in this array will be removed by this method."
       
   523         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   524         completed with the leave code."
       
   525         @since 7.0s
       
   526         */
       
   527         virtual void MacGetSupportedSinkNumChannelsL(RArray<TUint>& aSupportedChannels);
       
   528         
       
   529         /**
       
   530         Get the list of fourCC codes supported by the data sink.
       
   531         @param	"aSupportedDataTypes"	"The supported data types.  Warning: Existing objects in this array will be removed by this method."
       
   532         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   533         completed with the leave code."
       
   534         @since 7.0s
       
   535         */
       
   536         virtual void MacGetSupportedSinkDataTypesL(RArray<TFourCC>& aSupportedDataTypes);
       
   537 
       
   538 
       
   539     public: // From MMMFAudioPlayDeviceCustomCommandImplementor
       
   540 
       
   541         /**
       
   542         Set the volume of the sound device.
       
   543         @param	"aVolume"	"The new volume"
       
   544         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   545         completed with the leave code."
       
   546         @since 7.0s
       
   547         */
       
   548         virtual void MapdSetVolumeL(TInt aVolume);
       
   549         
       
   550         /**
       
   551         Get the maximum volume supported by the sound device.
       
   552         @param	"aMaxVolume"	"The maximum volume, to be filled in by the controller plugin."
       
   553         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   554         completed with the leave code."
       
   555         @since 7.0s
       
   556         */
       
   557         virtual void MapdGetMaxVolumeL(TInt& aMaxVolume);
       
   558         
       
   559         /**
       
   560         Get the current playback volume.
       
   561         @param	"aVolume"	"The volume, to be filled in by the controller."
       
   562         @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   563         completed with the leave code."
       
   564         @since 7.0s
       
   565         */
       
   566         virtual void MapdGetVolumeL(TInt& aVolume);
       
   567         
       
   568         /**
       
   569         * Set a volume ramp.
       
   570         *
       
   571         * This will cause the sound device to start playing with zero volume,
       
   572         * increasing the volume over aRampDuration microseconds.
       
   573         *
       
   574         * The volume ramp can be removed by setting the ramp duration to zero.
       
   575         *
       
   576         * @param "aRampDuration" "The duration over which the volume is to be 
       
   577         *                        increased, in microseconds."
       
   578         * @leave "This function can leave with one of the system-wide error codes. 
       
   579         *        The request will be completed with the leave code."
       
   580         */
       
   581         virtual void MapdSetVolumeRampL( const TTimeIntervalMicroSeconds& aRampDuration );
       
   582         
       
   583         /**
       
   584         Set the balance between the left and right stereo audio channels.
       
   585         
       
   586           @param	"aBalance"	"Use a value between <code>KMMFBalanceMaxLeft<\code> and 
       
   587           <code>KMMFBalanceMaxRight<\code>. Centre balance can be restored by using
       
   588           <code>KMMFBalanceCenter<\code>."
       
   589           @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   590           completed with the leave code."
       
   591           @since 7.0s
       
   592         */
       
   593         virtual void MapdSetBalanceL(TInt aBalance);
       
   594         
       
   595         /**
       
   596         Retrieve the balance between the left and right stereo audio channels.
       
   597         
       
   598           @param	"aBalance"	"The current balance, filled in by the controller."
       
   599           @leave	"This function can leave with one of the system-wide error codes. The request will be
       
   600           completed with the leave code."
       
   601           @since 7.0s
       
   602         */
       
   603         virtual void MapdGetBalanceL(TInt& aBalance);
       
   604 
       
   605     public: // Functions from MTtsCustomCommandImplementor
       
   606 
       
   607         /**
       
   608         * Adds a new style.
       
   609         *
       
   610         * @param "TTtsStyle& aStyle" Style to add.
       
   611         * @return Style identifier.
       
   612         */
       
   613         TTtsStyleID MttscAddStyleL( const TTtsStyle& aStyle );
       
   614 
       
   615         /**
       
   616         * Deletes a style based on style ID.
       
   617         *
       
   618         * @param "TTtsStyleID aID" Style ID to be deleted.
       
   619         * @return Error code.
       
   620         */
       
   621         TInt MttscDeleteStyle( TTtsStyleID aID );
       
   622 
       
   623         /**
       
   624         * Gets the synthesis position.
       
   625         *
       
   626         * @retval "TInt& aWordIndex" Returned position of synthesis.
       
   627         */
       
   628         void MttscGetPositionL( TInt& aWordIndex );
       
   629 
       
   630         /**
       
   631         * Returns the number of registered styles.
       
   632         *
       
   633         * @return Number of styles.
       
   634         */
       
   635         TUint16 MttscNumberOfStyles();
       
   636 
       
   637         /**
       
   638         * Opens parsed text as source.
       
   639         *
       
   640         * @param "CTtsParsedText& aText" Reference to parsed text.
       
   641         */
       
   642         void MttscOpenParsedTextL( CTtsParsedText& aText );
       
   643 
       
   644         /**
       
   645         * Sets the synthesis position based on word index.
       
   646         *
       
   647         * @param "TInt aWordIndex" Word index.
       
   648         */
       
   649         void MttscSetPositionL( TInt aWordIndex );
       
   650 
       
   651         /**
       
   652         * Returns the style based on ID.
       
   653         *
       
   654         * @param "TTtsStyleID aStyleID" Style ID.
       
   655         * @return Reference to style object.
       
   656         */
       
   657         TTtsStyle& MttscStyleL( TTtsStyleID aStyleID );
       
   658 
       
   659         /**
       
   660         * Returns the style based on index.
       
   661         *
       
   662         * @param "TUint16 aIndex" Style index.
       
   663         * @return Reference to style object.
       
   664         */
       
   665         TTtsStyle& MttscStyleL( TUint16 aIndex );
       
   666         
       
   667         /**
       
   668         * Sets the default style parameters for synthesis.
       
   669         *
       
   670         * @param "const TTtsStyle& aStyle" Style created by the client
       
   671         */        
       
   672         void MttscSetDefaultStyleL( const TTtsStyle& aStyle );
       
   673         
       
   674         /**
       
   675         * Returns the registered default style
       
   676         *
       
   677         * @return Style reference
       
   678         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
   679         */
       
   680         TTtsStyle& MttscDefaultStyleL();
       
   681         
       
   682         /**
       
   683         * Sets the speaking rate of synthesizer.
       
   684         *
       
   685         * @param TInt aRate Speaking rate value
       
   686         * @leave KErrNotSupported if synthesizer does not support speaking rate setting
       
   687         */        
       
   688         void MttscSetSpeakingRateL( TInt aRate );
       
   689         
       
   690         /**
       
   691         * Returns the current speaking rate value.
       
   692         *
       
   693         * @return Speaking rate value
       
   694         * @leave KErrNotSupported if synthesizer does not support speaking rate setting
       
   695         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
   696         */
       
   697         TInt MttscSpeakingRateL();
       
   698       
       
   699         /**
       
   700         * Returns the list of supported languages.
       
   701         * 
       
   702         * @param "RArray<TLanguage>& aLanguages" Output parameter which contains 
       
   703         *        the languages
       
   704         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
   705         */
       
   706         void MttscGetSupportedLanguagesL( RArray<TLanguage>& aLanguages );
       
   707         
       
   708         /**
       
   709         * Returns the list of supported voices for a certain language.
       
   710         * 
       
   711         * @param "TLanguage aLanguage" Language
       
   712         * @param "RArray<TTtsStyle>& aVoices" Output parameter which contains the voices
       
   713         * @leave KErrNotReady if no plugin is loaded to handle the function call
       
   714         */        
       
   715         void MttscGetSupportedVoicesL( TLanguage aLanguage, RArray<TTtsStyle>& aVoices );
       
   716 
       
   717     public: // Functions from MDevTTSObserver
       
   718 
       
   719         /**
       
   720         * Invoked by DevTTS when it needs a configuration data package.
       
   721         * TODO: Add start and endpoint parameters.
       
   722         *
       
   723         * @param "TUint32 aPackageType"
       
   724         *         Packege type identifier
       
   725         * @param "TUint32 aPackageID"
       
   726         *         Package identifier
       
   727         *
       
   728         * @return Pointer to created data buffer. NULL if failure. User must 
       
   729         *         take care of the buffer deletion after usage.
       
   730         */
       
   731         HBufC8* MdtoConfigurationData( TUint32 aPackageType, 
       
   732                                        TUint32 aPackageID, 
       
   733                                        TUint32 aStartPosition, 
       
   734                                        TUint32 aEndPosition );
       
   735         
       
   736         /**
       
   737         * Called by DevTTS when an event occured. EDevTTSEventComplete is the only
       
   738         * event that can happen currently.
       
   739         *
       
   740         * @param "TDevTTSEvent aEvent"
       
   741         *         Event code
       
   742         * @param "TInt aStatus"
       
   743         *         Error code. KErrNone if success, one of the system level
       
   744         *         error codes otherwise.
       
   745         */
       
   746         void MdtoEvent( TDevTTSEvent aEvent, TInt aStatus );
       
   747         
       
   748         /**
       
   749         * Called by DevTTS device when output mode is EDevTTSClientMode and a 
       
   750         * new audio buffer has been filled by the synthesizer. 
       
   751         *
       
   752         * @param "TDesC8& aBuffer"
       
   753         *         Synthesized audio buffer.
       
   754         */
       
   755         void MdtoProcessBuffer( const TDesC8& aBuffer );
       
   756         
       
   757     protected:
       
   758         /**
       
   759         * CActive::RunL
       
   760         */
       
   761         void RunL();
       
   762 
       
   763         /**
       
   764         * CActive::DoCancel()
       
   765         */
       
   766         void DoCancel();
       
   767 
       
   768         /**
       
   769         * Handles play asynchrnously
       
   770         */
       
   771         void HandlePlay();
       
   772 
       
   773         /**
       
   774         * Activates this active object.
       
   775         */ 
       
   776         void Ready();
       
   777 
       
   778     private:
       
   779         
       
   780         /**
       
   781         * C++ default constructor.
       
   782         */
       
   783         CTtsControllerPluginBody( CTtsControllerPlugin* aObserver );
       
   784         
       
   785         /**
       
   786         * By default Symbian 2nd phase constructor is private.
       
   787         */
       
   788         void ConstructL();
       
   789         
       
   790         // Prohibit copy constructor.
       
   791         CTtsControllerPluginBody( const CTtsControllerPluginBody& );
       
   792         // Prohibit assigment operator.
       
   793         CTtsControllerPluginBody& operator=( const CTtsControllerPluginBody& );
       
   794 
       
   795         /**
       
   796         * Copies descriptor to parsed text with default style.
       
   797         */
       
   798         void ConstructParsedTextL( TDes8& aBufferPtr );
       
   799 
       
   800         /**
       
   801         * Copies parsed text structure to iParsedTextPointer.
       
   802         * Deletes previous if exists
       
   803         */
       
   804         void CopyParsedTextL( CTtsParsedText& aText );
       
   805         
       
   806         /**
       
   807         * Does priming from AddDataSource
       
   808         */
       
   809         void DoEarlyPrimingL();
       
   810 
       
   811     private:    // Data
       
   812 
       
   813         // TTP data loader, owned
       
   814         CTTSDataLoader*         iTtsLoader;
       
   815 
       
   816         // Pointer to the DevTTS, owned
       
   817         CDevTTS*                iDevTts;
       
   818 
       
   819         // Pointer to 'opened' parsed text object, owned
       
   820         CTtsParsedText*         iParsedTextPointer;
       
   821 
       
   822         // Observer, not owned.
       
   823         CTtsControllerPlugin*   iObserver;
       
   824 
       
   825         // Requested asynchronous function.
       
   826         TInt                    iRequestFunction;
       
   827 
       
   828         // Default style which will be used if no OpenParsedText is used
       
   829         TTtsStyle               iDefaultStyle;
       
   830 
       
   831         // Style ID of default style
       
   832         TTtsStyleID             iDefaultStyleID;
       
   833         
       
   834         // Tells if priming has been done already in AddDataSource
       
   835         TBool                   iEarlyPrimingDone;
       
   836         
       
   837         // ETrue if MttscSetDefaultStyleL() called
       
   838         TBool                   iUserSpecifiedDefaultStyle;
       
   839         
       
   840         // Output is currently either file or loudspeaker
       
   841         TDevTTSOutputMode       iTtsOutputMode;
       
   842         
       
   843         // File server session
       
   844         RFs                     iFs;
       
   845         
       
   846         // Handle to the output file, not owned. 
       
   847         RFile*                  iOutputFile;
       
   848         
       
   849         // Drive number (according TDriveNumber) where file handle is pointing
       
   850         TInt                    iOutFileDriveNumber;
       
   851         
       
   852         };
       
   853 
       
   854 #endif // TTSPLUGINBODY_H   
       
   855 
       
   856 // End of File
       
   857