|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __MDAAUDIOTONEPLAYER_H__ |
|
17 #define __MDAAUDIOTONEPLAYER_H__ |
|
18 |
|
19 |
|
20 #include <e32std.h> |
|
21 #include <mmf/common/mmfbase.h> |
|
22 #include <mmf/common/mmfstandardcustomcommands.h> |
|
23 #include <mmfclntutility.h> |
|
24 |
|
25 class CMdaServer; |
|
26 |
|
27 |
|
28 /** |
|
29 @publishedAll |
|
30 @released |
|
31 |
|
32 The state of the audio tone utility. |
|
33 */ |
|
34 enum TMdaAudioToneUtilityState |
|
35 { |
|
36 /** The audio tone utility has not been prepared to play a tone. |
|
37 */ |
|
38 EMdaAudioToneUtilityNotReady=0, |
|
39 /** The audio tone utility has been prepared to play a tone and is ready. |
|
40 */ |
|
41 EMdaAudioToneUtilityPrepared, |
|
42 /** The audio tone utility is currently playing a tone. |
|
43 */ |
|
44 EMdaAudioToneUtilityPlaying, |
|
45 /** The audio tone utility is currently paused. |
|
46 This state is only reached if underlying DevSound implementations supports resume. |
|
47 */ |
|
48 EMdaAudioToneUtilityPaused |
|
49 }; |
|
50 |
|
51 const TInt KMdaInfiniteDurationDTMFToneOnLength = -1; |
|
52 const TInt KMdaAudioToneRepeatForever = -2; |
|
53 |
|
54 /** |
|
55 @publishedAll |
|
56 @released |
|
57 |
|
58 An interface to a set of audio tone player callback functions. |
|
59 |
|
60 The class is a mixin and is intended to be inherited by the client |
|
61 class which is observing the audio tone playing operation. The |
|
62 functions encapsulated by this class are called when specific events |
|
63 occur in the process of preparing to play a tone and during the |
|
64 playing of a tone. A reference to this object is passed as a |
|
65 parameter when constructing an audio tone player utility, using the |
|
66 CMdaAudioToneUtility interface. |
|
67 |
|
68 @since 5.0 |
|
69 */ |
|
70 class MMdaAudioToneObserver |
|
71 { |
|
72 public: |
|
73 |
|
74 /** |
|
75 Defines required client behaviour when an attempt to configure the |
|
76 audio tone player utility has completed, successfully or otherwise. |
|
77 |
|
78 @param aError |
|
79 KErrNone if successful. One of the system |
|
80 wide error codes if the attempt failed. The possible |
|
81 values depend on the EPOC platform. |
|
82 */ |
|
83 virtual void MatoPrepareComplete(TInt aError) = 0; |
|
84 |
|
85 /** |
|
86 Defines required client behaviour when the tone playing operation has |
|
87 completed, successfully or otherwise. |
|
88 |
|
89 @param aError |
|
90 KErrNone if successful. One of the system |
|
91 wide error codes if the attempt failed. The possible |
|
92 values depend on the EPOC platform. |
|
93 */ |
|
94 virtual void MatoPlayComplete(TInt aError) = 0; |
|
95 }; |
|
96 |
|
97 |
|
98 class MMdaAudioTonePlayStartObserver |
|
99 { |
|
100 public: |
|
101 /** |
|
102 Defines required client behaviour when the tone playing operation has |
|
103 started, successfully or otherwise. |
|
104 |
|
105 @param aError |
|
106 KErrNone if successful. One of the system |
|
107 wide error codes if the attempt failed. The possible |
|
108 values depend on the EPOC platform. |
|
109 */ |
|
110 virtual void MatoPlayStarted(TInt aError) = 0; |
|
111 }; |
|
112 |
|
113 |
|
114 class CMMFMdaAudioToneUtility; |
|
115 |
|
116 /** |
|
117 @publishedAll |
|
118 @released |
|
119 |
|
120 Generates tones on an audio capable EPOC device. |
|
121 |
|
122 The class offers an interface for generating tones on all audio |
|
123 capable EPOC devices. |
|
124 |
|
125 To use the tone utility: |
|
126 |
|
127 1. Create an instance by calling NewL(). |
|
128 |
|
129 2. Call the appropriate PrepareToPlay variant for the required tone type |
|
130 and wait for the callback indicating success. |
|
131 |
|
132 3. Call Play and either wait for the callback to indicate completion, |
|
133 or call CancelPlay to end playback early. |
|
134 |
|
135 4. Delete the instance. |
|
136 |
|
137 It is possible to call Play before calling any PrepareToPlay variant. This |
|
138 will result in a default fixed sequence tone being played. |
|
139 |
|
140 @since 5.0 |
|
141 */ |
|
142 class CMdaAudioToneUtility : public CBase, |
|
143 public MMMFClientUtility |
|
144 { |
|
145 public: |
|
146 |
|
147 IMPORT_C static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer = NULL); |
|
148 |
|
149 IMPORT_C static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer, |
|
150 TInt aPriority, |
|
151 TInt aPref = EMdaPriorityPreferenceTimeAndQuality); |
|
152 |
|
153 ~CMdaAudioToneUtility(); |
|
154 |
|
155 virtual TMdaAudioToneUtilityState State(); |
|
156 |
|
157 virtual TInt MaxVolume(); |
|
158 |
|
159 virtual TInt Volume(); |
|
160 |
|
161 virtual void SetVolume(TInt aVolume); |
|
162 |
|
163 virtual void SetPriority(TInt aPriority, TInt aPref); |
|
164 |
|
165 virtual void SetDTMFLengths(TTimeIntervalMicroSeconds32 aToneLength, |
|
166 TTimeIntervalMicroSeconds32 aToneOffLength, |
|
167 TTimeIntervalMicroSeconds32 aPauseLength); |
|
168 |
|
169 virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); |
|
170 |
|
171 virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); |
|
172 |
|
173 virtual TInt FixedSequenceCount(); |
|
174 |
|
175 virtual const TDesC& FixedSequenceName(TInt aSequenceNumber); |
|
176 |
|
177 virtual void PrepareToPlayTone(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); |
|
178 |
|
179 virtual void PrepareToPlayDTMFString(const TDesC& aDTMF); |
|
180 |
|
181 virtual void PrepareToPlayDesSequence(const TDesC8& aSequence); |
|
182 |
|
183 virtual void PrepareToPlayFileSequence(const TDesC& aFileName); |
|
184 |
|
185 virtual void PrepareToPlayFixedSequence(TInt aSequenceNumber); |
|
186 |
|
187 virtual void CancelPrepare(); |
|
188 |
|
189 virtual void Play(); |
|
190 |
|
191 virtual void CancelPlay(); |
|
192 |
|
193 IMPORT_C TInt Pause(); |
|
194 |
|
195 IMPORT_C TInt Resume(); |
|
196 |
|
197 IMPORT_C void SetBalanceL(TInt aBalance=KMMFBalanceCenter); |
|
198 |
|
199 IMPORT_C TInt GetBalanceL(); |
|
200 |
|
201 IMPORT_C void PrepareToPlayDualTone(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); |
|
202 |
|
203 IMPORT_C void PrepareToPlayFileSequence(RFile& aFile); |
|
204 |
|
205 IMPORT_C TAny* CustomInterface(TUid aInterfaceId); |
|
206 |
|
207 IMPORT_C void RegisterPlayStartCallback(MMdaAudioTonePlayStartObserver& aObserver); |
|
208 |
|
209 protected: |
|
210 /** |
|
211 This member is internal and not intended for use. |
|
212 */ |
|
213 CMMFMdaAudioToneUtility* iProperties; |
|
214 }; |
|
215 |
|
216 |
|
217 #endif |