• 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
Manipulating PCM in Audio Queue Callback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Manipulating PCM in Audio Queue Callback


  • Subject: Manipulating PCM in Audio Queue Callback
  • From: Joey Green <email@hidden>
  • Date: Wed, 7 Jul 2010 07:01:04 -0500

I'm trying to do some expensive PCM processing in "think" Audio Queue's would be the answer since it's not real-time. Well here is what I'm doing:

void AQRecorder::MyInputBufferHandler( void * inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp * inStartTime,
UInt32 inNumPackets,
const AudioStreamPacketDescription* inPacketDesc)
{
AQRecorder *aqr = (AQRecorder *)inUserData;
float sineFrequency = aqr->mSineFrequency;
try {
if (inNumPackets > 0) {
SInt16 *pData = (SInt16*)inBuffer->mAudioData;
for(int nSamples = inBuffer->mAudioDataByteSize / sizeof(SInt16);nSamples-- > 0;pData++)
{
     *pData = *pData / 16;

}

      XThrowIfError(AudioFileWritePackets(aqr->mRecordFile, FALSE, inBuffer->mAudioDataByteSize,
inPacketDesc, aqr->mRecordPacket, &inNumPackets, pData),
  "AudioFileWritePackets failed");


If I don't process pData in that for loop everything saids perfect normal during playback so I'm certain I'm accessing the rad data correctly. When I process this for loop, still too slow. Apparently my buffers are being filled quicker then how long my processng + writing the buffers out is taking. 

What might one do to manipulate Audio Queue PCM with expensive algorithms and it WORK? Right now I plan on trying to copy to a new buffer and maybe processing that buffer on a new thread. Thats the only ideas I have.

Thanks to all that reply
 _______________________________________________
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: Manipulating PCM in Audio Queue Callback
      • From: "Paul Nettle" <email@hidden>
  • Prev by Date: Re: QuickTime GM Synth for iPad?
  • Next by Date: RE: Manipulating PCM in Audio Queue Callback
  • Previous by thread: Re: QuickTime GM Synth for iPad?
  • Next by thread: RE: Manipulating PCM in Audio Queue Callback
  • Index(es):
    • Date
    • Thread