20 |
20 |
21 #include <e32std.h> |
21 #include <e32std.h> |
22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <mdaaudiotoneplayer.h> |
23 #include <mdaaudiotoneplayer.h> |
24 #include <mmf/server/sounddevice.h> |
24 #include <mmf/server/sounddevice.h> |
25 #include <caf/data.h> |
|
26 #include <caf/content.h> |
|
27 //Panic category and codes |
25 //Panic category and codes |
28 _LIT(KMMFMdaAudioToneUtilityPanicCategory, "MMFMdaAudioToneUtility"); |
26 _LIT(KMMFMdaAudioToneUtilityPanicCategory, "MMFMdaAudioToneUtility"); |
29 enum TMMFMdaAudioToneUtilityPanicCodes |
27 enum TMMFMdaAudioToneUtilityPanicCodes |
30 { |
28 { |
31 EMMFMdaAudioToneUtilityAlreadyPrepared, |
29 EMMFMdaAudioToneUtilityAlreadyPrepared, |
58 TMMFAudioToneObserverCallbackAction iAction; |
56 TMMFAudioToneObserverCallbackAction iAction; |
59 TInt iErrorCode; |
57 TInt iErrorCode; |
60 }; |
58 }; |
61 |
59 |
62 class CMMFToneConfig; |
60 class CMMFToneConfig; |
|
61 |
|
62 /** |
|
63 Timer class used instead of actual CMMFDevSound - the interface isn't the same either! |
|
64 */ |
|
65 NONSHARABLE_CLASS( CDummyDevSound ) : public CTimer |
|
66 { |
|
67 public: |
|
68 static CDummyDevSound* NewL(); |
|
69 |
|
70 void InitializeL(MDevSoundObserver& aDevSoundObserver); |
|
71 void RunL(); |
|
72 void Play(const TTimeIntervalMicroSeconds& aDuration); |
|
73 |
|
74 private: |
|
75 CDummyDevSound(); |
|
76 |
|
77 private: |
|
78 MDevSoundObserver* iObserver; |
|
79 }; |
63 |
80 |
64 /** |
81 /** |
65 Concrete implementation of the CMdaAudioToneUtility API. |
82 Concrete implementation of the CMdaAudioToneUtility API. |
66 @see CMdaAudioToneUtility |
83 @see CMdaAudioToneUtility |
67 */ |
84 */ |
140 // functions to convert between MediaServer Balance and SoundDev balance |
157 // functions to convert between MediaServer Balance and SoundDev balance |
141 void CalculateBalance( TInt& aBalance, TInt aLeft, TInt aRight ) const; |
158 void CalculateBalance( TInt& aBalance, TInt aLeft, TInt aRight ) const; |
142 void CalculateLeftRightBalance( TInt& aLeft, TInt& aRight, TInt aBalance ) const; |
159 void CalculateLeftRightBalance( TInt& aLeft, TInt& aRight, TInt aBalance ) const; |
143 |
160 |
144 private: |
161 private: |
145 CMMFDevSound* iDevSound; |
162 CDummyDevSound* iTimer; |
146 MMdaAudioToneObserver& iCallback; |
163 MMdaAudioToneObserver& iCallback; |
147 CMMFMdaAudioToneObserverCallback* iAsyncCallback; |
164 CMMFMdaAudioToneObserverCallback* iAsyncCallback; |
148 |
|
149 CMMFToneConfig* iToneConfig; |
|
150 // Devsound doesn't take copies of descriptors we pass to it, so we |
|
151 // need to cache the config info until it has finished playing. |
|
152 CMMFToneConfig* iPlayingToneConfig; //unused remove when BC break allowed |
|
153 |
165 |
154 TMdaAudioToneUtilityState iState; |
166 TMdaAudioToneUtilityState iState; |
155 |
167 |
156 TMMFPrioritySettings iPrioritySettings; |
168 TMMFPrioritySettings iPrioritySettings; |
157 |
169 |
165 MMdaAudioTonePlayStartObserver* iPlayStartObserver; |
177 MMdaAudioTonePlayStartObserver* iPlayStartObserver; |
166 |
178 |
167 #ifdef _DEBUG |
179 #ifdef _DEBUG |
168 TBool iPlayCalledBeforeInitialized; |
180 TBool iPlayCalledBeforeInitialized; |
169 #endif |
181 #endif |
|
182 |
|
183 TInt iDevSoundVolume; |
|
184 TInt iDevSoundBalance; |
|
185 TTimeIntervalMicroSeconds iDuration; |
170 }; |
186 }; |
171 |
187 |
172 |
188 |
173 // Tone configurations |
|
174 class CMMFToneConfig : public CBase |
|
175 { |
|
176 public: |
|
177 enum TMMFToneType |
|
178 { |
|
179 EMmfToneTypeSimple, |
|
180 EMmfToneTypeDTMF, |
|
181 EMmfToneTypeDesSeq, |
|
182 EMmfToneTypeFileSeq, |
|
183 EMmfToneTypeFixedSeq, |
|
184 EMmfToneTypeDual, |
|
185 }; |
|
186 virtual ~CMMFToneConfig() {} |
|
187 TMMFToneType Type() {return iType;} |
|
188 protected: |
|
189 CMMFToneConfig(TMMFToneType aType) : iType(aType) {} |
|
190 private: |
|
191 TMMFToneType iType; |
|
192 }; |
|
193 |
|
194 class CMMFSimpleToneConfig : public CMMFToneConfig |
|
195 { |
|
196 public: |
|
197 static CMMFToneConfig* NewL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); |
|
198 virtual ~CMMFSimpleToneConfig(); |
|
199 TInt Frequency(); |
|
200 const TTimeIntervalMicroSeconds& Duration(); |
|
201 protected: |
|
202 CMMFSimpleToneConfig(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); |
|
203 private: |
|
204 TInt iFrequency; |
|
205 TTimeIntervalMicroSeconds iDuration; |
|
206 }; |
|
207 |
|
208 class CMMFDualToneConfig : public CMMFToneConfig |
|
209 { |
|
210 public: |
|
211 static CMMFToneConfig* NewL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); |
|
212 virtual ~CMMFDualToneConfig(); |
|
213 TInt FrequencyOne(); |
|
214 TInt FrequencyTwo(); |
|
215 const TTimeIntervalMicroSeconds& Duration(); |
|
216 protected: |
|
217 CMMFDualToneConfig(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); |
|
218 private: |
|
219 TInt iFrequencyOne; |
|
220 TInt iFrequencyTwo; |
|
221 TTimeIntervalMicroSeconds iDuration; |
|
222 }; |
|
223 |
|
224 class CMMFDTMFStringToneConfig : public CMMFToneConfig |
|
225 { |
|
226 public: |
|
227 static CMMFToneConfig* NewL(const TDesC& aDTMF); |
|
228 static CMMFToneConfig* NewL(RFile& aFile); |
|
229 virtual ~CMMFDTMFStringToneConfig(); |
|
230 const TDesC& DTMF(); |
|
231 protected: |
|
232 CMMFDTMFStringToneConfig(); |
|
233 void ConstructL(const TDesC& aDTMF); |
|
234 private: |
|
235 HBufC* iDTMF; |
|
236 }; |
|
237 |
|
238 class CMMFDesSeqToneConfig : public CMMFToneConfig |
|
239 { |
|
240 public: |
|
241 static CMMFToneConfig* NewL(const TDesC8& aDesSeq); |
|
242 virtual ~CMMFDesSeqToneConfig(); |
|
243 const TDesC8& DesSeq(); |
|
244 protected: |
|
245 CMMFDesSeqToneConfig(); |
|
246 void ConstructL(const TDesC8& aDesSeq); |
|
247 private: |
|
248 HBufC8* iDesSeq; |
|
249 }; |
|
250 |
|
251 |
|
252 class CMMFFileSeqToneConfig : public CMMFToneConfig |
|
253 { |
|
254 public: |
|
255 static CMMFToneConfig* NewL(const TDesC& aFileSeq); |
|
256 static CMMFToneConfig* NewL(RFile& aFile); |
|
257 virtual ~CMMFFileSeqToneConfig(); |
|
258 const TDesC8& FileSeq(); |
|
259 |
|
260 // CAF support for Tone Utility |
|
261 void ExecuteIntentL(); |
|
262 protected: |
|
263 CMMFFileSeqToneConfig(); |
|
264 void ConstructL(const TDesC& aFileSeq); |
|
265 void ConstructL(RFile& aFile); |
|
266 private: |
|
267 ContentAccess::CContent* iCAFContent; |
|
268 ContentAccess::CData* iCAFData; |
|
269 HBufC8* iDesSeq; |
|
270 }; |
|
271 |
|
272 class CMMFFixedSeqToneConfig : public CMMFToneConfig |
|
273 { |
|
274 public: |
|
275 static CMMFToneConfig* NewL(TInt aSeqNo); |
|
276 virtual ~CMMFFixedSeqToneConfig(); |
|
277 TInt SequenceNumber(); |
|
278 protected: |
|
279 CMMFFixedSeqToneConfig(TInt aSeqNo); |
|
280 private: |
|
281 TInt iSequenceNumber; |
|
282 }; |
|
283 |
|
284 #endif |
189 #endif |