Re: AudioQueueOfflineRender on the iPad
Re: AudioQueueOfflineRender on the iPad
- Subject: Re: AudioQueueOfflineRender on the iPad
- From: Ian Esten <email@hidden>
- Date: Tue, 10 Aug 2010 23:33:49 -0700
Thanks for the suggestion - I eventually discovered this too and it solved that particular problem.
However, I now have the problem that I get several empty buffers when I start decoding (and AudioQueueOfflineRender is claiming that it rendered the number of samples I asked for). This is in spite of the fact that:
- The audio file does not start with silence
- I have queued up three buffers worth of audio from the file
- I have called AudioQueueOfflineRender once asking for 0 frames
- I have a timestamp that is initialised to 0 and updated with the number of frames rendered
Other things I have observed:
- The number of buffers worth of silence is variable. But it seems like I always get at least one and sometimes a few seconds worth.
- If I stop in the debugger when I get an empty buffer on start, I will only get that one empty buffer.
- When I start getting audio, it is from the beginning of the file, nothing has been skipped.
It seems like the audio queue is taking some time to properly get going even though I have things set up as the tech note. Has anybody else seen this or got any explanations/suggestions as to what I can do?
Thanks again!
Ian
On Aug 4, 2010, at 12:30 PM, infrequent wrote:
> 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