AudioConverterConvertBuffer
AudioConverterConvertBuffer
- Subject: AudioConverterConvertBuffer
- From: George Malayil-Philip <email@hidden>
- Date: Thu, 29 Dec 2005 05:06:51 -0500
- Thread-topic: AudioConverterConvertBuffer
Hi,
Yet again trying to convert a buffer of BEF32 to BEI32...running out of
ideas here :)
Tried
AudioConverterRef audioConverter;
AudioConverterNew(&inputFormat, &outputFormat, &audioConverter);
from a AudioBufferList
AudioBufferList* toConvert;
int dataSize = toConvert->mBuffers[0].mDataByteSize;
void* buffer_l = malloc(dataSize);
void* buffer_r = malloc(dataSize);
err = AudioConverterConvertBuffer(
audioConverter,
toConvert->mBuffers[0].mDataByteSize,
toConvert->mBuffers[0].mData,
&dataSize,
(void*)buffer_l);
This convert call however terminates with EXC_BAD_ACCESS in a
FloatToNativeInt32_Altivec(or something similar) function.
This to me indicates I am having some kind of uninitialized memory problem.
But for the life of me I can't figure out what...But the output buffers seem
to be initialized and the dataSize is set correctly, and the input buffers
point to valid data too...any advice on this much appreciated.
I also tried AudioConverterFillComplexBuffer() but kept getting -50 errors
with that. Reading up on that seems to me that it is some kind of parameter
error...trying to figure out which parameter it could be.
UInt32 numPackets =512; //I am assuming 1 frame per packet and it's PCM..i
know I have read in 512 frames...
AudioStreamPacketDescription outPacketDesc;
err = AudioConverterFillComplexBuffer(
bef32Tobei32,
bef32Tobei32InputDataProc,
NULL,
&numPackets,
toConvert,
&outPacketDesc);
OSStatus bef32Tobei32InputDataProc(
AudioConverterRef inAudioConverter,
UInt32* ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription**
outDataPacketDescription,
void *inUserData)
{
ioData = ringBuffer.get();
*ioNumberDataPackets =
((ioData->mBuffers[0].mDataByteSize/ioData->mBuffers[0].mNumberChannels)/siz
eof(Float32));
*outDataPacketDescription = NULL;
return noErr;
}
This approach however fails with -50...The parameter I suspect which is
not given property is the AudioStreamPacketDescription. I am not sure how to
provide this tho.
Any help getting either approach to work is much appreciated. Thanks
Regards
George M.P.
_______________________________________________
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