Re: AudioQueueOfflineRender on the iPad
Re: AudioQueueOfflineRender on the iPad
- Subject: Re: AudioQueueOfflineRender on the iPad
- From: infrequent <email@hidden>
- Date: Wed, 4 Aug 2010 20:30:15 +0100
AudioQueueOfflineRender is a manual process. You'll notice in
AQOfflineRenderTest that the heart of the render:
XThrowIfError(AudioQueueOfflineRender(myInfo.mQueue, &ts,
captureBuffer, reqFrames), "AudioQueueOfflineRender");
and
XThrowIfError(ExtAudioFileWrite(captureFile, writeFrames,
&captureABL), "ExtAudioFileWrite");
is within a while(true) loop...
On Tue, Aug 3, 2010 at 8:05 AM, Ian Esten <email@hidden> wrote:
> Hi all,
>
> I'm having some trouble using AudioQueueOfflineRender in conjunction with RenderIO to play a caf audio file from the iPad. I've followed AQOfflineRenderTest and have the RenderIO side of things working fine, but haven't got AudioQueueOfflineRender working correctly. I get exactly one call to my audio queue output callback, but none after that. There are no errors generated in any of the AudioQueue calls I make. Here are the relevant snippets of code:
>
> setup:
> // Create a new queue
> error = AudioQueueNewOutput(&dataFormat, AQBufferCallback, self, nil, kCFRunLoopCommonModes, 0, &queue);
> //set offline render format
> error = AudioQueueSetOfflineRenderFormat(queue, &captureFormat, acl);
> // Allocate and prime buffers with some data
> for (int i = 0; i < NUMBER_OF_QUEUE_BUFFERS; i++)
> error = AudioQueueAllocateBuffer(queue, BUFFER_SIZE, &buffers[i]);
> //start the queue
> error = AudioQueueStart(queue, nil);
> for (int i = 0; i < NUMBER_OF_QUEUE_BUFFERS; i++) {
> //must call this once and ask for 0 frames
> error = AudioQueueOfflineRender(queue, &sampleTime, buffers[i], 0);
> //buffer up some audio
> for (int i = 0; i < NUMBER_OF_QUEUE_BUFFERS; i++) {
> [self readPacketsIntoBuffer:buffers[i] withQueue:queue];
>
>
> The callback simply calls readPacketsIntoBuffer.
>
>
> readPacketsIntoBuffer does the following:
> error = AudioFileReadPackets(audioFile, NO, &numberOfBytes, packetDescriptions, currentPacketIndex, &numberOfPackets, buffer->mAudioData);
> error = AudioQueueEnqueueBuffer(inAQ, buffer, (packetDescriptions ? numberOfPackets : 0), packetDescriptions);
> error = AudioQueueOfflineRender(queue, &sampleTime, buffer, reqFrames);
>
> it also updates currentPacketIndex and sampleTime. NUMBER_OF_QUEUE_BUFFERS is set to 3.
>
> I don't understand why I only get one call to the audio queue output callback (the audio file is far from being fully read). Any suggestions gratefully received!
>
> Thanks,
> Ian
>
> _______________________________________________
> 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
>
_______________________________________________
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