I'm trying to use AudioConverter to convert a raw audio file into a compressed format. Here are my ASBDs.
in_asbd.mSampleRate = 44100;
in_asbd.mFormatID = kAudioFormatLinearPCM;
in_asbd.mFormatFlags = kAudioFormatFlagIsSignedInteger;
in_asbd.mChannelsPerFrame = 2;
in_asbd.mBitsPerChannel = 16;
etc..
For the out asbd, it's
out_asbd.mSampleRate = 44100;
out_asbd.mFormatID = kAudioFormatAppleIMA4;
out_asbd.mFormatFlags = 0;
out_asbd.mChannelsPerFrame = 2;
out_asbd.mBitsPerChannel = 0;
out_asbd.mBytesPerFrame = (out_asbd.mBitsPerChannel>>3) * out_asbd.mChannelsPerFrame; /
out_asbd.mFramesPerPacket = 64;
out_asbd.mBytesPerPacket = 68;
If I convert using
while( err == noErr && ioNumberFrames == numPackets )
{
err = AudioConverterFillComplexBuffer(audioConverter,
InputProc,
this,
&ioNumberFrames,
mOutputBufferList,
NULL);
}
I won't get any errors, but on playing, there won't be any sound. However the media length is correct.
If I just call AudioConverterFillComplexBuffer without the loop, I'll get an insz error as the method is calling my InputProc with a different number of frames.
The thing is though, I have a set amount of data to pass to the AudioConverter at every invocation. Is there anyway to force it to accept this amount of data? And is calling the method from the while loop correct? It runs without any errors but doesn't have any sound at all.
Any pointers regarding this issue will be much appreciated.
\\Angel