How to get total time duration of music in audioQueue. I am using
NSTimeInterval AQPlayer::getCurrentTime()
{
NSTimeInterval timeInterval =
For future reference, I am getting a correct time in seconds using a slight modification of Chandan's code:
int AQPlayer::GetCurrentTime() {
int timeInterval = 0;
AudioQueueTimelineRef timeLine;
OSStatus status = AudioQueueCreateTimeline(mQueue, &timeLine);
if(status == noErr) {
AudioTimeStamp timeStamp;
AudioQueueGetCurrentTime(mQueue, timeLine, &timeStamp, NULL);
timeInterval = timeStamp.mSampleTime / mDataFormat.mSampleRate; // modified
}
return timeInterval;
}