I'm using the AudioUnit / RemoteIO API to achieve playback of streaming audio. Other formats such as a-law and u-law are working fine.
Here is an example of how I am setting up the a-law format:
audioFormat.mSampleRate = format->nSamplesPerSec;
audioFormat.mFormatID = kAudioFormatALaw;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = format->nChannels;
audioFormat.mBitsPerChannel = format->wBitsPerSample;
audioFormat.mBytesPerFrame = (format->wBitsPerSample * format->nChannels) / 8;
audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;
The format I am trying to work with is MS ADPCM, described here.
From what I understand, in this case I need to somehow calculate the number of frames per packet. The only additional information I have is the nBlockAlign field, which multimedia wiki describes as "the size of a block of IMA-encoded data".
I'm at a loss with this.
How is the frames per packet calculated? Does it involve the block size from nBlockAlign?
I see kAudioFormatDVIIntelIMA and kAudioFormatAppleIMA4 listed as formats. Does iOS even support this kind of ADPCM?