1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/inc/MdaAudioTonePlayer.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,217 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __MDAAUDIOTONEPLAYER_H__
1.20 +#define __MDAAUDIOTONEPLAYER_H__
1.21 +
1.22 +
1.23 +#include <e32std.h>
1.24 +#include <mmf/common/mmfbase.h>
1.25 +#include <mmf/common/mmfstandardcustomcommands.h>
1.26 +#include <mmfclntutility.h>
1.27 +
1.28 +class CMdaServer;
1.29 +
1.30 +
1.31 +/**
1.32 +@publishedAll
1.33 +@released
1.34 +
1.35 +The state of the audio tone utility.
1.36 +*/
1.37 +enum TMdaAudioToneUtilityState
1.38 + {
1.39 + /** The audio tone utility has not been prepared to play a tone.
1.40 + */
1.41 + EMdaAudioToneUtilityNotReady=0,
1.42 + /** The audio tone utility has been prepared to play a tone and is ready.
1.43 + */
1.44 + EMdaAudioToneUtilityPrepared,
1.45 + /** The audio tone utility is currently playing a tone.
1.46 + */
1.47 + EMdaAudioToneUtilityPlaying,
1.48 + /** The audio tone utility is currently paused.
1.49 + This state is only reached if underlying DevSound implementations supports resume.
1.50 + */
1.51 + EMdaAudioToneUtilityPaused
1.52 + };
1.53 +
1.54 +const TInt KMdaInfiniteDurationDTMFToneOnLength = -1;
1.55 +const TInt KMdaAudioToneRepeatForever = -2;
1.56 +
1.57 +/**
1.58 +@publishedAll
1.59 +@released
1.60 +
1.61 +An interface to a set of audio tone player callback functions.
1.62 +
1.63 +The class is a mixin and is intended to be inherited by the client
1.64 +class which is observing the audio tone playing operation. The
1.65 +functions encapsulated by this class are called when specific events
1.66 +occur in the process of preparing to play a tone and during the
1.67 +playing of a tone. A reference to this object is passed as a
1.68 +parameter when constructing an audio tone player utility, using the
1.69 +CMdaAudioToneUtility interface.
1.70 +
1.71 +@since 5.0
1.72 +*/
1.73 +class MMdaAudioToneObserver
1.74 + {
1.75 +public:
1.76 +
1.77 + /**
1.78 + Defines required client behaviour when an attempt to configure the
1.79 + audio tone player utility has completed, successfully or otherwise.
1.80 +
1.81 + @param aError
1.82 + KErrNone if successful. One of the system
1.83 + wide error codes if the attempt failed. The possible
1.84 + values depend on the EPOC platform.
1.85 + */
1.86 + virtual void MatoPrepareComplete(TInt aError) = 0;
1.87 +
1.88 + /**
1.89 + Defines required client behaviour when the tone playing operation has
1.90 + completed, successfully or otherwise.
1.91 +
1.92 + @param aError
1.93 + KErrNone if successful. One of the system
1.94 + wide error codes if the attempt failed. The possible
1.95 + values depend on the EPOC platform.
1.96 + */
1.97 + virtual void MatoPlayComplete(TInt aError) = 0;
1.98 + };
1.99 +
1.100 +
1.101 +class MMdaAudioTonePlayStartObserver
1.102 + {
1.103 +public:
1.104 + /**
1.105 + Defines required client behaviour when the tone playing operation has
1.106 + started, successfully or otherwise.
1.107 +
1.108 + @param aError
1.109 + KErrNone if successful. One of the system
1.110 + wide error codes if the attempt failed. The possible
1.111 + values depend on the EPOC platform.
1.112 + */
1.113 + virtual void MatoPlayStarted(TInt aError) = 0;
1.114 + };
1.115 +
1.116 +
1.117 +class CMMFMdaAudioToneUtility;
1.118 +
1.119 +/**
1.120 +@publishedAll
1.121 +@released
1.122 +
1.123 +Generates tones on an audio capable EPOC device.
1.124 +
1.125 +The class offers an interface for generating tones on all audio
1.126 +capable EPOC devices.
1.127 +
1.128 +To use the tone utility:
1.129 +
1.130 +1. Create an instance by calling NewL().
1.131 +
1.132 +2. Call the appropriate PrepareToPlay variant for the required tone type
1.133 +and wait for the callback indicating success.
1.134 +
1.135 +3. Call Play and either wait for the callback to indicate completion,
1.136 +or call CancelPlay to end playback early.
1.137 +
1.138 +4. Delete the instance.
1.139 +
1.140 +It is possible to call Play before calling any PrepareToPlay variant. This
1.141 +will result in a default fixed sequence tone being played.
1.142 +
1.143 +@since 5.0
1.144 +*/
1.145 +class CMdaAudioToneUtility : public CBase,
1.146 + public MMMFClientUtility
1.147 + {
1.148 +public:
1.149 +
1.150 + IMPORT_C static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer = NULL);
1.151 +
1.152 + IMPORT_C static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer,
1.153 + TInt aPriority,
1.154 + TInt aPref = EMdaPriorityPreferenceTimeAndQuality);
1.155 +
1.156 + ~CMdaAudioToneUtility();
1.157 +
1.158 + virtual TMdaAudioToneUtilityState State();
1.159 +
1.160 + virtual TInt MaxVolume();
1.161 +
1.162 + virtual TInt Volume();
1.163 +
1.164 + virtual void SetVolume(TInt aVolume);
1.165 +
1.166 + virtual void SetPriority(TInt aPriority, TInt aPref);
1.167 +
1.168 + virtual void SetDTMFLengths(TTimeIntervalMicroSeconds32 aToneLength,
1.169 + TTimeIntervalMicroSeconds32 aToneOffLength,
1.170 + TTimeIntervalMicroSeconds32 aPauseLength);
1.171 +
1.172 + virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
1.173 +
1.174 + virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
1.175 +
1.176 + virtual TInt FixedSequenceCount();
1.177 +
1.178 + virtual const TDesC& FixedSequenceName(TInt aSequenceNumber);
1.179 +
1.180 + virtual void PrepareToPlayTone(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
1.181 +
1.182 + virtual void PrepareToPlayDTMFString(const TDesC& aDTMF);
1.183 +
1.184 + virtual void PrepareToPlayDesSequence(const TDesC8& aSequence);
1.185 +
1.186 + virtual void PrepareToPlayFileSequence(const TDesC& aFileName);
1.187 +
1.188 + virtual void PrepareToPlayFixedSequence(TInt aSequenceNumber);
1.189 +
1.190 + virtual void CancelPrepare();
1.191 +
1.192 + virtual void Play();
1.193 +
1.194 + virtual void CancelPlay();
1.195 +
1.196 + IMPORT_C TInt Pause();
1.197 +
1.198 + IMPORT_C TInt Resume();
1.199 +
1.200 + IMPORT_C void SetBalanceL(TInt aBalance=KMMFBalanceCenter);
1.201 +
1.202 + IMPORT_C TInt GetBalanceL();
1.203 +
1.204 + IMPORT_C void PrepareToPlayDualTone(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
1.205 +
1.206 + IMPORT_C void PrepareToPlayFileSequence(RFile& aFile);
1.207 +
1.208 + IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
1.209 +
1.210 + IMPORT_C void RegisterPlayStartCallback(MMdaAudioTonePlayStartObserver& aObserver);
1.211 +
1.212 +protected:
1.213 + /**
1.214 + This member is internal and not intended for use.
1.215 + */
1.216 + CMMFMdaAudioToneUtility* iProperties;
1.217 + };
1.218 +
1.219 +
1.220 +#endif