• 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 question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioQueueOfflineRender question


  • Subject: AudioQueueOfflineRender question
  • From: "K. Staring" <email@hidden>
  • Date: Wed, 30 Jul 2008 01:05:26 +0200

Hi,

I've ran into some trouble trying to the AudioQueueOfflineRender() to work while trying to get audio working on a device which is definately not still probably under NDA, I suppose.

I've setup an 'input' AudioQueue, which through a callback reads audio data from a file using AudioFile. A second AudioQueue (output) invokes AudioQueueOfflineRender(input) in its callback function to receive raw audio data. Simplified it looks like this:

- open AudioFile
- open output AudioQueue, setup format as a PCM stream
- open input AudioQueue, setup format as described by AudioFileGetProperty() on the AudioFile
- call AudioQueueSetOfflineRenderFormat() on input AudioQueue to set its output to a PCM stream identical to the output AudioQueue
- start output AudioQueue, which callback calls AudioQueueOfflineRender()


The 'input' callback reads from the AudioFile and writes to the supplied AudioQueueBufferRef
The 'output' callback calls AudioQueueOfflineRender() with *its* supplied AudioQueueBufferRef


If I run this setup, the result of AudioQueueOfflineRender() is -50, which appears to be an invalid parameter value has been used.

If I do the following without changing too much code:

- open AudioFile
- open input AudioQueue
- start input AudioQueue

All works OK. The input callback is called and I hear the AudioFile's music through my headphone.

When the input AudioQueue isn't started, as it should be as it is an offline renderer, and the output AudioQueue is started instead, calling AudioQueueOfflineRender() in its callback function, I get the -50 error. The output function is called like it should. But since the OfflineRender() returns zero read bytes, the output queue eventually stops being called. This is the output callback function (abstracted):

static void outputCallback(void *inUserData, AudioQueueRef inAudioQueue, AudioQueueBufferRef bufferRef)
{
nFrames = abstracted_amount;
err = AudioQueueOfflineRender(inputQueue, &timestamp, bufferRef, nFrames);
printf("err = %d, read = %d\n", err, bufferRef->mAudioDataByteSize);
AudioQueueEnqueueBuffer(inAudioQueue, bufferRef, 0, NULL);


  printf("after outputcallback\n");
}

The inputQueue is correct, also signaled by the fact that when I change inputQueue to something invalid, I get a -1090 error in the err variable. I suspect the timestamp variable is what's causing problems. This is how I determine the value:

timestamp.mSampleTime = [[NSDate date] timeIntervalSinceReferenceDate];
timestamp.mHostTime = 0.0;
timestamp.mRateScalar = 0;
timestamp.mWordClockTime = 0;
memset(&timestamp.mSMPTETime, 0, sizeof(SMPTETime));
timestamp.mFlags = kAudioTimeStampSampleTimeValid;


I'd rather just call AudioQueueOfflineRender(inputQueue, NULL, bufferRef, nFrames) but I noticed it isn't accepted either (same -50 error). nFrames is above zero and well within the capacity of either the output and input callback. The output's data rate is constant speed, the inputs data is variable speed but this would be corrected by AudioQueueSetOfflineRenderFormat().

Note that indepentently starting the input queue, everything works fine. The output queue callback is also started fine, but AudioQueueOfflineRender() never calls the input queue, probably since a supplied variable isn't OK. Does anyone have any pointers?


Thanks,

Khamba Staring
_______________________________________________
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 question
      • From: K Staring <email@hidden>
  • Prev by Date: Re: Problem creating and using aggregate device
  • Next by Date: Adjusting AudioQueue volume
  • Previous by thread: Re: Auydio Streaming Error
  • Next by thread: Re: AudioQueueOfflineRender question
  • Index(es):
    • Date
    • Thread