• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AudioQueueOfflineRender on the iPad
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioQueueOfflineRender on the iPad


  • Subject: AudioQueueOfflineRender on the iPad
  • From: Ian Esten <email@hidden>
  • Date: Tue, 03 Aug 2010 00:05:11 -0700

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

  • Follow-Ups:
    • Re: AudioQueueOfflineRender on the iPad
      • From: infrequent <email@hidden>
  • Prev by Date: AudioFile API
  • Next by Date: Re: ExtAudioFileRead
  • Previous by thread: AudioFile API
  • Next by thread: Re: AudioQueueOfflineRender on the iPad
  • Index(es):
    • Date
    • Thread