breakdeps/eikkeysoundserver.cpp
changeset 61 bdb0226b36a8
parent 60 e17592a1211c
equal deleted inserted replaced
60:e17592a1211c 61:bdb0226b36a8
   905     // This base class method should never be called.
   905     // This base class method should never be called.
   906     }
   906     }
   907 
   907 
   908 void CAknSynthSoundInfo::InitL()
   908 void CAknSynthSoundInfo::InitL()
   909     {
   909     {
   910     // Keyclicks are played with a statically reserved CMdaAudioToneUtility.
   910 #if 0
       
   911 	// Keyclicks are played with a statically reserved CMdaAudioToneUtility.
   911     // Same concerns also error tones (this is a hack to avoid an endless error dialog
   912     // Same concerns also error tones (this is a hack to avoid an endless error dialog
   912     // loop because of audio server crash).
   913     // loop because of audio server crash).
   913     if ((iPriority == EAvkonKeyClickPriority && iPreference == KKeyClickPreference) ||
   914     if ((iPriority == EAvkonKeyClickPriority && iPreference == KKeyClickPreference) ||
   914         (iPriority == EAvkonErrorNotePriority && iPreference == EAvkonErrorNotePreference))
   915         (iPriority == EAvkonErrorNotePriority && iPreference == EAvkonErrorNotePreference))
   915         {
   916         {
   917 
   918 
   918         iPlayedStatically = ETrue;
   919         iPlayedStatically = ETrue;
   919         iToneObserver = CAknEikAudioToneObserver::NewL(*this);
   920         iToneObserver = CAknEikAudioToneObserver::NewL(*this);
   920         iTonePlayer = CMdaAudioToneUtility::NewL(*iToneObserver, NULL); // Synchronous
   921         iTonePlayer = CMdaAudioToneUtility::NewL(*iToneObserver, NULL); // Synchronous
   921         }
   922         }
       
   923 #endif
   922     }
   924     }
   923 
   925 
   924 void CAknSynthSoundInfo::PlayL()
   926 void CAknSynthSoundInfo::PlayL()
   925     {
   927     {
   926     LOGTEXT(_L("CAknSynthSoundInfo::PlayL()."));
   928     LOGTEXT(_L("CAknSynthSoundInfo::PlayL()."));
   927     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
   929     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
   928 
   930 #if 0
   929     // Stops playing and deletes instances if they exist.
   931     // Stops playing and deletes instances if they exist.
   930     Stop();
   932     Stop();
   931 
   933 
   932     if (!iPlayedStatically)
   934     if (!iPlayedStatically)
   933         {
   935         {
   936         iTonePlayer = CMdaAudioToneUtility::NewL(*iToneObserver, NULL); // Synchronous
   938         iTonePlayer = CMdaAudioToneUtility::NewL(*iToneObserver, NULL); // Synchronous
   937         }
   939         }
   938 
   940 
   939     // Prepare to play either a tone or a sequence depending on subclass.
   941     // Prepare to play either a tone or a sequence depending on subclass.
   940     Prepare();
   942     Prepare();
       
   943 #endif
   941     }
   944     }
   942 
   945 
   943 void CAknSynthSoundInfo::DoPlay()
   946 void CAknSynthSoundInfo::DoPlay()
   944     {
   947     {
   945     LOGTEXT(_L("CAknSynthSoundInfo::DoPlay()."));
   948     LOGTEXT(_L("CAknSynthSoundInfo::DoPlay()."));
   946     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
   949     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
   947 
   950 #if 0
   948     if (iTonePlayer->State() == EMdaAudioToneUtilityPrepared)
   951     if (iTonePlayer->State() == EMdaAudioToneUtilityPrepared)
   949         {
   952         {
   950         LOGTEXT(_L(" CAknSynthSoundInfo::DoPlay(). Prepare successful, play."));
   953         LOGTEXT(_L(" CAknSynthSoundInfo::DoPlay(). Prepare successful, play."));
   951 
   954 
   952         iTonePlayer->SetPriority(iPriority,(TMdaPriorityPreference)iPreference);
   955         iTonePlayer->SetPriority(iPriority,(TMdaPriorityPreference)iPreference);
   969             iTonePlayer = NULL;
   972             iTonePlayer = NULL;
   970             delete iToneObserver;
   973             delete iToneObserver;
   971             iToneObserver = NULL;
   974             iToneObserver = NULL;
   972             }
   975             }
   973         }
   976         }
       
   977 #endif
   974     }
   978     }
   975 
   979 
   976 void CAknSynthSoundInfo::Stop()
   980 void CAknSynthSoundInfo::Stop()
   977     {
   981     {
   978     LOGTEXT(_L("CAknSynthSoundInfo::Stop()."));
   982     LOGTEXT(_L("CAknSynthSoundInfo::Stop()."));
   979     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
   983     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
   980 
   984 #if 0
   981     // Stop playing and delete tone player if it exists.
   985     // Stop playing and delete tone player if it exists.
   982     if (iTonePlayer)
   986     if (iTonePlayer)
   983         {
   987         {
   984         LOGTEXT(_L(" CAknSynthSoundInfo::Stop(). iTonePlayer exists."));
   988         LOGTEXT(_L(" CAknSynthSoundInfo::Stop(). iTonePlayer exists."));
   985 
   989 
  1010 
  1014 
  1011             delete iToneObserver;
  1015             delete iToneObserver;
  1012             iToneObserver = NULL;
  1016             iToneObserver = NULL;
  1013             }
  1017             }
  1014         }
  1018         }
       
  1019 #endif
  1015     }
  1020     }
  1016 
  1021 
  1017 void CAknSynthSoundInfo::SetVolume(TVolumeSetting aVolume)
  1022 void CAknSynthSoundInfo::SetVolume(TVolumeSetting aVolume)
  1018     {
  1023     {
  1019     iVolume = aVolume;
  1024     iVolume = aVolume;
  1025 
  1030 
  1026     if ( max == 0x0000ffff ) // 16bit -1 i.e. not set
  1031     if ( max == 0x0000ffff ) // 16bit -1 i.e. not set
  1027         {
  1032         {
  1028         max = (TInt)ESoundVolume9; // Set it to our max
  1033         max = (TInt)ESoundVolume9; // Set it to our max
  1029         }
  1034         }
  1030 
  1035 #if 0
  1031     TInt volume = 0;
  1036     TInt volume = 0;
  1032 
  1037 
  1033     if ( Preference() != KKeyClickPreference ) // Other sounds than key click
  1038     if ( Preference() != KKeyClickPreference ) // Other sounds than key click
  1034         {
  1039         {
  1035         aTonePlayer->SetVolume( ((TInt)iVolume * max )/(TInt)ESoundVolume9);
  1040         aTonePlayer->SetVolume( ((TInt)iVolume * max )/(TInt)ESoundVolume9);
  1049         default: //case EKeypadVolumeLoud:
  1054         default: //case EKeypadVolumeLoud:
  1050             volume = max;
  1055             volume = max;
  1051             break;
  1056             break;
  1052         }
  1057         }
  1053     aTonePlayer->SetVolume(volume);
  1058     aTonePlayer->SetVolume(volume);
       
  1059 #endif
  1054     }
  1060     }
  1055 
  1061 
  1056 
  1062 
  1057 // =================================
  1063 // =================================
  1058 // CAknToneSoundInfo implementation.
  1064 // CAknToneSoundInfo implementation.
  1070     }
  1076     }
  1071 
  1077 
  1072 void CAknToneSoundInfo::Prepare()
  1078 void CAknToneSoundInfo::Prepare()
  1073     {
  1079     {
  1074     LOGTEXT(_L("CAknToneSoundInfo::Prepare()."));
  1080     LOGTEXT(_L("CAknToneSoundInfo::Prepare()."));
  1075 
  1081 #if 0
  1076     // Prepare
  1082     // Prepare
  1077     iTonePlayer->PrepareToPlayTone(iFrequency, iMs);
  1083     iTonePlayer->PrepareToPlayTone(iFrequency, iMs);
       
  1084 #endif
  1078     }
  1085     }
  1079 
  1086 
  1080 
  1087 
  1081 // =====================================
  1088 // =====================================
  1082 // CAknSequenceSoundInfo implementation.
  1089 // CAknSequenceSoundInfo implementation.
  1095     }
  1102     }
  1096 
  1103 
  1097 void CAknSequenceSoundInfo::Prepare()
  1104 void CAknSequenceSoundInfo::Prepare()
  1098     {
  1105     {
  1099     LOGTEXT(_L("CAknSequenceSoundInfo::Prepare()."));
  1106     LOGTEXT(_L("CAknSequenceSoundInfo::Prepare()."));
  1100 
  1107 #if 0
  1101     // Prepare
  1108     // Prepare
  1102     iTonePlayer->PrepareToPlayDesSequence(*iSequence);
  1109     iTonePlayer->PrepareToPlayDesSequence(*iSequence);
       
  1110 #endif
  1103     }
  1111     }
  1104 
  1112 
  1105 void CAknSequenceSoundInfo::ReadSequenceL(RReadStream& aStream)
  1113 void CAknSequenceSoundInfo::ReadSequenceL(RReadStream& aStream)
  1106     {
  1114     {
  1107     delete iSequence;
  1115     delete iSequence;
  1140 
  1148 
  1141 void CAknFileSoundInfo::PlayL()
  1149 void CAknFileSoundInfo::PlayL()
  1142     {
  1150     {
  1143     LOGTEXT(_L("CAknFileSoundInfo::PlayL()."));
  1151     LOGTEXT(_L("CAknFileSoundInfo::PlayL()."));
  1144     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
  1152     LOGTEXT3(_L(" This:%d, iPriority:%d, iPreference:%d"), (TInt)this, iPriority, iPreference);
  1145 
  1153 #if 0
  1146     // Stops playing and deletes audio player instance if it exist.
  1154     // Stops playing and deletes audio player instance if it exist.
  1147     Stop();
  1155     Stop();
  1148 
  1156 
  1149     // Create audio player. DoPlay() will be called in all circumstances.
  1157     // Create audio player. DoPlay() will be called in all circumstances.
  1150     iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(iFileName, *this, iPriority,(TMdaPriorityPreference)iPreference );
  1158     iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(iFileName, *this, iPriority,(TMdaPriorityPreference)iPreference );
       
  1159 #endif
  1151     LOGTEXT(_L(" CAknFileSoundInfo::PlayL() - Exit"));
  1160     LOGTEXT(_L(" CAknFileSoundInfo::PlayL() - Exit"));
  1152     }
  1161     }
  1153 
  1162 
  1154 
  1163 
  1155 void CAknFileSoundInfo::DoPlay()
  1164 void CAknFileSoundInfo::DoPlay()
  1156     {
  1165     {
  1157     LOGTEXT(_L("CAknFileSoundInfo::DoPlay()."));
  1166     LOGTEXT(_L("CAknFileSoundInfo::DoPlay()."));
  1158 
  1167 #if 0
  1159     if (iPrepared)
  1168     if (iPrepared)
  1160         {
  1169         {
  1161         LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Prepared succesfull, play."));
  1170         LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Prepared succesfull, play."));
  1162 
  1171 
  1163         // No need to set priority. It is already set in NewDesPlayerReadOnlyL().
  1172         // No need to set priority. It is already set in NewDesPlayerReadOnlyL().
  1176         LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Deleting iAudioPlayer."));
  1185         LOGTEXT(_L(" CAknFileSoundInfo::DoPlay(). Deleting iAudioPlayer."));
  1177 
  1186 
  1178         delete iAudioPlayer;
  1187         delete iAudioPlayer;
  1179         iAudioPlayer = NULL;
  1188         iAudioPlayer = NULL;
  1180         }
  1189         }
       
  1190 #endif
  1181     }
  1191     }
  1182 
  1192 
  1183 
  1193 
  1184 void CAknFileSoundInfo::Stop()
  1194 void CAknFileSoundInfo::Stop()
  1185     {
  1195     {
  1186     LOGTEXT(_L("CAknFileSoundInfo::Stop()."));
  1196     LOGTEXT(_L("CAknFileSoundInfo::Stop()."));
  1187 
  1197 #if 0
  1188     // Stop playing and delete audio player if it exists.
  1198     // Stop playing and delete audio player if it exists.
  1189     if (iAudioPlayer)
  1199     if (iAudioPlayer)
  1190         {
  1200         {
  1191         LOGTEXT(_L(" CAknFileSoundInfo::Stop(). iAudioPlayer exists."));
  1201         LOGTEXT(_L(" CAknFileSoundInfo::Stop(). iAudioPlayer exists."));
  1192 
  1202 
  1202 
  1212 
  1203         delete iAudioPlayer;
  1213         delete iAudioPlayer;
  1204         iAudioPlayer = NULL;
  1214         iAudioPlayer = NULL;
  1205         iPrepared = EFalse;
  1215         iPrepared = EFalse;
  1206         }
  1216         }
       
  1217 #endif
  1207     }
  1218     }
  1208 
  1219 
  1209 void CAknFileSoundInfo::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/,
  1220 void CAknFileSoundInfo::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/,
  1210     TInt /*aCurrentState*/, TInt /*aErrorCode*/)
  1221     TInt /*aCurrentState*/, TInt /*aErrorCode*/)
  1211     {
  1222     {
  1222 
  1233 
  1223     if ( max == 0x0000ffff ) // 16bit -1 i.e. not set
  1234     if ( max == 0x0000ffff ) // 16bit -1 i.e. not set
  1224         {
  1235         {
  1225         max = (TInt)ESoundVolume9; // Set it to our max
  1236         max = (TInt)ESoundVolume9; // Set it to our max
  1226         }
  1237         }
  1227 
  1238 #if 0
  1228     TInt volume = 0;
  1239     TInt volume = 0;
  1229 
  1240 
  1230     if ( Preference() != KKeyClickPreference ) // Other sounds than key click
  1241     if ( Preference() != KKeyClickPreference ) // Other sounds than key click
  1231         {
  1242         {
  1232 		//change (TInt)ESoundVolume9 to ((TInt)ESoundVolume9 + 1)) to keep consistent with audiotheme
  1243 		//change (TInt)ESoundVolume9 to ((TInt)ESoundVolume9 + 1)) to keep consistent with audiotheme
  1247         default: //case EKeypadVolumeLoud:
  1258         default: //case EKeypadVolumeLoud:
  1248             volume = max;
  1259             volume = max;
  1249             break;
  1260             break;
  1250         }
  1261         }
  1251     aAudioPlayer->SetVolume(volume);
  1262     aAudioPlayer->SetVolume(volume);
       
  1263 #endif
  1252     }
  1264     }
  1253 
  1265 
  1254 void CAknFileSoundInfo::MapcInitComplete(TInt aError,
  1266 void CAknFileSoundInfo::MapcInitComplete(TInt aError,
  1255     const TTimeIntervalMicroSeconds& /*aDuration*/)
  1267     const TTimeIntervalMicroSeconds& /*aDuration*/)
  1256     {
  1268     {
  1257     LOGTEXT(_L("CAknFileSoundInfo::MapcInitComplete()."));
  1269     LOGTEXT(_L("CAknFileSoundInfo::MapcInitComplete()."));
  1258     LOGTEXT1(_L(" aError:%d"), aError);
  1270     LOGTEXT1(_L(" aError:%d"), aError);
  1259 
       
  1260     if (aError == KErrNone)
  1271     if (aError == KErrNone)
  1261         {
  1272         {
  1262         iPrepared = ETrue;
  1273         iPrepared = ETrue;
  1263         SetVolume(iVolume);
  1274         SetVolume(iVolume);
  1264         }
  1275         }
  1267     }
  1278     }
  1268 
  1279 
  1269 void CAknFileSoundInfo::MapcPlayComplete(TInt /*aError*/)
  1280 void CAknFileSoundInfo::MapcPlayComplete(TInt /*aError*/)
  1270     {
  1281     {
  1271     LOGTEXT(_L("CAknFileSoundInfo::MapcPlayComplete()"));
  1282     LOGTEXT(_L("CAknFileSoundInfo::MapcPlayComplete()"));
  1272 
  1283 #if 0
  1273     iPlaying = EFalse;
  1284     iPlaying = EFalse;
  1274 
  1285 
  1275     delete iAudioPlayer;
  1286     delete iAudioPlayer;
  1276     iAudioPlayer = NULL;
  1287     iAudioPlayer = NULL;
  1277     iPrepared = EFalse;
  1288     iPrepared = EFalse;
       
  1289 #endif
  1278     }
  1290     }
  1279 
  1291 
  1280 // End of file
  1292 // End of file