mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.cpp
branchRCL_3
changeset 8 bc06d8566074
parent 0 40261b775718
child 24 2672ba96448e
equal deleted inserted replaced
7:94dbab0a2133 8:bc06d8566074
   218 			}
   218 			}
   219 		else
   219 		else
   220 			{
   220 			{
   221 			timePlayed = endTime-iStartTime;
   221 			timePlayed = endTime-iStartTime;
   222 			}	
   222 			}	
   223 		TUint32 bytesPlayed = (timePlayed*iPlayData.iSampleRate*KBytesPerSample)/iFCFrequency;
   223         TUint64 bytesPlayed = iPlayData.iSampleRate*KBytesPerSample;    //A TUint64 is used because during the multiplying segment of the calculation we regularly overflow what a TUint32 can handle
   224 		currentBytesPlayed = iBytesPlayed+bytesPlayed;
   224         bytesPlayed = (bytesPlayed * timePlayed)/iFCFrequency;  //The division brings it back into TUint32 territory, however.  We cannot do this before the multiplication without risking significant loss of accuracy
       
   225 
       
   226 		currentBytesPlayed = iBytesPlayed+I64LOW(bytesPlayed);
   225         #ifdef SYMBIAN_SOUNDADAPTER_DEBUG
   227         #ifdef SYMBIAN_SOUNDADAPTER_DEBUG
   226             RDebug::Printf("EstimatedBytesPlayed[%d]  Driver's bytesPlayed[%d]", currentBytesPlayed, iBytesPlayed);
   228             RDebug::Printf("EstimatedBytesPlayed[%d]  Driver's bytesPlayed[%d]", currentBytesPlayed, iBytesPlayed);
   227         #endif
   229         #endif
   228 		}
   230 		}
   229 	else
   231 	else