equal
deleted
inserted
replaced
86 // CEikKeySoundServer implementation. |
86 // CEikKeySoundServer implementation. |
87 // ================================== |
87 // ================================== |
88 |
88 |
89 TInt CEikKeySoundServer::LaunchServer(TThreadId& aThreadId) |
89 TInt CEikKeySoundServer::LaunchServer(TThreadId& aThreadId) |
90 { |
90 { |
|
91 LOGTEXT(_L("CEikKeySoundServer::LaunchServer")); |
91 // First, check that ther server isn't already running. |
92 // First, check that ther server isn't already running. |
92 TFindServer findServer(__KEYSOUND_SERVER_NAME); |
93 TFindServer findServer(__KEYSOUND_SERVER_NAME); |
93 TFullName name; |
94 TFullName name; |
94 if (findServer.Next(name) == KErrNone) |
95 if (findServer.Next(name) == KErrNone) |
95 { |
96 { |
190 // construct all system SID objects |
191 // construct all system SID objects |
191 } |
192 } |
192 |
193 |
193 void CEikKeySoundServer::ConstructL() |
194 void CEikKeySoundServer::ConstructL() |
194 { |
195 { |
|
196 LOGTEXT(_L("CEikKeySoundServer::ConstructL")); |
195 iInit = EFalse; |
197 iInit = EFalse; |
196 iSidList = new(ELeave)CArrayFixFlat<TAknSoundID>(KAknSoundInfoMapGranularity); |
198 iSidList = new(ELeave)CArrayFixFlat<TAknSoundID>(KAknSoundInfoMapGranularity); |
197 iSoundList = new(ELeave)CArrayPtrFlat<CEikSoundInfo>(KAknSoundInfoMapGranularity); |
199 iSoundList = new(ELeave)CArrayPtrFlat<CEikSoundInfo>(KAknSoundInfoMapGranularity); |
198 |
200 |
199 // Default to loudest volume |
201 // Default to loudest volume |
240 #endif |
242 #endif |
241 } |
243 } |
242 |
244 |
243 CEikKeySoundServer::~CEikKeySoundServer() |
245 CEikKeySoundServer::~CEikKeySoundServer() |
244 { |
246 { |
|
247 LOGTEXT(_L("CEikKeySoundServer::~CEikKeySoundServer")); |
245 if (iProfilesNotifyHandler) |
248 if (iProfilesNotifyHandler) |
246 { |
249 { |
247 iProfilesNotifyHandler->StopListening(); |
250 iProfilesNotifyHandler->StopListening(); |
248 delete iProfilesNotifyHandler; |
251 delete iProfilesNotifyHandler; |
249 } |
252 } |
262 } |
265 } |
263 |
266 |
264 CSession2* CEikKeySoundServer::NewSessionL(const TVersion& aVersion, |
267 CSession2* CEikKeySoundServer::NewSessionL(const TVersion& aVersion, |
265 const RMessage2& /*aMessage*/) const |
268 const RMessage2& /*aMessage*/) const |
266 { |
269 { |
|
270 LOGTEXT(_L("CEikKeySoundServer::NewSessionL")); |
267 TVersion ver(KKeySoundServMajorVN, KKeySoundServMinorVN, KKeySoundServBuildVN); |
271 TVersion ver(KKeySoundServMajorVN, KKeySoundServMinorVN, KKeySoundServBuildVN); |
268 if (!User::QueryVersionSupported(ver, aVersion)) |
272 if (!User::QueryVersionSupported(ver, aVersion)) |
269 { |
273 { |
270 User::Leave(KErrNotSupported); |
274 User::Leave(KErrNotSupported); |
271 } |
275 } |
288 } |
292 } |
289 } |
293 } |
290 |
294 |
291 void CEikKeySoundServer::PlaySid(TInt aSid, TBool aPlaySelf) |
295 void CEikKeySoundServer::PlaySid(TInt aSid, TBool aPlaySelf) |
292 { |
296 { |
|
297 LOGTEXT1(_L("CEikKeySoundServer::PlaySid aSid: %d"), aSid); |
293 if (aSid == EAvkonSIDWarningTone && iWarningToneEnabled == 0) |
298 if (aSid == EAvkonSIDWarningTone && iWarningToneEnabled == 0) |
294 { |
299 { |
295 // Don't play warning tone, when the warning tone is disabled in setting. |
300 // Don't play warning tone, when the warning tone is disabled in setting. |
296 return; |
301 return; |
297 } |
302 } |
382 } |
387 } |
383 } |
388 } |
384 |
389 |
385 void CEikKeySoundServer::SetDisabledScanCode( TInt aScanCode ) |
390 void CEikKeySoundServer::SetDisabledScanCode( TInt aScanCode ) |
386 { |
391 { |
|
392 LOGTEXT1(_L("CEikKeySoundServer::SetDisabledScanCode aScanCode: %d"), |
|
393 aScanCode); |
387 iDisabledScanCode = aScanCode; |
394 iDisabledScanCode = aScanCode; |
388 } |
395 } |
389 |
396 |
390 TInt CEikKeySoundServer::DisabledScanCode() |
397 TInt CEikKeySoundServer::DisabledScanCode() |
391 { |
398 { |
425 { |
432 { |
426 } |
433 } |
427 |
434 |
428 CEikKeySoundSession::~CEikKeySoundSession() |
435 CEikKeySoundSession::~CEikKeySoundSession() |
429 { |
436 { |
|
437 LOGTEXT1(_L("CEikKeySoundSession::~CEikKeySoundSession iClientUid %d"), |
|
438 iClientUid); |
430 RemoveSids(iClientUid); |
439 RemoveSids(iClientUid); |
431 if (iHasLockedContext) |
440 if (iHasLockedContext) |
432 { |
441 { |
433 if( iServer ) |
442 if( iServer ) |
434 { |
443 { |
435 iServer->SetContextLocked(EFalse); |
444 iServer->SetContextLocked(EFalse); |
436 } |
445 } |
437 } |
446 } |
438 if (iOwnsDefaultSounds) |
447 if (iOwnsDefaultSounds) |
439 { |
448 { |
|
449 LOGTEXT(_L("CEikKeySoundSession::~CEikKeySoundSession OwnsDefaultSounds")); |
440 RemoveSids(0); |
450 RemoveSids(0); |
441 iServer->iInit = EFalse; |
451 iServer->iInit = EFalse; |
442 } |
452 } |
443 if (iSoundStack) |
453 if (iSoundStack) |
444 { |
454 { |
468 } |
478 } |
469 |
479 |
470 |
480 |
471 void CEikKeySoundSession::ServiceL(const RMessage2& aMessage) |
481 void CEikKeySoundSession::ServiceL(const RMessage2& aMessage) |
472 { |
482 { |
|
483 LOGTEXT1(_L("CEikKeySoundSession::ServiceL aMessage: %d"), |
|
484 aMessage.Function()); |
473 if (aMessage.Function() == EKeySoundServerPlayKey) |
485 if (aMessage.Function() == EKeySoundServerPlayKey) |
474 { |
486 { |
475 TInt scancode = aMessage.Int0() & 0xff; |
487 TInt scancode = aMessage.Int0() & 0xff; |
476 TBool repeat = aMessage.Int1(); |
488 TBool repeat = aMessage.Int1(); |
477 aMessage.Complete(KErrNone); |
489 aMessage.Complete(KErrNone); |
581 |
593 |
582 void CEikKeySoundSession::AddSoundIdBufferL(const RMessage2& aMessage) |
594 void CEikKeySoundSession::AddSoundIdBufferL(const RMessage2& aMessage) |
583 { |
595 { |
584 TInt uid = aMessage.Int0(); |
596 TInt uid = aMessage.Int0(); |
585 TInt size = aMessage.Int1(); |
597 TInt size = aMessage.Int1(); |
586 |
598 LOGTEXT1(_L("CEikKeySoundSession::AddSoundIdBufferL uid: %d"), uid); |
587 // CBufFlat requires that size must be positive and not larger than KMaxTInt / 2. |
599 // CBufFlat requires that size must be positive and not larger than KMaxTInt / 2. |
588 // Without this check the KeySoundServer could panic. |
600 // Without this check the KeySoundServer could panic. |
589 if (size <= 0 || size >= ((KMaxTInt / 2) - KKeySoundServerBufExpandSize)) |
601 if (size <= 0 || size >= ((KMaxTInt / 2) - KKeySoundServerBufExpandSize)) |
590 { |
602 { |
591 User::Leave(KErrArgument); |
603 User::Leave(KErrArgument); |
698 iServer->SetVolumeForPreferenceType(KKeyClickPreference, iServer->iKeypadVolume); |
710 iServer->SetVolumeForPreferenceType(KKeyClickPreference, iServer->iKeypadVolume); |
699 } |
711 } |
700 |
712 |
701 void CEikKeySoundSession::RemoveSids(TInt aUid) |
713 void CEikKeySoundSession::RemoveSids(TInt aUid) |
702 { |
714 { |
|
715 LOGTEXT1(_L("CEikKeySoundSession::RemoveSids aUid %d"), aUid); |
703 TUint uid = aUid << 16; |
716 TUint uid = aUid << 16; |
704 if (!iServer->iSidList) |
717 if (!iServer->iSidList) |
705 { |
718 { |
706 return; |
719 return; |
707 } |
720 } |
728 // If no duplicate found, sid is deleted. Else duplicate will be |
741 // If no duplicate found, sid is deleted. Else duplicate will be |
729 // deleted when the for-loop reaches it (unless there is even more duplicates). |
742 // deleted when the for-loop reaches it (unless there is even more duplicates). |
730 if (!duplicateFound) |
743 if (!duplicateFound) |
731 { |
744 { |
732 // Remove sound at this position |
745 // Remove sound at this position |
733 delete id.iSoundInfo; |
746 if(id.iSoundInfo->IsWaittingPlay()) |
|
747 { |
|
748 LOGTEXT1(_L("CEikKeySoundSession::RemoveSids DestroyAfterplay : %d"), |
|
749 (TInt)id.iSoundInfo ); |
|
750 id.iSoundInfo->SetDestroyAfterPlay(ETrue); |
|
751 } |
|
752 else |
|
753 { |
|
754 LOGTEXT1(_L("CEikKeySoundSession::RemoveSids Destroy : %d"), |
|
755 (TInt)id.iSoundInfo ); |
|
756 delete id.iSoundInfo; |
|
757 } |
734 if (iServer->iSoundList) |
758 if (iServer->iSoundList) |
735 { |
759 { |
736 iServer->iSoundList->Delete(ii); |
760 iServer->iSoundList->Delete(ii); |
737 } |
761 } |
738 iServer->iSidList->Delete(ii); |
762 iServer->iSidList->Delete(ii); |
798 } |
822 } |
799 } |
823 } |
800 |
824 |
801 void CEikKeySoundSession::AddToneSidL(const TAknSoundID& aSoundID, CAknToneSoundInfo* aSoundInfo) |
825 void CEikKeySoundSession::AddToneSidL(const TAknSoundID& aSoundID, CAknToneSoundInfo* aSoundInfo) |
802 { |
826 { |
|
827 LOGTEXT(_L("CEikKeySoundSession::AddToneSidL")); |
803 aSoundInfo->InitL(); |
828 aSoundInfo->InitL(); |
804 |
829 |
805 TKeyArrayFix sidKey(_FOFF(TAknSoundID, iSid), ECmpTUint); |
830 TKeyArrayFix sidKey(_FOFF(TAknSoundID, iSid), ECmpTUint); |
806 if (iServer->iSidList && iServer->iSoundList) |
831 if (iServer->iSidList && iServer->iSoundList) |
807 { |
832 { |
816 } |
841 } |
817 |
842 |
818 void CEikKeySoundSession::AddSequenceSidL(const TAknSoundID& aSoundID, |
843 void CEikKeySoundSession::AddSequenceSidL(const TAknSoundID& aSoundID, |
819 CAknSequenceSoundInfo* aSoundInfo) |
844 CAknSequenceSoundInfo* aSoundInfo) |
820 { |
845 { |
|
846 LOGTEXT(_L("CEikKeySoundSession::AddSequenceSidL")); |
821 aSoundInfo->InitL(); |
847 aSoundInfo->InitL(); |
822 |
848 |
823 TKeyArrayFix sidKey(_FOFF(TAknSoundID, iSid), ECmpTUint); |
849 TKeyArrayFix sidKey(_FOFF(TAknSoundID, iSid), ECmpTUint); |
824 |
850 |
825 if (iServer->iSidList && iServer->iSoundList) |
851 if (iServer->iSidList && iServer->iSoundList) |
835 } |
861 } |
836 |
862 |
837 void CEikKeySoundSession::AddFileSidL(const TAknSoundID& aSoundID, CAknFileSoundInfo* aSoundInfo, |
863 void CEikKeySoundSession::AddFileSidL(const TAknSoundID& aSoundID, CAknFileSoundInfo* aSoundInfo, |
838 const TDesC& aFileName) |
864 const TDesC& aFileName) |
839 { |
865 { |
|
866 LOGTEXT(_L("CEikKeySoundSession::AddFileSidL")); |
840 aSoundInfo->InitL(aFileName, NULL); |
867 aSoundInfo->InitL(aFileName, NULL); |
841 |
868 |
842 TKeyArrayFix sidKey(_FOFF(TAknSoundID, iSid), ECmpTUint); |
869 TKeyArrayFix sidKey(_FOFF(TAknSoundID, iSid), ECmpTUint); |
843 if (iServer->iSidList && iServer->iSoundList) |
870 if (iServer->iSidList && iServer->iSoundList) |
844 { |
871 { |
858 |
885 |
859 CEikSoundInfo::CEikSoundInfo(TInt aPriority, TInt aPreference) |
886 CEikSoundInfo::CEikSoundInfo(TInt aPriority, TInt aPreference) |
860 { |
887 { |
861 iPriority = aPriority; |
888 iPriority = aPriority; |
862 iPreference = aPreference; |
889 iPreference = aPreference; |
|
890 iWaittingPlay = EFalse; |
|
891 iDestroyAfterPlay = EFalse; |
863 iVolume = ESoundVolume9; // default to loudest |
892 iVolume = ESoundVolume9; // default to loudest |
864 } |
893 } |
865 |
894 |
866 CEikSoundInfo::~CEikSoundInfo() |
895 CEikSoundInfo::~CEikSoundInfo() |
867 { |
896 { |
875 } |
904 } |
876 |
905 |
877 CEikSoundInfo::TVolumeSetting CEikSoundInfo::Volume() |
906 CEikSoundInfo::TVolumeSetting CEikSoundInfo::Volume() |
878 { |
907 { |
879 return iVolume; |
908 return iVolume; |
|
909 } |
|
910 |
|
911 TBool CEikSoundInfo::IsWaittingPlay() |
|
912 { |
|
913 LOGTEXT1(_L("CEikSoundInfo::IsWaittingPlay : %d"), iWaittingPlay); |
|
914 return iWaittingPlay; |
|
915 } |
|
916 |
|
917 void CEikSoundInfo::SetDestroyAfterPlay(TBool aDestroyAfterPlay) |
|
918 { |
|
919 iDestroyAfterPlay = aDestroyAfterPlay; |
880 } |
920 } |
881 |
921 |
882 // ================================== |
922 // ================================== |
883 // CAknSynthSoundInfo implementation. |
923 // CAknSynthSoundInfo implementation. |
884 // ================================== |
924 // ================================== |
1128 CAknFileSoundInfo::~CAknFileSoundInfo() |
1168 CAknFileSoundInfo::~CAknFileSoundInfo() |
1129 { |
1169 { |
1130 delete iAudioPlayer; |
1170 delete iAudioPlayer; |
1131 } |
1171 } |
1132 |
1172 |
1133 void CAknFileSoundInfo::InitL(const TDesC& aFileName, CMdaServer* aMdaServer) |
1173 void CAknFileSoundInfo::InitL(const TDesC& aFileName, CMdaServer* /*aMdaServer*/) |
1134 { |
1174 { |
1135 LOGTEXT(_L("CAknFileSoundInfo::InitL() - Filename:")); |
1175 LOGTEXT(_L("CAknFileSoundInfo::InitL() - Filename:")); |
1136 LOGTEXT(aFileName); |
1176 LOGTEXT(aFileName); |
1137 iFileName = aFileName; |
1177 iFileName = aFileName; |
1138 LOGTEXT(_L(" CAknFileSoundInfo::InitL() - Exit")); |
1178 LOGTEXT(_L(" CAknFileSoundInfo::InitL() - Exit")); |
1146 // Stops playing and deletes audio player instance if it exist. |
1186 // Stops playing and deletes audio player instance if it exist. |
1147 Stop(); |
1187 Stop(); |
1148 |
1188 |
1149 // Create audio player. DoPlay() will be called in all circumstances. |
1189 // Create audio player. DoPlay() will be called in all circumstances. |
1150 iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(iFileName, *this, iPriority,(TMdaPriorityPreference)iPreference ); |
1190 iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(iFileName, *this, iPriority,(TMdaPriorityPreference)iPreference ); |
|
1191 iWaittingPlay =ETrue; |
1151 LOGTEXT(_L(" CAknFileSoundInfo::PlayL() - Exit")); |
1192 LOGTEXT(_L(" CAknFileSoundInfo::PlayL() - Exit")); |
1152 } |
1193 } |
1153 |
1194 |
1154 |
1195 |
1155 void CAknFileSoundInfo::DoPlay() |
1196 void CAknFileSoundInfo::DoPlay() |
1175 LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Prepare failed, delete!")); |
1216 LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Prepare failed, delete!")); |
1176 LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Deleting iAudioPlayer.")); |
1217 LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Deleting iAudioPlayer.")); |
1177 |
1218 |
1178 delete iAudioPlayer; |
1219 delete iAudioPlayer; |
1179 iAudioPlayer = NULL; |
1220 iAudioPlayer = NULL; |
|
1221 iWaittingPlay = EFalse; |
1180 } |
1222 } |
1181 } |
1223 } |
1182 |
1224 |
1183 |
1225 |
1184 void CAknFileSoundInfo::Stop() |
1226 void CAknFileSoundInfo::Stop() |
1201 LOGTEXT(_L(" CAknFileSoundInfo::Stop(). Deleting iAudioPlayer.")); |
1243 LOGTEXT(_L(" CAknFileSoundInfo::Stop(). Deleting iAudioPlayer.")); |
1202 |
1244 |
1203 delete iAudioPlayer; |
1245 delete iAudioPlayer; |
1204 iAudioPlayer = NULL; |
1246 iAudioPlayer = NULL; |
1205 iPrepared = EFalse; |
1247 iPrepared = EFalse; |
|
1248 iWaittingPlay = EFalse; |
1206 } |
1249 } |
1207 } |
1250 } |
1208 |
1251 |
1209 void CAknFileSoundInfo::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, |
1252 void CAknFileSoundInfo::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, |
1210 TInt /*aCurrentState*/, TInt /*aErrorCode*/) |
1253 TInt /*aCurrentState*/, TInt /*aErrorCode*/) |
1267 } |
1310 } |
1268 |
1311 |
1269 void CAknFileSoundInfo::MapcPlayComplete(TInt /*aError*/) |
1312 void CAknFileSoundInfo::MapcPlayComplete(TInt /*aError*/) |
1270 { |
1313 { |
1271 LOGTEXT(_L("CAknFileSoundInfo::MapcPlayComplete()")); |
1314 LOGTEXT(_L("CAknFileSoundInfo::MapcPlayComplete()")); |
1272 |
1315 LOGTEXT1(_L(" aError:%d"), aError); |
1273 iPlaying = EFalse; |
1316 iPlaying = EFalse; |
|
1317 iWaittingPlay = EFalse; |
1274 |
1318 |
1275 delete iAudioPlayer; |
1319 delete iAudioPlayer; |
1276 iAudioPlayer = NULL; |
1320 iAudioPlayer = NULL; |
1277 iPrepared = EFalse; |
1321 iPrepared = EFalse; |
|
1322 if(iDestroyAfterPlay) |
|
1323 { |
|
1324 LOGTEXT1(_L("CAknFileSoundInfo::MapcPlayComplete DestroyAfterPlay : %d"), |
|
1325 TInt(this)); |
|
1326 delete this; |
|
1327 } |
1278 } |
1328 } |
1279 |
1329 |
1280 // End of file |
1330 // End of file |