开发者

seek in audio file based on time

开发者 https://www.devze.com 2023-01-30 04:38 出处:网络
Seeking through an audio file based on the packet level is simple. One just has to change currentPacket when filling the next buffer:

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 calcula开发者_如何转开发te - but what about VBR files?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消