audiostubs/devsoundextensions_stubs/mmfdevsoundadaptation_stub/inc/MmfDevSoundAdaptation.h
changeset 43 e71858845f73
parent 40 b7e5ed8c1342
child 46 e1758cbb96ac
equal deleted inserted replaced
40:b7e5ed8c1342 43:e71858845f73
     1 /*
       
     2 * Copyright (c) 2006 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: Audio Stubs -  Implementation of the MMF DevSound Server adaptation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MMFDEVSOUNDADAPTATION_H
       
    20 #define MMFDEVSOUNDADAPTATION_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <sounddevice.h>
       
    24 
       
    25 // CLASS DECLARATION
       
    26 
       
    27 /**
       
    28 An interface to a set of DevSound adaptation observer callback functions.
       
    29 
       
    30 This serves as the method of communication between the client and the
       
    31 DevSound.
       
    32 
       
    33 The class is a mixin and is intended to be inherited by the client class
       
    34 that is interested in observing the DevSound operation. The functions
       
    35 encapsulated by this class are called when specific events occur in the
       
    36 process of initializing and playing/recording an audio sample or playing
       
    37 tones.
       
    38 */
       
    39 class MDevSoundAdaptationObserver
       
    40     {
       
    41 public:
       
    42     /**
       
    43     Handles initialization completion event.
       
    44 
       
    45     A derived class must provide an implementation to handle the initialization
       
    46     request.
       
    47 
       
    48     CMMFDevSound object calls this function when its InitializeL() function
       
    49     completes.
       
    50 
       
    51     @param  aError
       
    52             Error code. KErrNone if successful. Other values are possible
       
    53             indicating a problem initializing CMMFDevSound object.
       
    54     */
       
    55     virtual void InitializeComplete(TInt aError)=0;
       
    56 
       
    57     /**
       
    58     Handles tone play completion event.
       
    59 
       
    60     A derived class must provide an implementation to handle the tone play
       
    61     completion request.
       
    62 
       
    63     CMMFDevSound object calls this function when an attempt to play tone has
       
    64     completed, successfully or otherwise.
       
    65 
       
    66     The following are the play tone functions; PlayToneL(), PlayDMTFStringL(),
       
    67     PlayToneSequenceL(), and PlayFixedSequenceL().
       
    68 
       
    69     @param  aError
       
    70             Error code. The status of tone playback. KErrUnderflow playing of
       
    71             the tone is complete. KErrAccessDenied the sound device is in use by
       
    72             another higher priority client. KErrCancel playing of the audio
       
    73             sample is stopped by DevSound client another higher priority client.
       
    74     */
       
    75     virtual void ToneFinished(TInt aError)=0;
       
    76 
       
    77     /**
       
    78     Handles CMMFDevSound object's data request event.
       
    79 
       
    80     A derived class must provide an implementation to supply CMMFDevSound
       
    81     object the data that it needs to play.
       
    82 
       
    83     CMMFDevSound object calls this function when and where it needs data for
       
    84     playing. The observer should notify CMMFDevSound object as
       
    85     quickly as possible after the data is read into buffer, aBuffer by calling
       
    86     PlayData(), otherwise the implementation might callback function PlayError()
       
    87     on derived class object with error code KErrUnderflow.
       
    88     This does not apply to the very first call to PlayData(), however.
       
    89     It is possible for a user of DevSound to hold the first buffer sent in
       
    90     BufferToBeFilled() until ready to play.
       
    91     The use case for this is if a low latency audio response
       
    92     is required, as at this point all the resources used to play audio are open.
       
    93     If used in this way then it is important to be aware that when when the
       
    94     resources for audio are ready at the BufferToBeFilled() callback, a Devsound
       
    95     on a real device will be running at increased power consumption as the audio
       
    96     hw and any required DSPs will be powered up etc.
       
    97 
       
    98     @param  aBuffer
       
    99             Buffer into which data should be read. The amount of data that is
       
   100             needed is specified in CMMFBuffer::RequestSize().
       
   101     */
       
   102     virtual void BufferToBeFilled(CMMFBuffer* aBuffer)=0;
       
   103 
       
   104     /**
       
   105     Handles play completion or cancel event.
       
   106 
       
   107     A derived class must provide an implementation to handle the play
       
   108     completion or cancel request.
       
   109 
       
   110     CMMFDevSound object calls this function when an attempt to play audio sample
       
   111     has completed, successfully or otherwise.
       
   112 
       
   113     @param  aError
       
   114             Error code. The status of playback. KErrUnderflow playing of the
       
   115             audio sample is complete. KErrAccessDenied the sound device is in
       
   116             use by another higher priority client.
       
   117     */
       
   118     virtual void PlayError(TInt aError)=0;
       
   119 
       
   120     /**
       
   121     Handles CMMFDevSound object's data request event.
       
   122 
       
   123     A derived class must provide an implementation to process the data
       
   124     supplied by CMMFDevSound object while recording.
       
   125 
       
   126     CMMFDevSound object calls this function when the buffer, aBuffer gets filled
       
   127     while recording. The observer should notify CMMFDevSound
       
   128     object as quickly as possible after data in the buffer is processed by
       
   129     calling RecordData(), otherwise the implementation might callback
       
   130 	the function RecordError() on derived class object with error code
       
   131 	KErrOverflow.
       
   132 
       
   133     @param  aBuffer
       
   134             Buffer containing processed (recorded) data. The amount
       
   135             of data that is available is specified in CMMFBuffer::RequestSize().
       
   136     */
       
   137     virtual void BufferToBeEmptied(CMMFBuffer* aBuffer)=0;
       
   138 
       
   139     /**
       
   140     Handles record completion or cancel event.
       
   141 
       
   142     A derived class must provide an implementation to handle the record
       
   143     completion or cancel request.
       
   144 
       
   145 	CMMFDevSound object calls this function when an attempt to record audio
       
   146 	sample has completed, successfully or otherwise.
       
   147 
       
   148     @param  aError
       
   149             Error code. The status of recording. KErrOverflow audio devices
       
   150             runs out of internal buffer. KErrAccessDenied the sound device is
       
   151             in use by another higher priority client.
       
   152     */
       
   153     virtual void RecordError(TInt aError)=0;
       
   154 
       
   155     /**
       
   156     Handles device event.
       
   157 
       
   158     A derived class must provide an implementtion to handle the messages from
       
   159     audio hardware device.
       
   160 
       
   161     CMMFDevSound object calls this function when a message is received from the
       
   162     audio hardware device.
       
   163 
       
   164     @param  aMessageType
       
   165             Defines the type of message. Used to determine how to
       
   166             interpret the contents of aMsg.
       
   167     @param  aMsg
       
   168             Message that is packed in the Descriptor format.
       
   169     */
       
   170     virtual void DeviceMessage(TUid aMessageType, const TDesC8& aMsg)=0;
       
   171 
       
   172     };
       
   173 
       
   174 
       
   175 /**
       
   176 *  A class representing client application information.
       
   177 *
       
   178 *  @lib MmfDevSoundAdaptation.lib
       
   179 *  @since S60 3.0
       
   180 */
       
   181 class TMMFClientConfig
       
   182     {
       
   183     public:
       
   184         TVendorId           iVendorId;     // Application Vendor Id
       
   185         TSecureId           iSecureId;     // Application Secure Id
       
   186         TProcessId          iProcessId;    // Application Process Id
       
   187         RArray<TCapability> iCapabilities; // Application capabilities array
       
   188     };
       
   189 
       
   190 // CLASS DECLARATION
       
   191 
       
   192 /**
       
   193 * This class implements DevSound behavior in a hardware independent way.
       
   194 *
       
   195 *  @lib MmfDevSoundAdaptation.lib
       
   196 *  @since S60 3.0
       
   197 */
       
   198 class CMMFDevSoundAdaptation : public CBase
       
   199     {
       
   200 
       
   201     public:  // Constructors and destructor
       
   202 
       
   203         /**
       
   204         * Constructs, and returns a pointer to, a new CMMFDevSoundAdaptation
       
   205         * object.
       
   206         * Leaves on failure..
       
   207         * @param RServer2& aPolicyServerHandle A handle to policy server.
       
   208         * @return CMMFDevSoundAdaptation* A pointer to newly created object.
       
   209         */
       
   210         IMPORT_C static CMMFDevSoundAdaptation* NewL(
       
   211                         RServer2& aPolicyServerHandle);
       
   212 
       
   213         /**
       
   214         * Destructor.
       
   215         */
       
   216         IMPORT_C virtual ~CMMFDevSoundAdaptation();
       
   217 
       
   218     public: // New functions
       
   219 
       
   220         /**
       
   221         * Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
       
   222         * On completion of Initialization, calls InitializeComplete() on
       
   223         * aDevSoundObserver.
       
   224         * Leaves on failure.
       
   225         * @since S60 3.0
       
   226         * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to
       
   227         *        the DevSound Observer instance.
       
   228         * @param TMMFState aMode Mode for which this object will be used.
       
   229         * @return void
       
   230         */
       
   231         IMPORT_C void InitializeL(
       
   232                       MDevSoundAdaptationObserver& aDevSoundObserver,
       
   233                       TMMFState aMode);
       
   234 
       
   235         /**
       
   236         * Initializes DevSound object for the mode aMode for processing audio
       
   237         * data with hardware device aHWDev.
       
   238         * On completion of Initialization, calls InitializeComplete() on
       
   239         * aDevSoundObserver.
       
   240         * Leaves on failure.
       
   241         * @since S60 3.0
       
   242         * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to
       
   243         *        the DevSound Observer instance.
       
   244         * @param TUid aHWDev The CMMFHwDevice implementation identifier.
       
   245         * @param TMMFState aMode The mode for which this object will be used
       
   246         * @return void
       
   247         */
       
   248         IMPORT_C void InitializeL(
       
   249                       MDevSoundAdaptationObserver& aDevSoundObserver,
       
   250                       TUid aHWDev,
       
   251                       TMMFState aMode);
       
   252 
       
   253         /**
       
   254         * Initializes DevSound object for the mode aMode for processing audio
       
   255         * data with hardware device supporting FourCC aDesiredFourCC.
       
   256         * Leaves on failure.
       
   257         * @since S60 3.0
       
   258         * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to
       
   259         *        DevSound Observer instance.
       
   260         * @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC
       
   261         *        code.
       
   262         * @param TMMFState aMode The mode for which this object will be used
       
   263         * @return KErrNone if successfull, else corresponding error code
       
   264         * @return void
       
   265         */
       
   266         IMPORT_C void InitializeL(
       
   267                       MDevSoundAdaptationObserver& aDevSoundObserver,
       
   268                       TFourCC aDesiredFourCC,
       
   269                       TMMFState aMode);
       
   270 
       
   271         /**
       
   272         * Returns the supported Audio settings ie. encoding, sample rates,
       
   273         * mono/stereo operation, buffer size etc..
       
   274         * @since S60 3.0
       
   275         * @return TMMFCapabilities The device settings.
       
   276         */
       
   277         IMPORT_C TMMFCapabilities Capabilities();
       
   278 
       
   279         /**
       
   280         * Returns the current device configuration.
       
   281         * @since S60 3.0
       
   282         * @return TMMFCapabilities The device settings.
       
   283         */
       
   284         IMPORT_C TMMFCapabilities Config() const;
       
   285 
       
   286         /**
       
   287         * Configure CMMFDevSound object with the settings in aConfig. Use this
       
   288         * to set sampling rate, encoding and mono/stereo.
       
   289         * Leaves on failure.
       
   290         * @since S60 3.0
       
   291         * @param const TMMFCapabilities& aConfig The attribute values to which
       
   292         *        CMMFDevSound object will be configured to.
       
   293         * @return void
       
   294         */
       
   295         IMPORT_C void SetConfigL(const TMMFCapabilities& aCaps);
       
   296 
       
   297         /**
       
   298         * Returns an integer representing the maximum volume device supports.
       
   299         * This is the maximum value which can be passed to
       
   300         * CMMFDevSound::SetVolume.
       
   301         * @since S60 3.0
       
   302         * @return TInt The maximum volume. This value is platform dependent but
       
   303         *        is always greater than or equal to one.
       
   304         */
       
   305         IMPORT_C TInt MaxVolume();
       
   306 
       
   307         /**
       
   308         * Returns an integer representing the current volume.
       
   309         * @since S60 3.0
       
   310         * @return TInt The current volume level.
       
   311         */
       
   312         IMPORT_C TInt Volume();
       
   313 
       
   314         /**
       
   315         * Changes the current playback volume to a specified value. The volume
       
   316         * can be changed before or during playback and is effective immediately.
       
   317         * @since S60 3.0
       
   318         * @param TInt aVolume The volume setting. This can be any value from 0
       
   319         *        to the value returned by a call to
       
   320         *        CMMFDevSound::MaxVolume(). If the volume is not
       
   321         *        within this range, the volume is automatically set
       
   322         *        to minimum or maximum value based on the value
       
   323         *        that is being passed. Setting a zero value mutes
       
   324         *        the sound. Setting the maximum value results in
       
   325         *        the loudest possible sound.
       
   326         * @return void
       
   327         */
       
   328         IMPORT_C void SetVolume(TInt aVolume);
       
   329 
       
   330         /**
       
   331         * Returns an integer representing the maximum gain the device supports.
       
   332         * This is the maximum value which can be passed to CMMFDevSound::SetGain
       
   333         * @since S60 3.0
       
   334         * @return TInt The maximum gain. This value is platform dependent but is
       
   335         *        always greater than or equal to one.
       
   336         */
       
   337         IMPORT_C TInt MaxGain();
       
   338 
       
   339         /**
       
   340         * Returns an integer representing the current gain.
       
   341         * @since S60 3.0
       
   342         * @return TInt The current gain level.
       
   343         */
       
   344         IMPORT_C TInt Gain();
       
   345 
       
   346         /**
       
   347         * Changes the current recording gain to a specified value. The gain can
       
   348         * be changed before or during recording and is effective immediately.
       
   349         * @since S60 3.0
       
   350         * @param TInt aGain The gain setting. This can be any value from zero to
       
   351         *        the value returned by a call to
       
   352         *        CMMFDevSound::MaxGain(). If the volume
       
   353         *        is not within this range, the gain is automatically
       
   354         *        set to minimum or maximum value based on the value
       
   355         *        that is being passed. Setting a zero value mutes the
       
   356         *        sound. Setting the maximum value results in the
       
   357         *        loudest possible sound.
       
   358         * @return void
       
   359         */
       
   360         IMPORT_C void SetGain(TInt aGain);
       
   361 
       
   362         /**
       
   363         * Returns the speaker balance set for playing.
       
   364         * Leaves on failure.
       
   365         * @since S60 3.0
       
   366         * @param TInt &aLeftPercentage On return contains the left speaker
       
   367         *        volume percentage.
       
   368         * @param TInt &aRightPercentage On return contains the right speaker
       
   369         *        volume percentage.
       
   370         * @return void
       
   371         */
       
   372         IMPORT_C void GetPlayBalanceL(TInt& aLeftPercentage,
       
   373                                       TInt& aRightPercentage);
       
   374 
       
   375         /**
       
   376         * Sets the speaker balance for playing. The speaker balance can be
       
   377         * changed before or during playback and is effective immediately.
       
   378         * Leaves on failure.
       
   379         * @since S60 3.0
       
   380         * @param TInt aLeftPercentage The left speaker volume percentage. This
       
   381         *        can be any value from zero to 100. Setting
       
   382         *        a zero value mutes the sound on left
       
   383         *        speaker.
       
   384         * @param TInt aRightPercentage The right speaker volume percentage.
       
   385         *        This can be any value from zero to 100.
       
   386         *        Setting a zero value mutes the sound on
       
   387         *        right speaker.
       
   388         * @return void
       
   389         */
       
   390         IMPORT_C void SetPlayBalanceL(TInt aLeftPercentage,
       
   391                                       TInt aRightPercentage);
       
   392 
       
   393         /**
       
   394         * Returns the microphone gain balance set for recording.
       
   395         * Leaves on failure.
       
   396         * @since S60 3.0
       
   397         * @param TInt &aLeftPercentage On return contains the left microphone
       
   398         *        gain percentage.
       
   399         * @param TInt &aRightPercentage On return contains the right microphone
       
   400         *        gain percentage.
       
   401         * @return void
       
   402         */
       
   403         IMPORT_C void GetRecordBalanceL(TInt& aLeftPercentage,
       
   404                                         TInt& aRightPercentage);
       
   405 
       
   406         /**
       
   407         * Sets the microphone balance for recording. The microphone balance can
       
   408         * be changed before or during recording and is effective immediately.
       
   409         * Leaves on failure.
       
   410         * @since S60 3.0
       
   411         * @param TInt aLeftPercentage The left microphone gain percentage. This
       
   412         *        can be any value from zero to 100. Setting
       
   413         *        a zero value mutes the sound from left
       
   414         *        microphone.
       
   415         * @param TInt aRightPercentage The right microphone gain percentage.
       
   416         *        This can be any value from zero to 100.
       
   417         *        Setting a zero value mutes the sound from
       
   418         *        right microphone.
       
   419         * @return void
       
   420         */
       
   421         IMPORT_C void SetRecordBalanceL(TInt aLeftPercentage,
       
   422                                         TInt aRightPercentage);
       
   423 
       
   424         /**
       
   425         * Initializes the audio device and starts the play process. This
       
   426         * function queries and acquires the audio policy before initializing
       
   427         * audio device. If there was an error during policy initialization,
       
   428         * PlayError() function will be called on the observer with error code
       
   429         * KErrAccessDenied, otherwise BufferToBeFilled() function will be called
       
   430         * with a buffer reference. After reading data into the buffer reference
       
   431         * passed, the client should call PlayData() to play data.
       
   432         * The amount of data that can be played is specified in
       
   433         * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
       
   434         * this size will be ignored.
       
   435         * Leaves on failure.
       
   436         * @since S60 3.0
       
   437         * @return void
       
   438         */
       
   439         IMPORT_C void PlayInitL();
       
   440 
       
   441         /**
       
   442         * Initializes the audio device and starts the record process. This
       
   443         * function queries and acquires the audio policy before initializing
       
   444         * audio device. If there was an error during policy initialization,
       
   445         * RecordError() function will be called on the observer with error code
       
   446         * KErrAccessDenied, otherwise BufferToBeEmptied() function will be
       
   447         * called with a buffer reference. This buffer contains recorded or
       
   448         * encoded data. After processing data in the buffer reference passed,
       
   449         * the client should call RecordData() to continue recording process.
       
   450         * The amount of data that is available is specified in
       
   451         * CMMFBuffer::RequestSize().
       
   452         * Leaves on failure.
       
   453         * @since S60 3.0
       
   454         * @return void
       
   455         */
       
   456         IMPORT_C void RecordInitL();
       
   457 
       
   458         /**
       
   459         * Plays data in the buffer at the current volume.
       
   460         * The client should fill the buffer with audio data before calling this
       
   461         * function. The observer gets a reference to the buffer along with the
       
   462         * callback function BufferToBeFilled(). When playing of the audio sample
       
   463         * is complete, successfully or otherwise, the function PlayError() on
       
   464         * the observer is called.
       
   465         * The last buffer of the audio stream being played should have the last
       
   466         * buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
       
   467         * subsequent attempt to play the clip is made, this flag will need
       
   468         * resetting by the client.
       
   469         * @return void
       
   470         */
       
   471         IMPORT_C void PlayData();
       
   472 
       
   473         /**
       
   474         * Contine the process of recording.
       
   475         * Once the buffer is filled with recorded data, the Observer gets a
       
   476         * reference to the buffer along with the callback function
       
   477         * BufferToBeEmptied(). After processing the buffer (copying over to a
       
   478         * different buffer or writing to file) the client should call this
       
   479         * function to continue the recording process.
       
   480         * @return void
       
   481         */
       
   482         IMPORT_C void RecordData();
       
   483 
       
   484         /**
       
   485         * Stops the ongoing operation (Play, Record, TonePlay).
       
   486         * @since S60 3.0
       
   487         * @return void
       
   488         */
       
   489         IMPORT_C void Stop();
       
   490 
       
   491         /**
       
   492         * Temporarily Stops the ongoing operation (Play, Record, TonePlay).
       
   493         * @since S60 3.0
       
   494         * @return void
       
   495         */
       
   496         IMPORT_C void Pause();
       
   497 
       
   498         /**
       
   499         * Returns the Sample recorded so far
       
   500         * @since S60 3.0
       
   501         * @return TInt Returns the samples recorded.
       
   502         */
       
   503         IMPORT_C TInt SamplesRecorded();
       
   504 
       
   505         /**
       
   506         * Returns the Sample played so far
       
   507         * @since S60 3.0
       
   508         * @return TInt Returns the samples played.
       
   509         */
       
   510         IMPORT_C TInt SamplesPlayed();
       
   511 
       
   512         /**
       
   513         * Initializes the audio device and starts playing a tone. The tone is
       
   514         * played with the frequency and duration specified.
       
   515         * Leaves on failure.
       
   516         * @since S60 3.0
       
   517         * @param TInt aFrequency The frequency at which the tone will be played.
       
   518         * @param const TTimeIntervalMicroSeconds &aDuration The period over
       
   519         *        which the tone will be played. A zero value causes the no tone
       
   520         *        to be played.
       
   521         * @return void
       
   522         */
       
   523         IMPORT_C void PlayToneL(
       
   524                       TInt aFrequency,
       
   525                       const TTimeIntervalMicroSeconds& aDuration);
       
   526 
       
   527         /**
       
   528         * Initializes audio device and starts playing a dual tone. Dual Tone is
       
   529         * played with the specified frequencies and for the specified duration.
       
   530         * Leaves on failure.
       
   531         * @since S60 3.0
       
   532         * @param TInt aFrequencyOne The first frequency of dual tone.
       
   533         * @param TInt aFrequencyTwo The second frequency of dual tone.
       
   534         * @param const TTimeIntervalMicroSeconds &aDuration The period over
       
   535         *        which the tone will be played. A zero value causes the no tone
       
   536         *        to be played.
       
   537         * @return void
       
   538         */
       
   539         IMPORT_C void PlayDualToneL(TInt aFrequencyOne,
       
   540                                     TInt aFrequencyTwo,
       
   541                                     const TTimeIntervalMicroSeconds& aDuration);
       
   542 
       
   543         /**
       
   544         * Initializes the audio device and starts playing the DTMF string
       
   545         * aDTMFString.
       
   546         * Leaves on failure.
       
   547         * @since S60 3.0
       
   548         * @param const TDesC &aDTMFString The DTMF sequence in a descriptor.
       
   549         * @return void
       
   550         */
       
   551         IMPORT_C void PlayDTMFStringL(const TDesC& aDTMFString);
       
   552 
       
   553         /**
       
   554         * Initializes the audio device and starts playing a tone sequence.
       
   555         * Leaves on failure.
       
   556         * @since S60 3.0
       
   557         * @param const TDesC8 &aData The tone sequence in a descriptor.
       
   558         * @return void
       
   559         */
       
   560         IMPORT_C void PlayToneSequenceL(const TDesC8& aData);
       
   561 
       
   562         /**
       
   563         * Initializes the audio device and starts playing the specified
       
   564         * pre-defined tone sequence.
       
   565         * Leaves on failure.
       
   566         * @since S60 3.0
       
   567         * @param TInt aSequenceNumber The index identifying the specific
       
   568         *        pre-defined tone sequence. Index values are relative to zero.
       
   569         *        This can be any value from zero to the value returned by a call
       
   570         *        to FixedSequenceCount() - 1. The function raises a panic if the
       
   571         *        sequence number is not within this range.
       
   572         * @return void
       
   573         */
       
   574         IMPORT_C void PlayFixedSequenceL(TInt aSequenceNumber);
       
   575 
       
   576         /**
       
   577         * Defines the number of times the audio is to be repeated during the
       
   578         * tone playback operation. A period of silence can follow each playing
       
   579         * of a tone. The tone playing can be repeated indefinitely
       
   580         * @since S60 3.0
       
   581         * @param TInt aRepeatCount The number of times the tone, together with
       
   582         *        the trailing silence, is to be repeated. If this is set to
       
   583         *        KMdaRepeatForever, then the tone, together with the trailing
       
   584         *        silence, is repeated indefinitely or until Stop() is called.
       
   585         *        If this is set to zero, then the tone is not repeated.
       
   586         * @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An
       
   587         *        interval of silence which will be played after each tone.
       
   588         *        Supported only during tone playing.
       
   589         * @return void
       
   590         */
       
   591         IMPORT_C void SetToneRepeats(TInt aRepeatCount,
       
   592                       const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
       
   593 
       
   594         /**
       
   595         * Defines the duration of tone on, tone off and tone pause to be used
       
   596         * during the DTMF tone playback operation.
       
   597         * Supported only during tone playing.
       
   598         * @since S60 3.0
       
   599         * @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over
       
   600         *        which the tone will be played. If this is set to zero, then the
       
   601         *        tone is not played.
       
   602         * @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over
       
   603         *        which the no tone will be played.
       
   604         * @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which
       
   605         *        the tone playing will be paused.
       
   606         * @return void
       
   607         */
       
   608         IMPORT_C void SetDTMFLengths(
       
   609                       TTimeIntervalMicroSeconds32& aToneOnLength,
       
   610                       TTimeIntervalMicroSeconds32& aToneOffLength,
       
   611                       TTimeIntervalMicroSeconds32& aPauseLength);
       
   612 
       
   613         /**
       
   614         * Defines the period over which the volume level is to rise smoothly
       
   615         * from nothing to the normal volume level.
       
   616         * The function is only available before playing.
       
   617         * @since S60 3.0
       
   618         * @param const TTimeIntervalMicroSeconds &aRampDuration The period over
       
   619         *        which the volume is to rise. A zero value causes the tone
       
   620         *        sample to be played at the normal level for the full duration
       
   621         *        of the playback. A value, which is longer than the duration of
       
   622         *        the tone sample means that the sample never reaches its normal
       
   623         *        volume level.
       
   624         * @return void
       
   625         */
       
   626         IMPORT_C void SetVolumeRamp(
       
   627                       const TTimeIntervalMicroSeconds& aRampDuration);
       
   628 
       
   629         /**
       
   630         * Defines the priority settings that should be used for this instance.
       
   631         * @since S60 3.0
       
   632         * @param const TMMFPrioritySettings &aPrioritySettings A class type
       
   633         *        representing the client's priority, priority preference and
       
   634         *        state
       
   635         * @return void
       
   636         */
       
   637         IMPORT_C void SetPrioritySettings(
       
   638                       const TMMFPrioritySettings& aPrioritySettings);
       
   639 
       
   640         /**
       
   641         * Retrieves a custom interface to the device.
       
   642         * @since S60 3.0
       
   643         * @param TUid aInterfaceId The interface UID, defined with the custom
       
   644         *        interface.
       
   645         * @return TAny* A pointer to the interface implementation, or NULL if
       
   646         *        the device does not implement the interface requested. The
       
   647         *        return value must be cast to the correct type by the user.
       
   648         */
       
   649         IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
       
   650 
       
   651         /**
       
   652         * Returns the number of available pre-defined tone sequences.
       
   653         * This is the number of fixed sequence supported by DevSound by default.
       
   654         * @since S60 3.0
       
   655         * @return TInt  The fixed sequence count. This value is implementation
       
   656         *        dependent.
       
   657         */
       
   658         IMPORT_C TInt FixedSequenceCount();
       
   659 
       
   660         /**
       
   661         * Returns the name assigned to a specific pre-defined tone sequence.
       
   662         * This is the number of the fixed sequence supported by DevSound by
       
   663         * default.
       
   664         * The function raises a panic if sequence number specified is invalid.
       
   665         * @since S60 3.0
       
   666         * @param TInt aSequenceNumber The index identifying the specific
       
   667         *        pre-defined tone sequence. Index values are relative to zero.
       
   668         *        This can be any value from zero to the value returned by a call
       
   669         *        to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The
       
   670         *        function raises a panic if sequence number is not within this
       
   671         *        range.
       
   672         * @return const TDesC & A reference to a Descriptor containing the fixed
       
   673         *        sequence name indexed by aSequenceNumber.
       
   674         */
       
   675         IMPORT_C const TDesC& FixedSequenceName(TInt aSequenceNumber);
       
   676 
       
   677         /**
       
   678         * Returns a list of the supported input datatypes that can be sent to
       
   679         * DevSound for playing audio. The datatypes returned are those that the
       
   680         * DevSound supports given the priority settings passed in
       
   681         * aPrioritySettings. Note that if no supported data types are found this
       
   682         * does not constitute failure, the function will return normally with no
       
   683         * entries in aSupportedDataTypes.
       
   684         * @since S60 3.0
       
   685         * @param RArray< TFourCC > &aSupportedDataTypes The array of supported
       
   686         *        data types that will be filled in by this function. The
       
   687         *        supported data types of the DevSound are in the form of an
       
   688         *        array of TFourCC codes. Any existing entries in the array will
       
   689         *        be overwritten on calling this function. If no supported data
       
   690         *        types are found given the priority settings, then the
       
   691         *        aSupportedDatatypes array will have zero entries.
       
   692         * @param const TMMFPrioritySettings &aPrioritySettings The priority
       
   693         *        settings used to determine the supported datatypes. Note this
       
   694         *        does not set the priority settings. For input datatypes the
       
   695         *        iState member of the priority settings would be expected to be
       
   696         *        either EMMFStatePlaying or EMMFStatePlayingRecording. The
       
   697         *        priority settings may effect the supported datatypes depending
       
   698         *        on the audio routing.
       
   699         * @return void
       
   700         */
       
   701         IMPORT_C void GetSupportedInputDataTypesL(
       
   702                       RArray<TFourCC>& aSupportedDataTypesconst,
       
   703                       const TMMFPrioritySettings& aPrioritySettings) const;
       
   704 
       
   705         /**
       
   706         * Returns a list of the supported output dataypes that can be received
       
   707         * from DevSound for recording audio. The datatypes returned are those
       
   708         * that the DevSound supports given the priority settings passed in
       
   709         * aPrioritySettings. Note that if no supported data types are found this
       
   710         * does not constitute failure, the function will return normally with no
       
   711         * entries in aSupportedDataTypes.
       
   712         * @since S60 3.0
       
   713         * @param RArray< TFourCC > &aSupportedDataTypes The array of supported
       
   714         *        data types that will be filled in by this function. The
       
   715         *        supported datatypes of the DevSound are in the form of an array
       
   716         *        of TFourCC codes. Any existing entries in the array will be
       
   717         *        overwritten on calling this function. If no supported datatypes
       
   718         *        are found given the priority settings, then the
       
   719         *        aSupportedDatatypes array will have zero entries.
       
   720         * @param const TMMFPrioritySettings &aPrioritySettings The priority
       
   721         *        settings used to determine the supported data types. Note this
       
   722         *        does not set the priority settings. For output data types the
       
   723         *        iState member of the priority settings would expected to be
       
   724         *        either EMMFStateRecording or EMMFStatePlayingRecording. The
       
   725         *        priority settings may effect the supported datatypes depending
       
   726         *        on the audio routing.
       
   727         * @return void
       
   728         */
       
   729         IMPORT_C void GetSupportedOutputDataTypesL(
       
   730                       RArray<TFourCC>& aSupportedDataTypes,
       
   731                       const TMMFPrioritySettings& aPrioritySettings) const;
       
   732 
       
   733         /**
       
   734         * Sets client configuration
       
   735         * @since S60 3.0
       
   736         * @param TMMFClientConfig& aClientConfig A reference to client
       
   737         *        configuration object.
       
   738         * @return void
       
   739         */
       
   740         IMPORT_C void SetClientConfig(const TMMFClientConfig& aClientConfig);
       
   741 
       
   742         /**
       
   743         * Returns client configuration
       
   744         * @since S60 3.0
       
   745         * @return void
       
   746         */
       
   747         IMPORT_C const TMMFClientConfig& ClientConfig() const;
       
   748 
       
   749         /*
       
   750         * Empties the buffers below DevSound without deleting the codec
       
   751         * @since S60 3.1
       
   752         * @return TInt
       
   753         *
       
   754         IMPORT_C TInt EmptyBuffers();*/
       
   755 
       
   756     protected:
       
   757 
       
   758         // So that nobody can extend
       
   759         CMMFDevSoundAdaptation();
       
   760 
       
   761         // Second phase constructor
       
   762         void ConstructL(RServer2& aPolicyServerHandle);
       
   763 
       
   764     protected:  // Data
       
   765         // Actual implementation class.
       
   766         class CBody;
       
   767 
       
   768         //DevSoundAdaptation body implementation
       
   769         CBody* iBody;
       
   770 
       
   771     };
       
   772 
       
   773 #endif      // MMFDEVSOUNDADAPTATION
       
   774 
       
   775 // End of File
       
   776