Thread-topic: AudioFileGetProperty values, reading an MP3
I am reading an MP3 using AudioFileReadPackets and I've come across something strange. After reading the documentation and looking at some examples I am unable to reconcile why the calculated buffer size does not match the byte count I get from AudioFileGetProperty.
err = AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataPacketCount, &dataSize, &packetCount);
err = AudioFileGetProperty(audioFile, kAudioFilePropertyMaximumPacketSize, &dataSize, &maxPacketSize);
err = AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataByteCount, &dataSize, &byteCount);
I create a buffer based on the number of packets multiplied by the packet count. The byte count does not match when opening mp3's
buffer = calloc( 1, packetCount * maxPacketSize );
mp3: packetCount * maxPacketSize > byteCount
wave: packetCount * maxPacketSize == byteCount
I thought the multiplication method would be correct however when I inspect the buffer, there is no sound data in the difference between the two sizes.
Should I always use kAudioFilePropertyAudioDataByteCount to determine my buffer size? Shouldn't these methods always match perfectly?
Thanks,
W.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden