119 /** |
118 /** |
120 * Continues video playback ( and ringing tone ) with volume 0 |
119 * Continues video playback ( and ringing tone ) with volume 0 |
121 * Stream not closed ( If music player was ongoing ) |
120 * Stream not closed ( If music player was ongoing ) |
122 */ |
121 */ |
123 void MuteRingingToneOnAnswer(); |
122 void MuteRingingToneOnAnswer(); |
124 |
123 |
125 /** |
124 /** |
126 * Continues video playback with muted audio. |
125 * Continues video playback with muted audio. |
127 * Ringing tone is stopped. |
126 * Ringing tone is stopped. |
128 */ |
127 */ |
129 void MuteRingingTone(); |
128 void MuteRingingTone(); |
130 |
129 |
131 /** |
130 /** |
132 * Sets video player. |
131 * Sets video player. |
133 * @since Series 60 v3.2 |
132 * @since Series 60 v3.2 |
134 * @param aVideoPlayer Video player reference. |
133 * @param aVideoPlayer Video player reference. |
135 */ |
134 */ |
136 void SetVideoPlayer( MPhoneVideoPlayer* aVideoPlayer ); |
135 void SetVideoPlayer( MPhoneVideoPlayer* aVideoPlayer ); |
137 |
|
138 |
136 |
139 /** |
137 /** |
140 * Play TTS tone simultaneously with Personal or Default tones. |
138 * Play TTS tone simultaneously with Personal or Default tones. |
141 * This method does not command phone to play TTS immediately. Instead |
139 * This method does not command phone to play TTS immediately. Instead |
142 * it registers a request to play TTS, when Personal or default tones |
140 * it registers a request to play TTS, when Personal or default tones |
196 |
186 |
197 |
187 |
198 private: |
188 private: |
199 |
189 |
200 /** |
190 /** |
201 * Handle the error of audio file player. |
|
202 */ |
|
203 virtual void HandleAudioPlayerError( |
|
204 TPhoneAudioPlayerErrorEvent aEvent, |
|
205 TInt aError, |
|
206 TInt aId = KPhoneAudioPlayerNotSpecified ); |
|
207 |
|
208 /** |
|
209 * Handle audio player initialize complete. |
|
210 */ |
|
211 virtual void HandleAudioPlayerInitComplete( |
|
212 TInt aId = KPhoneAudioPlayerNotSpecified ); |
|
213 |
|
214 /** |
|
215 * Handle auido file playing complete successfully. |
|
216 */ |
|
217 virtual void HandlePlayingComplete( |
|
218 TInt aId = KPhoneAudioPlayerNotSpecified ); |
|
219 |
|
220 /** |
|
221 * @see MPhoneTimer |
191 * @see MPhoneTimer |
222 */ |
192 */ |
223 virtual void HandleTimeOutL(); |
193 virtual void HandleTimeOutL(); |
224 |
194 |
225 /** |
195 /** |
226 * HandleVideoPlayerError |
196 * This function is called for video player errors. |
|
197 * @param aEvent The error event happend in initializing or playing. |
|
198 * @param aError The error code return by MMF video player. |
227 */ |
199 */ |
228 virtual void HandleVideoPlayerError( |
200 virtual void HandleVideoPlayerError( |
229 TPhoneVideoPlayerErrorEvent aEvent, |
201 TPhoneVideoPlayerErrorEvent aEvent, |
230 TInt aError ); |
202 TInt aError ); |
231 |
203 |
232 /** |
204 /** |
233 * HandleVideoPlayerInitComplete |
205 * This function is called when video player initialization complete |
234 */ |
206 */ |
235 virtual void HandleVideoPlayerInitComplete(); |
207 virtual void HandleVideoPlayerInitComplete(); |
236 |
208 |
237 /** |
209 /** |
238 * HandleVideoPlayerPlayingComplete |
210 * This function is called after the playing completes successfully |
239 */ |
211 */ |
240 virtual void HandleVideoPlayerPlayingComplete(); |
212 virtual void HandleVideoPlayerPlayingComplete(); |
241 |
213 |
242 /** |
|
243 * Enumerates identifiers for each player: |
|
244 * EPlayerAudio - audio |
|
245 * EPlayerBeepOnce - beep once |
|
246 * EPlayerSilent - silent |
|
247 * EPlayerDefault - default |
|
248 * EPlayerBackup - backup |
|
249 * |
|
250 * EPlayerFirst and EPlayerLast are alias |
|
251 * to other identifiers. |
|
252 * EPlayerFirst - first player |
|
253 * EPlayerLast - last player |
|
254 */ |
|
255 enum TPlayerId |
|
256 { |
|
257 EPlayerFirst, |
|
258 EPlayerAudio = EPlayerFirst, |
|
259 EPlayerBeepOnce, |
|
260 EPlayerSilent, |
|
261 EPlayerUnsecureVoIP, |
|
262 EPlayerDefault, |
|
263 EPlayerBackup, |
|
264 EPlayerTts, |
|
265 EPlayerLast = EPlayerTts, |
|
266 EPlayerCount |
|
267 }; |
|
268 |
|
269 /** |
|
270 * Enumerates how many times TTs is played |
|
271 * ESaidOnce -once |
|
272 * ESaidTwice twice |
|
273 */ |
|
274 enum TTtsStatus |
|
275 { |
|
276 ESaidOnce, |
|
277 ESaidTwice |
|
278 }; |
|
279 |
|
280 /** |
214 /** |
281 * C++ default constructor. |
215 * C++ default constructor. |
282 */ |
216 */ |
283 CPhoneRingingTonePlayerAO(); |
217 CPhoneRingingTonePlayerAO(); |
284 |
218 |
285 /** |
219 /** |
286 * By default Symbian OS constructor is private. |
220 * Symbian 2nd phase constructor. |
287 */ |
221 */ |
288 void ConstructL(); |
222 void ConstructL(); |
289 |
223 |
290 /** |
224 /** |
291 * Play default tone. |
225 * Play default tone. |
304 void PlayBackupTone( |
238 void PlayBackupTone( |
305 TInt aVolume, |
239 TInt aVolume, |
306 TProfileRingingType aRingingType ); |
240 TProfileRingingType aRingingType ); |
307 |
241 |
308 /** |
242 /** |
309 * Do construct tone. |
|
310 * @param aRingingTone Ringing tone. |
|
311 * @return The instance of the player. NULL is returned if it's failed. |
|
312 */ |
|
313 CPhoneAudioPlayer* ConstructTonePlayer( |
|
314 const CPhoneRingingTone& aRingingTone, |
|
315 TInt aId ); |
|
316 |
|
317 /** |
|
318 * Handle audio player error. |
|
319 * @param aDelete ETrue if deletion of the player allowed, |
|
320 * EFalse otherwise. |
|
321 * @param aSync ETrue if synchronous deletion of players is allowed, |
|
322 * EFalse otherwise. |
|
323 */ |
|
324 void DoHandlePlayerError( |
|
325 TBool aDelete, |
|
326 TBool aSync ); |
|
327 |
|
328 /** |
|
329 * Convert ringing type from PhoneAppEnging to the ringing type in |
|
330 * CPhoneAudioPlayer. |
|
331 * @param aRingingType the ringing type form PhoneAppEngine. |
|
332 * @return ringing type of CPhoneAudioPlayer. |
|
333 */ |
|
334 CPhoneAudioPlayer::TRingingType ConvertRingingType( |
|
335 TProfileRingingType aRingingType ); |
|
336 |
|
337 /** |
|
338 * Convert ringing type from PhoneAppEnging to the ringing type in |
243 * Convert ringing type from PhoneAppEnging to the ringing type in |
339 * MPhoneVideoPlayer. |
244 * MPhoneVideoPlayer. |
340 * @since Series 60 3.1 |
245 * @since Series 60 3.1 |
341 * @param aRingingType the ringing type form PhoneAppEngine. |
246 * @param aRingingType the ringing type form PhoneAppEngine. |
342 * @return ringing type of MPhoneVideoPlayer. |
247 * @return ringing type of MPhoneVideoPlayer. |
343 */ |
248 */ |
344 MPhoneVideoPlayer::TPlayMode ConvertVideoRingingType( |
249 MPhoneVideoPlayer::TPlayMode ConvertVideoRingingType( |
345 TProfileRingingType aRingingType ); |
250 TProfileRingingType aRingingType ); |
346 |
251 |
347 /** |
|
348 * Construct media server and backup tone player. |
|
349 */ |
|
350 TInt ConstructPlayers(); |
|
351 |
|
352 /** |
|
353 * Construct media server and backup tone player. |
|
354 */ |
|
355 void ConstructPlayersL(); |
|
356 |
|
357 /** |
|
358 * Construct sequence players. |
|
359 * @param aPlayer player to be constructed. |
|
360 */ |
|
361 void ConstructSequencePlayer( |
|
362 TPlayerId aPlayer ); |
|
363 |
|
364 /** |
|
365 * Construct sequence players. |
|
366 * @param aPlayer player to be constructed. |
|
367 */ |
|
368 void ConstructSequencePlayerL( |
|
369 TPlayerId aPlayer ); |
|
370 |
|
371 /** |
|
372 * Cleanup players. |
|
373 */ |
|
374 void CleanupPlayers(); |
|
375 |
|
376 /** |
|
377 * Deletes player asynchronoysly. |
|
378 * @param aPlayer player to be deleted. |
|
379 */ |
|
380 void DeletePlayerAsync( |
|
381 TPlayerId aPlayer ); |
|
382 /** |
252 /** |
383 * Plays default L1 or L2 video ring tone asynchronously. |
253 * Plays default L1 or L2 video ring tone asynchronously. |
384 * @since Series 60 3.1 |
254 * @since Series 60 3.1 |
385 */ |
255 */ |
386 void PlayDefaultVideoAsync(); |
256 void PlayDefaultVideoAsync(); |
399 |
269 |
400 /** |
270 /** |
401 * @see CActive::DoCancel. |
271 * @see CActive::DoCancel. |
402 */ |
272 */ |
403 void DoCancel(); |
273 void DoCancel(); |
404 |
274 |
405 /** |
|
406 * Wrapper of DoHandleTtsDelayTimeout, that can be used as TCallback. |
|
407 * Immediately passes control to DoHandleTtsDelayTimeout method. |
|
408 * @since Series 60 3.0 |
|
409 * @param object Object to call DoHandleTtsDelayTimeout() on, . |
|
410 * instance of CPhoneRingingTonePlayer. |
|
411 * @return KErrNone. |
|
412 */ |
|
413 static TInt HandleTtsDelayTimeout( TAny* object ); |
|
414 |
|
415 /** |
|
416 * It is called after TTS delay elapsed. Starts playing TTS. |
|
417 */ |
|
418 void DoHandleTtsDelayTimeout(); |
|
419 |
|
420 /** |
|
421 * Checks if TTS component should be played for the current ringtone |
|
422 * playback and initializes the TTS playback. This method is to be |
|
423 * called from within PlayXXXXTone methods |
|
424 * @since Series 60 3.0 |
|
425 * @param aRingingType ringing type |
|
426 */ |
|
427 void AddTtsPlaybackIfNeeded( TProfileRingingType aRingingType ); |
|
428 |
|
429 /** |
|
430 * Returns currently active player which is used wit TTS player. |
|
431 * @return pointer to CPhoneAudioPlayer. |
|
432 */ |
|
433 CPhoneAudioPlayer* GetCurrentlyActiveAudioPlayerWithTTs(); |
|
434 |
|
435 /** |
|
436 * TTs cases only. Calculates new volume and ramptimes |
|
437 * for Ascending TTS ringing case and normal TTS ringing case. |
|
438 * @param aStatus -status of TTs player. |
|
439 */ |
|
440 void SolveNewVolumeAndRamptime( TTtsStatus aStatus ); |
|
441 |
|
442 /** |
|
443 * Retarts currently active ringingtone player. |
|
444 */ |
|
445 void ReStartRingingTonePlayer(); |
|
446 |
|
447 /** |
275 /** |
448 * Checks if ringing tone file's size is larger than the size limit. |
276 * Checks if ringing tone file's size is larger than the size limit. |
449 * If size limit is exceeded, default tone is played instead. |
277 * If size limit is exceeded, default tone is played instead. |
450 * @since 3.1 |
278 * @since 3.1 |
451 * @param aRingingTone Tone to check. |
279 * @param aRingingTone Tone to check. |
475 * @since 3.1 |
303 * @since 3.1 |
476 * @param aSizeLimitKB the size limit in kB is read to this variable. |
304 * @param aSizeLimitKB the size limit in kB is read to this variable. |
477 * @return leaves on error. |
305 * @return leaves on error. |
478 */ |
306 */ |
479 void GetMaxToneFileSizeL( TInt& aSizeLimitKB ) const; |
307 void GetMaxToneFileSizeL( TInt& aSizeLimitKB ) const; |
480 |
|
481 /** |
|
482 * Returns currently active audio player. |
|
483 * @return Currently active audio player or NULL if none active. |
|
484 */ |
|
485 CPhoneAudioPlayer* ActiveAudioPlayer(); |
|
486 |
|
487 /** |
|
488 * Mutes the ringing tone. |
|
489 */ |
|
490 void DoMuteRingingTone(); |
|
491 |
|
492 |
308 |
493 private: // Data |
309 private: // Data |
494 |
|
495 // Audio ring tone player. Memory allocated during construction. |
|
496 // After constructed, no leave may be caused during audio playing |
|
497 CPhoneAudioPlayer* iAudioPlayer; |
|
498 |
|
499 // Audio player for beep once. |
|
500 CPhoneAudioPlayer* iBeepOncePlayer; |
|
501 |
|
502 // Audio player for silent tone. |
|
503 CPhoneAudioPlayer* iSilentPlayer; |
|
504 |
|
505 // Audio player for unsecure VoIP tone. |
|
506 CPhoneAudioPlayer* iUnsecureVoIPTonePlayer; |
|
507 |
|
508 // Default player. |
|
509 CPhoneAudioPlayer* iDefaultPlayer; |
|
510 |
|
511 // Tts player. |
|
512 CPhoneAudioPlayer* iTtsPlayer; |
|
513 |
|
514 // Backup ringing tone. Incase all default player failed. |
|
515 CPhoneAudioPlayer* iBackupPlayer; |
|
516 |
|
517 // Default player |
|
518 CPhoneRingingTone* iDefaultRingingTone; |
|
519 |
|
520 // Media server. |
|
521 CMdaServer* iMdaServer; |
|
522 |
310 |
523 // Indicate which tone is playing or need to be played: |
311 // Indicate which tone is playing or need to be played: |
524 // EIdle - idle, |
312 // EIdle - idle, |
525 // EAudioTonePlaying - audio playing, |
|
526 // EBeepOnce - beep once playing, |
|
527 // ESilentTonePlaying - silent tone playing, |
|
528 // EUnsecureVoIPTonePlaying - unsecure tone playing (VoIP), |
|
529 // EDefaultTonePlaying - default tone playing, |
|
530 // EBackupTonePlaying - backup tone playing, |
|
531 // EVideoTonePlaying - playing video ringing tone |
313 // EVideoTonePlaying - playing video ringing tone |
532 // ESilentVideoTonePlaying - silent playing video ringing tone |
314 // ESilentVideoTonePlaying - silent playing video ringing tone |
533 // EPersonalVideoTonePlaying - personal playing video ringing tone |
315 // EPersonalVideoTonePlaying - personal playing video ringing tone |
534 enum TTonePlayingStatus |
316 enum TTonePlayingStatus |
535 { |
317 { |
536 EIdle, |
318 EIdle, |
537 EAudioTonePlaying, |
|
538 EBeepOnce, |
|
539 ESilentTonePlaying, |
|
540 EUnsecureVoIPTonePlaying, |
|
541 EDefaultTonePlaying, |
|
542 EBackupTonePlaying, |
|
543 EVideoTonePlaying, |
319 EVideoTonePlaying, |
544 ESilentVideoTonePlaying, |
320 ESilentVideoTonePlaying, |
545 EPersonalVideoTonePlaying |
321 EPersonalVideoTonePlaying |
546 }; |
322 }; |
547 |
323 |
548 // Current playing status. |
324 // Current playing status. |
549 TTonePlayingStatus iTonePlayingStatus; |
325 TTonePlayingStatus iTonePlayingStatus; |
550 |
|
551 // True if Tts is currently playing. Is different from |
|
552 // iTonePlayingStatus, because TTS is played in |
|
553 // parallel with the other tone types |
|
554 TBool iTtsTonePlaying; |
|
555 |
|
556 // Index of the TTS delay that is "executed" currently or is to be |
|
557 // "executed" after the current playing of the TTS tone. Is zero based |
|
558 TInt iTtsDelayIndex; |
|
559 |
|
560 // True if TTS tone should be played when the next playing of the |
|
561 // default or personal tone is fired. |
|
562 TBool iTtsToneToBePlayed; |
|
563 |
326 |
564 // Audio/Video tone, not owned |
327 // Audio/Video tone, not owned |
565 CPhoneRingingTone* iAudioVideoRingingTone; |
328 CPhoneRingingTone* iAudioVideoRingingTone; |
566 |
329 |
567 // Volume for backup tone playing. |
330 // Volume for backup tone playing. |
568 TInt iVolume; |
331 TInt iVolume; |
569 |
|
570 // Volume of the text pronounced by the TTS engine |
|
571 TInt iTtsVolume; |
|
572 |
332 |
573 // Ringing type for backup tone playing. |
333 // Ringing type for backup tone playing. |
574 TProfileRingingType iRingingType; |
334 TProfileRingingType iRingingType; |
575 |
335 |
576 // Timer. |
336 // Timer. |
577 CPhoneTimer* iTimer; |
337 CPhoneTimer* iTimer; |
578 |
338 |
579 // Timer, that tracks delays before playing TTS |
|
580 CPhoneTimer* iTtsDelayTimer; |
|
581 |
|
582 // Number of times TTS tone should be played for the CURRENT ringtone |
|
583 // If ringing tone is to be played just once, iTtsDelayCount == 1, |
|
584 // otherwise iTtsDelayCount == KTtsDelayCount |
|
585 TInt iTtsDelaysCount; |
|
586 |
|
587 // Player to be deleted asynchronously. |
|
588 RPointerArray<CPhoneAudioPlayer> iAsyncDeletePlayers; |
|
589 |
|
590 // DRM extend security |
339 // DRM extend security |
591 TBool iExtSecNeeded; |
340 TBool iExtSecNeeded; |
592 |
341 |
593 // Video ringing tone player |
342 // Video ringing tone player |
594 MPhoneVideoPlayer* iVideoPlayer; |
343 MPhoneVideoPlayer* iVideoPlayer; |
595 |
344 |
596 // State of this active object |
345 // State of this active object |
597 TState iState; |
346 TState iState; |
598 |
347 |
599 // RingingType for TtsPlayer only. |
|
600 TProfileRingingType iTtsRingingType; |
|
601 |
|
602 // Counter for TTs timeouts |
|
603 TInt iTTsTimeOutCounter; |
|
604 |
|
605 // Voice call ringing tone file size max value. |
348 // Voice call ringing tone file size max value. |
606 TInt iToneFileSizeLimitKB; |
349 TInt iToneFileSizeLimitKB; |
607 |
350 |
608 // Flag. Indicates video scaling capability of the device. |
351 // Flag. Indicates video scaling capability of the device. |
609 TBool iArbitraryVideoScaling; |
352 TBool iArbitraryVideoScaling; |
610 |
353 |
|
354 // Ringing tone server. |
|
355 RPhoneRingingTonePlayer iToneServer; |
|
356 |
611 }; |
357 }; |
612 |
358 |
613 #endif // CPHONERINGINGTONEPLAYERAO_H |
359 #endif // CPHONERINGINGTONEPLAYERAO_H |
614 |
360 |
615 // End of File |
361 // End of File |