Note that there are some explanatory texts on larger screens.

plurals
  1. POAudioQueue callback in simulator but not on device
    primarykey
    data
    text
    <p>I am currently working on an audio processing app on iPhone. it is based on Apple's SpeakHere sample code, aims at real-time audio processing and playback. The code works well in simulator, but not callback when tested on device.</p> <p>The callback function is like this: </p> <pre><code>void AQPlayer::AQBufferCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inCompleteAQBuffer) { AQPlayer *THIS = (AQPlayer *)inUserData; if (THIS-&gt;mIsDone) return; UInt32 numBytes; UInt32 nPackets = THIS-&gt;GetNumPacketsToRead(); OSStatus result = AudioFileReadPackets(THIS-&gt;GetAudioFileID(), false, &amp;numBytes, inCompleteAQBuffer-&gt;mPacketDescriptions, THIS-&gt;GetCurrentPacket(), &amp;nPackets, inCompleteAQBuffer-&gt;mAudioData); if (result) printf("AudioFileReadPackets failed: %d", (int)result); if (nPackets &gt; 0) { inCompleteAQBuffer-&gt;mAudioDataByteSize = numBytes; inCompleteAQBuffer-&gt;mPacketDescriptionCount = nPackets; //Buffer Modification SInt16 *testBuffer = (SInt16*)inCompleteAQBuffer-&gt;mAudioData; for (int i = inCompleteAQBuffer-&gt;mAudioDataByteSize/sizeof(SInt16); i &gt; 0; i --) { //printf("before modification %d", (int)*testBuffer); *testBuffer = *testBuffer/2; //Simplest processing //printf("after modification %d", (int)*testBuffer); testBuffer++; } //Enqueue Buffer AudioQueueEnqueueBuffer(inAQ, inCompleteAQBuffer, 0, NULL); THIS-&gt;mCurrentPacket = (THIS-&gt;GetCurrentPacket() + nPackets); } </code></pre> <p>Other parts remains same as in SpeakHere sample code.</p> <p>So what is the problem related to this strange behavior? Any insight will be appreciated. And kindly let me know if more information is needed.</p> <p>Thank you very much.</p> <p>Cheers,</p> <p>Manca</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload