Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1096179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:14:38+00:00 2026-05-17T00:14:38+00:00

For some reason, it seems that stopping at a breakpoint during debugging will kill

  • 0

For some reason, it seems that stopping at a breakpoint during debugging will kill my audio queue playback.

  1. AudioQueue will be playing audio
    output.
  2. Trigger a breakpoint to
    pause my iPhone app.
  3. Subsequent
    resume, audio no longer gets played.
  4. ( However, AudioQueue callback
    functions are still getting called.)
  5. ( No AudioSession or AudioQueue
    errors are found.)

Since the debugger pauses the application (rather than an incoming phone call, for example) , it’s not a typical iPhone interruption, so AudioSession interruption callbacks do not get triggered like in this solution.

I am using three AudioQueue buffers at 4096 samples at 22kHz and filling them in a circular manner.

Problem occurs for both multi-threaded and single-threaded mode.

  • Is there some known problem that you can’t pause and resume AudioSessions or AudioQueues during a debugging session?
  • Is it running out of “queued buffers” and it’s destroying/killing the AudioQueue object (but then my AQ callback shouldn’t trigger).

Anyone have insight into inner workings of iPhone AudioQueues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:14:38+00:00Added an answer on May 17, 2026 at 12:14 am

    After playing around with it for the last several days, before posting to StackOverflow, I figured out the answer just today. Go figure!

    Just recreate the AudioQueue again by calling my “preparation functions”

    SetupNewQueue(mDataFormat.mSampleRate, mDataFormat.mChannelsPerFrame);
    StartQueue(true);
    

    So detect when your AudioQueue may have “died”. In my case, I would be writing data into an input buffer to be “pulled” by AudioQueue callback. If it doesn’t occur in a certain time, or after X number of bytes of input buffer have been filled, I then recreate the AudioQueue.

    This seems to solve the issue where “halts/fails” audio when you hit a debugging breakpoint.

    The simplified versions of these functions are the following:

    void AQPlayer::SetupNewQueue(double inSampleRate, UInt32 inChannelsPerFrame)
    {
        //Prep AudioStreamBasicDescription
        mDataFormat.mSampleRate = inSampleRate;
        mDataFormat.SetCanonical(inChannelsPerFrame, YES);
    
        XThrowIfError(AudioQueueNewOutput(&mDataFormat, AQPlayer::AQBufferCallback, this, 
                                        NULL, kCFRunLoopCommonModes, 0, &mQueue), "AudioQueueNew failed");
    
        // adjust buffer size to represent about a half second of audio based on this format
        CalculateBytesForTime(mDataFormat, kBufferDurationSeconds, &mBufferByteSize, &mNumPacketsToRead);
        ctl->cmsg(CMSG_INFO, VERB_NOISY, "AQPlayer Buffer Byte Size: %d, Num Packets to Read: %d\n", (int)mBufferByteSize, (int)mNumPacketsToRead);
    
        mBufferWaitTime = mNumPacketsToRead / mDataFormat.mSampleRate * 0.9;
    
        XThrowIfError(AudioQueueAddPropertyListener(mQueue, kAudioQueueProperty_IsRunning, isRunningProc, this), "adding property listener");
    
        //Allocate AQ buffers (assume we are using CBR (constant bitrate)
        for (int i = 0; i < kNumberBuffers; ++i) {
            XThrowIfError(AudioQueueAllocateBuffer(mQueue, mBufferByteSize, &mBuffers[i]), "AudioQueueAllocateBuffer failed");
        }
    ...
    }
    

    OSStatus AQPlayer::StartQueue(BOOL inResume)
    {   
    // if we are not resuming, we also should restart the file read index
        if (!inResume)
            mCurrentPacket = 0; 
    
        // prime the queue with some data before starting
        for (int i = 0; i < kNumberBuffers; ++i) {
            mBuffers[i]->mAudioDataByteSize = mBuffers[i]->mAudioDataBytesCapacity;
            memset( mBuffers[i]->mAudioData, 0, mBuffers[i]->mAudioDataByteSize );
    
            XThrowIfError(AudioQueueEnqueueBuffer( mQueue,
                                    mBuffers[i],
                                    0,
                                    NULL ),"AudioQueueEnqueueBuffer failed");
        }
    
        OSStatus status;
        status = AudioSessionSetActive( true );
        XThrowIfError(status, "\n\n*** AudioSession failed to become active *** \n\n");
    
        status = AudioQueueStart(mQueue, NULL);
        XThrowIfError(status, "\n\n*** AudioQueue failed to start *** \n\n");
    
        return status;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that often I will want to execute some methods from a Class
For some reason it seems that everyone writing webpages about Poincare discs is only
For some reason it seems that the ./configure option of the node.js package doesn't
For some reason, it seems that the outer block doesn't seem to update recursively,
I've got model that use ExtendAssociations , but for some reason deleteHABTM doesn't seem
The validation seems to fail for some reason. By the validation, I mean the
For some reason, siginterrupt() only seems to set the behaviour for the first signal
For some reason, when I try to check a file against FileAttributes.Normal, it seems
This evaluation in sql doesn't seems to work properly for some reason but i
What I'm trying to do seems very simple, but for some reason it feels

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.