Converting between 24 and 32 bit
Converting between 24 and 32 bit
- Subject: Converting between 24 and 32 bit
- From: email@hidden
- Date: Tue, 4 Dec 2007 00:06:20 -0800
Hi,
I need some help. I have a little routine that I wrote that reads an audio file in chunks and converts each chunk after reading it.
pseudo code:
chunk size = 1024 * 32 do {
read a chunk of bytes from the audio file
convert the chunk of bytes to 32 bit from the source format (24 bits)
} while more to read
This works perfectly for 8, 16 bit files, but breaks when going from 24 bit to 32 bit. The AudioConverter is very picky about the number of bytes you tell it to process. It returns and error if you feed it the wrong number.
Here is the math I used to figure out how many bytes were needed.
convertSize = ((size/(sourceDescription.mBitsPerChannel/8))*(destinationDescription.mBitsPerChannel/8));
I've learned that the chunkSize needs to be evenly divisible by 6 when going from 24 to 32 bits. But, it is still super flakey and not working 100%. Reversing this and writing a file to 24 bit from 32 bit also has the same problem.
I know this is not a CoreAudio issue, it is my fault.
I am stuck, I wish I'd paid more attention to math in school! help?
Thanks
|
_______________________________________________
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