2
votes

Seeking through an audio file based on the packet level is simple. One just has to change currentPacket when filling the next buffer:

AudioFileReadPackets(_audioFile, false, &numBytes, _packetDescs, _currentPacket, &numPackets, buffer->mAudioData);

But what if you want to seek to position 10s from the beginning of the file? For the CBR files this should be simple to calculate - but what about VBR files?

1

1 Answers

1
votes

The solution is to use the ExtAudio* API. One can convert the input files to LPCM on the fly and then seeking becomes trivial.