17 |
17 |
18 // INCLUDE FILES |
18 // INCLUDE FILES |
19 |
19 |
20 #include <tms.h> |
20 #include <tms.h> |
21 #include <AudioPreference.h> |
21 #include <AudioPreference.h> |
22 #include <barsc.h> |
|
23 #include <barsread.h> |
|
24 #include <data_caging_path_literals.hrh> |
22 #include <data_caging_path_literals.hrh> |
25 #include <defaultbeep.rsg> |
23 #include <defaultbeep.rsg> |
26 #include "tmsutility.h" |
24 #include "tmsutility.h" |
27 #include "tmsaudioinbandtoneplayer.h" |
25 #include "tmsaudioinbandtoneplayer.h" |
28 #include "tmsaudiotoneutilityimpl.h" |
26 #include "tmsaudiotoneutilityimpl.h" |
29 |
27 |
30 using namespace TMS; |
28 using namespace TMS; |
31 |
29 |
32 // CONSTANTS |
30 // CONSTANTS |
33 const TInt KPhoneInbandVolumeMax = 10; |
31 const gint KPhoneInbandVolumeMax = 10; |
34 const TInt KPhoneInbandVolumeMin = 0; |
32 const gint KPhoneInbandVolumeMin = 0; |
35 const TInt KPhoneInbandToneZero = 0; |
|
36 |
33 |
37 // Resourcefile destination. |
34 // Resourcefile destination. |
38 _LIT( KSystemDefaultbeepRscDrive, "Z:" ); |
35 _LIT(KSystemDefaultbeepRscDrive, "Z:"); |
39 _LIT( KSystemDefaultbeepRscFile, "DEFAULTBEEP.rSC" ); |
36 _LIT(KSystemDefaultbeepRscFile, "DEFAULTBEEP.rSC"); |
40 |
37 |
41 // ----------------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------------- |
42 // TMSAudioInbandTonePlayer::NewL |
39 // TMSAudioInbandTonePlayer::NewL |
43 // Two-phased constructor. |
40 // Two-phased constructor. |
44 // ----------------------------------------------------------------------------- |
41 // ----------------------------------------------------------------------------- |
45 // |
42 // |
46 TMSAudioInbandTonePlayer* TMSAudioInbandTonePlayer::NewL() |
43 TMSAudioInbandTonePlayer* TMSAudioInbandTonePlayer::NewL() |
47 { |
44 { |
48 TMSAudioInbandTonePlayer* self = |
45 TMSAudioInbandTonePlayer* self = new (ELeave) TMSAudioInbandTonePlayer(); |
49 new (ELeave) TMSAudioInbandTonePlayer(); |
|
50 CleanupStack::PushL(self); |
46 CleanupStack::PushL(self); |
51 self->ConstructL( /*aAudioFactory*/); |
47 self->ConstructL(); |
52 CleanupStack::Pop(self); |
48 CleanupStack::Pop(self); |
53 return self; |
49 return self; |
54 } |
50 } |
55 |
51 |
56 //Destructor |
52 //Destructor |
57 TMSAudioInbandTonePlayer::~TMSAudioInbandTonePlayer() |
53 TMSAudioInbandTonePlayer::~TMSAudioInbandTonePlayer() |
58 { |
54 { |
59 TRACE_PRN_FN_ENT; |
55 TRACE_PRN_FN_ENT; |
|
56 iResourceFile.Close(); |
60 iFsSession.Close(); |
57 iFsSession.Close(); |
61 iCurrent->CancelPlay(); |
58 iTones.ResetAndDestroy(); |
62 delete iCurrent; |
59 iTones.Close(); |
63 |
60 if (iPlayer) |
64 delete iPlayBeepSequence; |
61 { |
65 delete iPlayNoSoundSequence; |
62 iPlayer->CancelPlay(); |
66 delete iPlayDataSequence; |
63 } |
67 delete iResourceCallWaitingSeq; |
64 delete iPlayer; |
68 delete iResourceRingGoingSeq; |
|
69 delete iResourceRadioPathSeq; |
|
70 delete iResourceSpecialSeq; |
|
71 delete iResourceCongestionSeq; |
|
72 delete iResourceReorderSeq; |
|
73 delete iResourceBusySeq; |
|
74 TRACE_PRN_FN_EXT; |
65 TRACE_PRN_FN_EXT; |
75 } |
66 } |
76 |
67 |
77 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
78 // TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer |
69 // TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer |
79 // C++ default constructor can NOT contain any code, that |
70 // C++ default constructor can NOT contain any code, that |
80 // might leave. |
71 // might leave. |
81 // ----------------------------------------------------------------------------- |
72 // ----------------------------------------------------------------------------- |
82 // |
73 // |
83 TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer() |
74 TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer() : |
|
75 iPlayer(NULL) |
84 { |
76 { |
85 } |
77 } |
86 |
78 |
87 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
88 // TMSAudioInbandTonePlayer::ConstructL |
80 // TMSAudioInbandTonePlayer::ConstructL |
89 // Symbian 2nd phase constructor can leave. |
81 // Symbian 2nd phase constructor can leave. |
90 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
91 // |
83 // |
92 void TMSAudioInbandTonePlayer::ConstructL() |
84 void TMSAudioInbandTonePlayer::ConstructL() |
93 { |
85 { |
94 // iCurrent = aFactory.CreateAudioToneUtilityL( *this ); |
86 TRACE_PRN_FN_ENT; |
95 TRACE_PRN_FN_ENT; |
87 iPlayer = TMSAudioToneUtilityImpl::NewL(*this); |
96 iCurrent = TMSAudioToneUtilityImpl::NewL(*this); |
88 iTones.Reset(); |
97 |
89 CreateToneSequencesL(); |
98 //Get the inband tone sequences from resource and and store to member |
90 TRACE_PRN_FN_EXT; |
99 //variables |
91 } |
100 RResourceFile resourceFile; |
92 |
101 |
93 // ----------------------------------------------------------------------------- |
102 TFileName fileName(KSystemDefaultbeepRscDrive); |
94 // TMSAudioInbandTonePlayer::CreateSequencesL |
103 fileName.Append(KDC_RESOURCE_FILES_DIR); |
95 // Create inband tone sequences from resources. |
104 fileName.Append(KSystemDefaultbeepRscFile); |
96 // ----------------------------------------------------------------------------- |
105 |
97 // |
|
98 void TMSAudioInbandTonePlayer::CreateToneSequencesL() |
|
99 { |
|
100 TRACE_PRN_FN_ENT; |
|
101 |
|
102 iFileName = KSystemDefaultbeepRscDrive; |
|
103 iFileName.Append(KDC_RESOURCE_FILES_DIR); |
|
104 iFileName.Append(KSystemDefaultbeepRscFile); |
106 iFsSession.Connect(); |
105 iFsSession.Connect(); |
107 resourceFile.OpenL(iFsSession, fileName); |
106 iResourceFile.OpenL(iFsSession, iFileName); |
108 CleanupClosePushL(resourceFile); |
107 |
109 |
108 // DO NOT change order of sequence allocation! |
110 HBufC8* resourceBusy = resourceFile.AllocReadL(R_NET_BUSY); |
109 AllocSeqFromResourceL(R_NET_BUSY); //iTones[0] |
111 HBufC8* resourceReorder = resourceFile.AllocReadL(R_NET_REORDER); |
110 AllocSeqFromResourceL(R_NET_RADIO_NOT_AVAILABLE); //iTones[1] |
112 HBufC8* resourceCongestion = resourceFile.AllocReadL(R_NET_CONGESTION); |
111 AllocSeqFromResourceL(R_NET_CONGESTION); //iTones[2] |
113 HBufC8* resourceSpecial = resourceFile.AllocReadL( |
112 AllocSeqFromResourceL(R_NET_SPECIAL_INFORMATION); //iTones[3] |
114 R_NET_SPECIAL_INFORMATION); |
113 AllocSeqFromResourceL(R_NET_REORDER); //iTones[4] |
115 HBufC8* resourceRadioPath = resourceFile.AllocReadL( |
114 AllocSeqFromResourceL(R_NET_RING_GOING); //iTones[5] |
116 R_NET_RADIO_NOT_AVAILABLE); |
115 AllocSeqFromResourceL(R_NET_CALL_WAITING); //iTones[6] |
117 HBufC8* resourceRingGoing = resourceFile.AllocReadL(R_NET_RING_GOING); |
116 AllocSeqFromResourceL(R_DATA_CALL_TONE); //iTones[7] |
118 HBufC8* resourceCallWaiting = resourceFile.AllocReadL(R_NET_CALL_WAITING); |
117 AllocSeqFromResourceL(R_NO_SOUND_SEQUENCE); //iTones[8] |
119 HBufC8* dataCallTone = resourceFile.AllocReadL(R_DATA_CALL_TONE); |
118 AllocSeqFromResourceL(R_BEEP_SEQUENCE); //iTones[9] |
120 HBufC8* noSoundSequence = resourceFile.AllocReadL(R_NO_SOUND_SEQUENCE); |
119 |
121 HBufC8* beepSequence = resourceFile.AllocReadL(R_BEEP_SEQUENCE); |
120 iResourceFile.Close(); |
122 |
121 iFsSession.Close(); |
123 CleanupStack::PopAndDestroy(&resourceFile); |
122 |
124 |
123 TRACE_PRN_FN_EXT; |
125 TResourceReader reader; |
124 } |
126 TInt i(0); |
125 |
127 TInt length(0); |
126 // ----------------------------------------------------------------------------- |
128 |
127 // TMSAudioInbandTonePlayer::AllocSeqFromResourceL |
129 //SubscriberBusy |
128 // |
130 reader.SetBuffer(resourceBusy); |
129 // ----------------------------------------------------------------------------- |
131 length = reader.ReadInt16(); |
130 // |
132 iResourceBusySeq = HBufC8::NewL(length); |
131 void TMSAudioInbandTonePlayer::AllocSeqFromResourceL(const gint resource) |
133 //Tptr modifies member variables (HBufC8) length so it includes the memory |
132 { |
134 //edited by Append() |
133 HBufC8* res = iResourceFile.AllocReadLC(resource); |
135 TPtr8 appendBusy(iResourceBusySeq->Des()); |
134 iReader.SetBuffer(res); |
136 |
135 gint length = iReader.ReadInt16(); |
137 for (i = 0; i < length; i++) |
136 HBufC8* buf = HBufC8::NewL(length); |
138 { |
137 TPtr8 ptr(buf->Des()); |
139 appendBusy.Append(reader.ReadUint16()); |
138 for (gint i = 0; i < length; i++) |
140 } |
139 { |
141 |
140 ptr.Append(iReader.ReadUint16()); |
142 //Reorder |
141 } |
143 reader.SetBuffer(resourceReorder); |
142 User::LeaveIfError(iTones.Append(buf)); |
144 length = reader.ReadInt16(); |
143 CleanupStack::PopAndDestroy(res); |
145 iResourceReorderSeq = HBufC8::NewL(length); |
|
146 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
147 //edited by Append() |
|
148 TPtr8 appendReorder(iResourceReorderSeq->Des()); |
|
149 |
|
150 for (i = 0; i < length; i++) |
|
151 { |
|
152 appendReorder.Append(reader.ReadUint16()); |
|
153 } |
|
154 |
|
155 //Congestion |
|
156 reader.SetBuffer(resourceCongestion); |
|
157 length = reader.ReadInt16(); |
|
158 iResourceCongestionSeq = HBufC8::NewL(length); |
|
159 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
160 //edited by Append() |
|
161 TPtr8 appendCongestion(iResourceCongestionSeq->Des()); |
|
162 |
|
163 for (i = 0; i < length; i++) |
|
164 { |
|
165 appendCongestion.Append(reader.ReadUint16()); |
|
166 } |
|
167 |
|
168 //Special Information |
|
169 reader.SetBuffer(resourceSpecial); |
|
170 length = reader.ReadInt16(); |
|
171 iResourceSpecialSeq = HBufC8::NewL(length); |
|
172 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
173 //edited by Append() |
|
174 TPtr8 appendSpecial(iResourceSpecialSeq->Des()); |
|
175 |
|
176 for (i = 0; i < length; i++) |
|
177 { |
|
178 appendSpecial.Append(reader.ReadUint16()); |
|
179 } |
|
180 |
|
181 //RadioPathNotAvailable |
|
182 reader.SetBuffer(resourceRadioPath); |
|
183 length = reader.ReadInt16(); |
|
184 iResourceRadioPathSeq = HBufC8::NewL(length); |
|
185 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
186 //edited by Append() |
|
187 TPtr8 appendRadio(iResourceRadioPathSeq->Des()); |
|
188 |
|
189 for (i = 0; i < length; i++) |
|
190 { |
|
191 appendRadio.Append(reader.ReadUint16()); |
|
192 } |
|
193 |
|
194 //RemoteAlertingTone |
|
195 reader.SetBuffer(resourceRingGoing); |
|
196 length = reader.ReadInt16(); |
|
197 iResourceRingGoingSeq = HBufC8::NewL(length); |
|
198 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
199 //edited by Append() |
|
200 TPtr8 appendRingGoing(iResourceRingGoingSeq->Des()); |
|
201 |
|
202 for (i = 0; i < length; i++) |
|
203 { |
|
204 appendRingGoing.Append(reader.ReadUint16()); |
|
205 } |
|
206 //CallWaitingTone |
|
207 reader.SetBuffer(resourceCallWaiting); |
|
208 length = reader.ReadInt16(); |
|
209 iResourceCallWaitingSeq = HBufC8::NewL(length); |
|
210 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
211 //edited by Append() |
|
212 TPtr8 appendCallWaiting(iResourceCallWaitingSeq->Des()); |
|
213 |
|
214 for (i = 0; i < length; i++) |
|
215 { |
|
216 appendCallWaiting.Append(reader.ReadUint16()); |
|
217 } |
|
218 |
|
219 //DataCalTone |
|
220 reader.SetBuffer(dataCallTone); |
|
221 length = reader.ReadInt16(); |
|
222 iPlayDataSequence = HBufC8::NewL(length); |
|
223 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
224 //edited by Append() |
|
225 TPtr8 appendDataCallTone(iPlayDataSequence->Des()); |
|
226 |
|
227 for (i = 0; i < length; i++) |
|
228 { |
|
229 appendDataCallTone.Append(reader.ReadUint16()); |
|
230 } |
|
231 |
|
232 //NoSoundSequence |
|
233 reader.SetBuffer(noSoundSequence); |
|
234 length = reader.ReadInt16(); |
|
235 iPlayNoSoundSequence = HBufC8::NewL(length); |
|
236 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
237 //edited by Append() |
|
238 TPtr8 appendNoSoundSequence(iPlayNoSoundSequence->Des()); |
|
239 |
|
240 for (i = 0; i < length; i++) |
|
241 { |
|
242 appendNoSoundSequence.Append(reader.ReadUint16()); |
|
243 } |
|
244 |
|
245 //BeepSequence |
|
246 reader.SetBuffer(beepSequence); |
|
247 length = reader.ReadInt16(); |
|
248 iPlayBeepSequence = HBufC8::NewL(length); |
|
249 //Tptr modifies member variables (HBufC8) length so it includes the memory |
|
250 //edited by Append() |
|
251 TPtr8 appendBeepSequence(iPlayBeepSequence->Des()); |
|
252 |
|
253 for (i = 0; i < length; i++) |
|
254 { |
|
255 appendBeepSequence.Append(reader.ReadUint16()); |
|
256 } |
|
257 |
|
258 delete dataCallTone; |
|
259 delete noSoundSequence; |
|
260 delete beepSequence; |
|
261 delete resourceBusy; |
|
262 delete resourceReorder; |
|
263 delete resourceCongestion; |
|
264 delete resourceSpecial; |
|
265 delete resourceRadioPath; |
|
266 delete resourceRingGoing; |
|
267 delete resourceCallWaiting; |
|
268 TRACE_PRN_FN_EXT; |
|
269 } |
144 } |
270 |
145 |
271 // ----------------------------------------------------------------------------- |
146 // ----------------------------------------------------------------------------- |
272 // TMSAudioInbandTonePlayer::PlayInbandTone |
147 // TMSAudioInbandTonePlayer::PlayInbandTone |
273 // Searches the given Inband tone from iToneArray and calls PlayCurrentTone. |
148 // Searches the given Inband tone from iToneArray and calls PlayCurrentTone. |
274 // ----------------------------------------------------------------------------- |
149 // ----------------------------------------------------------------------------- |
275 // |
150 // |
276 void TMSAudioInbandTonePlayer::PlayInbandTone( |
151 void TMSAudioInbandTonePlayer::PlayInbandTone(TMSInbandToneType tone) |
277 /*TCCPTone*/TMSInbandToneType aTone) |
152 { |
278 { |
153 TRACE_PRN_FN_ENT; |
279 TRACE_PRN_FN_ENT; |
154 |
280 //Stop playing if there is something playing |
155 // First stop any ongoing playback |
281 Cancel(); |
156 Cancel(); |
282 |
|
283 UpdateTonePlayerVolume(); |
157 UpdateTonePlayerVolume(); |
284 |
158 iToneName = tone; |
285 iToneName = aTone; |
159 |
286 |
160 if (iPlayer && (tone >= 0 && tone < iTones.Count())) |
287 TPtr8 resourceBusySeq = iResourceBusySeq -> Des(); |
161 { |
288 TPtr8 resourceRadioPathSeq = iResourceRadioPathSeq -> Des(); |
162 iPlayer->PrepareToPlayDesSequence(iTones[tone]->Des()); |
289 TPtr8 resourceCongestionSeq = iResourceCongestionSeq -> Des(); |
|
290 TPtr8 resourceSpecialSeq = iResourceSpecialSeq -> Des(); |
|
291 TPtr8 resourceReorderSeq = iResourceReorderSeq->Des(); |
|
292 TPtr8 resourceRingGoingSeq = iResourceRingGoingSeq -> Des(); |
|
293 TPtr8 resourceCallWaitingSeq = iResourceCallWaitingSeq -> Des(); |
|
294 |
|
295 switch (aTone) |
|
296 { |
|
297 case TMS_INBAND_USER_BUSY://ECCPToneUserBusy: |
|
298 iCurrent->PrepareToPlayDesSequence(resourceBusySeq); |
|
299 break; |
|
300 case TMS_INBAND_RADIO_PATH_NOT_AVAIL://ECCPToneRadioPathNotAvailable: |
|
301 iCurrent->PrepareToPlayDesSequence(resourceRadioPathSeq); |
|
302 break; |
|
303 case TMS_INBAND_CONGESTION://ECCPToneCongestion: |
|
304 iCurrent->PrepareToPlayDesSequence(resourceCongestionSeq); |
|
305 break; |
|
306 case TMS_INBAND_SPECIAL_INFO://ECCPToneSpecialInformation: |
|
307 iCurrent->PrepareToPlayDesSequence(resourceSpecialSeq); |
|
308 break; |
|
309 case TMS_INBAND_REORDER://ECCPReorder: |
|
310 iCurrent->PrepareToPlayDesSequence(resourceReorderSeq); |
|
311 break; |
|
312 case TMS_INBAND_REMOTE_ALEARTING://ECCPRemoteAlerting: |
|
313 iCurrent->PrepareToPlayDesSequence(resourceRingGoingSeq); |
|
314 break; |
|
315 case TMS_INBAND_CALL_WAITING://ECCPCallWaiting: |
|
316 iCurrent->PrepareToPlayDesSequence(resourceCallWaitingSeq); |
|
317 break; |
|
318 case TMS_INBAND_NO_SEQUENCE://ECCPNoSoundSequence: |
|
319 break; |
|
320 default: |
|
321 break; |
|
322 } |
163 } |
323 TRACE_PRN_FN_EXT; |
164 TRACE_PRN_FN_EXT; |
324 } |
165 } |
325 |
166 |
326 // ----------------------------------------------------------------------------- |
167 // ----------------------------------------------------------------------------- |
356 // ----------------------------------------------------------------------------- |
197 // ----------------------------------------------------------------------------- |
357 // |
198 // |
358 void TMSAudioInbandTonePlayer::PlayCurrentTone() |
199 void TMSAudioInbandTonePlayer::PlayCurrentTone() |
359 { |
200 { |
360 TRACE_PRN_FN_ENT; |
201 TRACE_PRN_FN_ENT; |
361 if (iCurrent) |
202 if (iPlayer) |
362 { |
203 { |
363 if (iCurrent->State() == EMdaAudioToneUtilityPrepared) |
204 if (iPlayer->State() == EMdaAudioToneUtilityPrepared) |
364 { |
205 { |
365 UpdateTonePlayerVolume(); |
206 UpdateTonePlayerVolume(); |
366 |
207 |
367 switch (iToneName) |
208 switch (iToneName) |
368 { |
209 { |
369 case TMS_INBAND_USER_BUSY://ECCPToneUserBusy: |
210 case TMS_INBAND_USER_BUSY: |
370 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
211 SetToneAttributes(KAudioPrefBusy); |
371 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
212 break; |
372 iCurrent->SetPriority(KAudioPriorityNetMsg, |
213 case TMS_INBAND_RADIO_PATH_NOT_AVAIL: |
373 static_cast<TMdaPriorityPreference> ( |
214 SetToneAttributes(KAudioPrefRadioNotAvailable); |
374 KAudioPrefBusy)); |
215 break; |
375 break; |
216 case TMS_INBAND_CONGESTION: |
376 case TMS_INBAND_RADIO_PATH_NOT_AVAIL://ECCPToneRadioPathNotAvailable: |
217 SetToneAttributes(KAudioPrefCongestion); |
377 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
218 break; |
378 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
219 case TMS_INBAND_SPECIAL_INFO: |
379 iCurrent->SetPriority(KAudioPriorityNetMsg, |
220 SetToneAttributes(KAudioPrefSpecialInformation); |
380 static_cast<TMdaPriorityPreference> ( |
221 break; |
381 KAudioPrefRadioNotAvailable)); |
222 case TMS_INBAND_REORDER: |
382 break; |
223 SetToneAttributes(KAudioPrefReorder); |
383 case TMS_INBAND_CONGESTION://ECCPToneCongestion: |
224 break; |
384 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
225 case TMS_INBAND_REMOTE_ALEARTING: |
385 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
226 SetToneAttributes(KAudioPrefRingGoing); |
386 iCurrent->SetPriority(KAudioPriorityNetMsg, |
227 break; |
387 static_cast<TMdaPriorityPreference> ( |
228 case TMS_INBAND_CALL_WAITING: |
388 KAudioPrefCongestion)); |
229 SetToneAttributes(KAudioPrefCallWaiting, |
389 break; |
230 KAudioPriorityNetMsg, 0); |
390 case TMS_INBAND_SPECIAL_INFO://ECCPToneSpecialInformation: |
231 break; |
391 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
232 case TMS_INBAND_DATA_CALL: |
392 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
233 SetToneAttributes(KAudioPrefIncomingDataCall, |
393 iCurrent->SetPriority(KAudioPriorityNetMsg, |
234 KAudioPriorityPhoneCall); |
394 static_cast<TMdaPriorityPreference> ( |
235 |
395 KAudioPrefSpecialInformation)); |
236 // if ( iRingingType == EProfileRingingTypeAscending ) |
396 break; |
237 // { |
397 case TMS_INBAND_REORDER://ECCPReorder: |
238 // iPlayer->SetVolumeRamp( |
398 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
239 // TTimeIntervalMicroSeconds( KPERingingToneRampDuration ) ); |
399 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
240 // } |
400 iCurrent->SetPriority(KAudioPriorityNetMsg, |
241 // else |
401 static_cast<TMdaPriorityPreference> ( |
242 // { |
402 KAudioPrefReorder)); |
243 // EProfileRingingTypeRinging, EProfileRingingTypeRingingOnce |
403 break; |
244 iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds( |
404 case TMS_INBAND_REMOTE_ALEARTING://ECCPRemoteAlerting: |
|
405 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
|
406 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
|
407 iCurrent->SetPriority(KAudioPriorityNetMsg, |
|
408 static_cast<TMdaPriorityPreference> ( |
|
409 KAudioPrefRingGoing)); |
|
410 break; |
|
411 case TMS_INBAND_CALL_WAITING://ECCPCallWaiting: |
|
412 iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds( |
|
413 KPhoneInbandToneZero)); |
245 KPhoneInbandToneZero)); |
414 iCurrent->SetPriority(KAudioPriorityNetMsg, |
246 // } |
415 static_cast<TMdaPriorityPreference> ( |
247 // if ( iRingingType == EProfileRingingTypeRingingOnce ) |
416 KAudioPrefCallWaiting)); |
248 // { |
417 break; |
249 // iPlayer->SetRepeats(0, TTimeIntervalMicroSeconds( |
418 case TMS_INBAND_DATA_CALL://ECCPDataCallTone: //EProfileRingingTypeRinging, EProfileRingingTypeAscending, EProfileRingingTypeRingingOnce |
250 // KPhoneInbandToneZero)); |
419 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
251 // } |
420 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
252 break; |
421 iCurrent->SetPriority(KAudioPriorityPhoneCall, |
253 case TMS_INBAND_NO_SEQUENCE: |
422 static_cast<TMdaPriorityPreference> ( |
254 case TMS_INBAND_BEEP_SEQUENCE: |
423 KAudioPrefIncomingDataCall)); |
255 SetToneAttributes(KAudioPrefIncomingCall, |
424 |
256 KAudioPriorityPhoneCall); |
425 // if ( iRingingType == EProfileRingingTypeAscending ) |
257 |
426 // { |
258 //iPlayer->SetRepeats(0, TTimeIntervalMicroSeconds( |
427 // iCurrent->SetVolumeRamp( |
259 // KPhoneInbandToneZero)); |
428 // TTimeIntervalMicroSeconds( KPERingingToneRampDuration ) ); |
260 iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds( |
429 // } |
|
430 // else |
|
431 // { |
|
432 //EProfileRingingTypeRinging, EProfileRingingTypeRingingOnce |
|
433 iCurrent->SetVolumeRamp(TTimeIntervalMicroSeconds( |
|
434 KPhoneInbandToneZero)); |
261 KPhoneInbandToneZero)); |
435 // } |
|
436 // if ( iRingingType == EProfileRingingTypeRingingOnce ) |
|
437 // { |
|
438 iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds( |
|
439 KPhoneInbandToneZero)); |
|
440 // } |
|
441 break; |
|
442 case TMS_INBAND_NO_SEQUENCE://ECCPNoSoundSequence: |
|
443 case TMS_INBAND_BEEP_SEQUENCE://ECCPBeepSequence: |
|
444 iCurrent->SetRepeats(KMdaAudioToneRepeatForever, |
|
445 TTimeIntervalMicroSeconds(KPhoneInbandToneZero)); |
|
446 iCurrent->SetPriority( |
|
447 KAudioPriorityPhoneCall, |
|
448 static_cast<TMdaPriorityPreference> ( |
|
449 KAudioPrefIncomingCall)); |
|
450 iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds( |
|
451 KPhoneInbandToneZero)); |
|
452 iCurrent->SetVolumeRamp(TTimeIntervalMicroSeconds( |
|
453 KPhoneInbandToneZero)); |
|
454 break; |
262 break; |
455 default: |
263 default: |
456 break; |
264 break; |
457 } |
265 } |
458 |
266 #ifndef __WINS__ |
459 #ifdef __WINS__ |
|
460 |
|
461 #else |
|
462 //Play the tone |
267 //Play the tone |
463 iCurrent->Play(); |
268 iPlayer->Play(); |
464 #endif |
269 #endif |
465 |
270 } |
466 } // State() |
271 } |
467 } //iCurrent |
272 TRACE_PRN_FN_EXT; |
468 TRACE_PRN_FN_EXT; |
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // TMSAudioInbandTonePlayer::SetToneAttributes |
|
277 // |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 void TMSAudioInbandTonePlayer::SetToneAttributes(const guint pref, |
|
281 const guint priority, const gint repeatTimes, const gint trailSilence) |
|
282 { |
|
283 iPlayer->SetRepeats(repeatTimes, TTimeIntervalMicroSeconds(trailSilence)); |
|
284 iPlayer->SetPriority(priority, static_cast<TMdaPriorityPreference> (pref)); |
469 } |
285 } |
470 |
286 |
471 // ----------------------------------------------------------------------------- |
287 // ----------------------------------------------------------------------------- |
472 // TMSAudioInbandTonePlayer::MatoPrepareComplete |
288 // TMSAudioInbandTonePlayer::MatoPrepareComplete |
473 // Updates flag values and plays current inbandtone. |
289 // Updates flag values and plays current inbandtone. |
486 |
302 |
487 // ----------------------------------------------------------------------------- |
303 // ----------------------------------------------------------------------------- |
488 // TMSAudioInbandTonePlayer::SetVolume |
304 // TMSAudioInbandTonePlayer::SetVolume |
489 // ----------------------------------------------------------------------------- |
305 // ----------------------------------------------------------------------------- |
490 // |
306 // |
491 void TMSAudioInbandTonePlayer::SetVolume(TInt aVolume) |
307 void TMSAudioInbandTonePlayer::SetVolume(gint volume) |
492 { |
308 { |
493 TRACE_PRN_FN_ENT; |
309 TRACE_PRN_FN_ENT; |
494 TInt safeVolume = Max(Min(aVolume, KPhoneInbandVolumeMax), |
310 gint safeVolume = Max(Min(volume, KPhoneInbandVolumeMax), |
495 KPhoneInbandVolumeMin); |
311 KPhoneInbandVolumeMin); |
496 |
312 |
497 if (iCurrent && EMdaAudioToneUtilityNotReady != iCurrent->State()) |
313 if (iPlayer) |
498 { |
314 { |
499 TInt mediaServerVolume = CalculateMediaServerVolume(safeVolume); |
315 gint mediaServerVolume = CalculateMediaServerVolume(safeVolume); |
500 iCurrent->SetVolume(mediaServerVolume); |
316 if (EMdaAudioToneUtilityNotReady != iPlayer->State()) |
|
317 { |
|
318 iPlayer->SetVolume(mediaServerVolume); |
|
319 } |
501 } |
320 } |
502 TRACE_PRN_FN_EXT; |
321 TRACE_PRN_FN_EXT; |
503 } |
322 } |
504 |
323 |
505 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
506 // TMSAudioInbandTonePlayer::MatoPlayComplete |
325 // TMSAudioInbandTonePlayer::MatoPlayComplete |
507 // - |
326 // - |
508 // (other items were commented in a header). |
327 // (other items were commented in a header). |
509 // ----------------------------------------------------------------------------- |
328 // ----------------------------------------------------------------------------- |
510 // |
329 // |
511 void TMSAudioInbandTonePlayer::MatoPlayComplete(TInt aError) |
330 void TMSAudioInbandTonePlayer::MatoPlayComplete(TInt /*aError*/) |
512 { |
331 { |
513 TRACE_PRN_FN_ENT; |
332 TRACE_PRN_FN_ENT; |
514 if (aError != KErrNone) |
333 // TODO: process error? |
515 { |
|
516 } |
|
517 TRACE_PRN_FN_EXT; |
334 TRACE_PRN_FN_EXT; |
518 } |
335 } |
519 |
336 |
520 // ----------------------------------------------------------------------------- |
337 // ----------------------------------------------------------------------------- |
521 // TMSAudioInbandTonePlayer::CalculateMediaServerVolume |
338 // TMSAudioInbandTonePlayer::CalculateMediaServerVolume |
522 // ----------------------------------------------------------------------------- |
339 // ----------------------------------------------------------------------------- |
523 // |
340 // |
524 TInt TMSAudioInbandTonePlayer::CalculateMediaServerVolume(TInt aVolume) const |
341 gint TMSAudioInbandTonePlayer::CalculateMediaServerVolume(gint volume) const |
525 { |
342 { |
526 TRACE_PRN_FN_ENT; |
343 TRACE_PRN_FN_ENT; |
527 TRACE_PRN_FN_EXT; |
344 TRACE_PRN_FN_EXT; |
528 // Our volume level scale is 0...10, media server's can be anything. |
345 // Our volume level scale is 0...10, media server's can be anything. |
529 // This scales the volume to correct level. |
346 // This scales the volume to correct level. |
530 return (iCurrent->MaxVolume() * aVolume) / |
347 return (iPlayer->MaxVolume() * volume) / |
531 (KPhoneInbandVolumeMax - KPhoneInbandVolumeMin); |
348 (KPhoneInbandVolumeMax - KPhoneInbandVolumeMin); |
532 } |
349 } |
533 |
350 |
534 // ----------------------------------------------------------------------------- |
351 // ----------------------------------------------------------------------------- |
535 // TMSAudioInbandTonePlayer::UpdateTonePlayerVolume |
352 // TMSAudioInbandTonePlayer::UpdateTonePlayerVolume |
536 // ----------------------------------------------------------------------------- |
353 // ----------------------------------------------------------------------------- |
537 // |
354 // |
538 void TMSAudioInbandTonePlayer::UpdateTonePlayerVolume() |
355 void TMSAudioInbandTonePlayer::UpdateTonePlayerVolume() |
539 { |
356 { |
540 TRACE_PRN_FN_ENT; |
357 TRACE_PRN_FN_ENT; |
541 TInt volume( /*KPhoneInbandVolumeMin*/KPhoneInbandVolumeMax); |
358 gint volume( /*KPhoneInbandVolumeMin*/KPhoneInbandVolumeMax); |
542 // iOwner.GetAudioVolumeSync( volume ); |
|
543 SetVolume(volume); |
359 SetVolume(volume); |
544 TRACE_PRN_FN_EXT; |
360 TRACE_PRN_FN_EXT; |
545 } |
361 } |
546 |
362 |
547 // End of File |
363 // End of File |