Using AudioQueueOfflineRender...
Using AudioQueueOfflineRender...
- Subject: Using AudioQueueOfflineRender...
- From: Daniel Staudigel <email@hidden>
- Date: Mon, 5 Jan 2009 00:11:09 -0800
I'm a bit confused on how to use offline rendering of audio queues.
1) How many audio queues do you need? Most of the documentation is
about "playback queues", but it also references "render
callbacks" (which the docs say you define when you set up the offline
rendering), which I don't see referenced anywhere else. Does this
have to do with recording queues?
2) How do you prod it, I can get the first X samples out of a file,
but I can't loop it to get more than that, and when I try to, it never
calls my buffer enqueing callback.
Here's the code I've gotten to get the first X samples:
OSStatus res = AudioQueueSetOfflineRenderFormat(queueObject,
&format, &layout);
if(res) printosstatus(res);
AudioQueueBufferRef b;
while(!audioFile.doneWithFile && !!(b = [selfpopInactiveBuffer])) {
[self fillBufferRef:b];
}
NSFileHandle * outf = [NSFileHandle fileHandleForWritingAtPath:[@"~/
Documents/out.pcm" stringByExpandingTildeInPath]];
AudioQueueStart(self.queueObject, NULL);
while(self.isRunning) {
res = AudioQueueOfflineRender(queueObject, &time, buf, numSamples);
time.mSampleTime += numSamples/format.mSampleRate;
if(res) printosstatus(res);
short * temp = (short*)buf->mAudioData;
NSLog(@"Got %i bytes",buf->mAudioDataByteSize);
[outf writeData:[NSData dataWithBytesNoCopy:buf->mAudioData
length:buf->mAudioDataByteSize freeWhenDone:NO]];
}
[outf closeFile];
AudioQueueSetOfflineRenderFormat(queueObject,NULL,NULL);
Of note, fillBuffer: is the class-ified buffer enqueueing callback,
format is 16-bit signed packed, interleaved LPCM, and layout is stereo.
Thanks,
Daniel
_______________________________________________
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