Load IMA ADPCM as PCM 16-bit
Load IMA ADPCM as PCM 16-bit
- Subject: Load IMA ADPCM as PCM 16-bit
- From: Aleksandr Skobelev <email@hidden>
- Date: Tue, 5 Dec 2006 19:41:39 +0300
Hello,
Am trying to load IMA ADPCM sound file and convert it into PCM 16-bit
integer data.
Using AudioFileOpen() and AudioFileReadBytes() I can load all the
data that has the following
AudioStreamBasicDescription:
src.mSampleRate = 22050.000000
src.mFormatID = 'ima4'
src.mFormatFlags = 00000000
src.mBytesPerPacket = 34
src.mFramesPerPacket = 64
src.mBytesPerFrame = 0
src.mBitsPerChannel = 0
src.mChannelsPerFrame = 1
and number of packets (kAudioFilePropertyAudioDataPacketCount):
src_npackets = 92515
Then I create AudioConverter using the existing
AudioStreamBasicDescription as the source format and
as the destination format I use the following description:
dst.mSampleRate = 22050.000000
dst.mFormatID = 'lpcm'
dst.mFormatFlags = 0000000E // kAudioFormatFlagIsSignedInteger
// | kAudioFormatFlagsNativeEndian
// | kAudioFormatFlagIsPacked
dst.mBytesPerPacket = 4
dst.mFramesPerPacket = 1
dst.mBytesPerFrame = 4
dst.mBitsPerChannel = 32
dst.mChannelsPerFrame = 1
AudioConverterNew returns no errors, but when I try to convert the
input data with AudioConverterConvertBuffer (), it returns
kAudioConverterErr_OperationNotSupported error code.
Could anybody tell me please, what I'm doing wrong or have missed?
The number of input bytes is (src_npackets * src.mBytesPerPacket)
and number of output bytes is ((src_npackets * src.mFramesPerPacket)
* dst.mBytesPerFrame)
I'm really confused.
Thanks in advance,
Aleksandr Skobelev
_______________________________________________
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