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

  • SEARCH
  • Home
  • 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 6018177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:14:14+00:00 2026-05-23T03:14:14+00:00

In my app, i would be receiving audio data over socket in Linear PCM

  • 0

In my app, i would be receiving audio data over socket in Linear PCM Format, in uniform interval of time, 50 ms approx.,
I am using AudioQueue to play the same, i referred most of the code from AudioQueue SpeakHere Example only the difference is i need to run it on the Mac OS,

Following is the relevant piece of code,

Setup AudioBufferDescription format,

FillOutASBDForLPCM (sRecordFormat,
                    16000,
                    1,
                    16,
                    16,
                    false,
                    false
                    );

Allocate Buffers to hold and play data

for (int i = 0; i < kNumberBuffersPLyer; ++i) {
    XThrowIfError(AudioQueueAllocateBuffer(mQueue, bufferByteSize,   &mBuffers[i]),
                  "AudioQueueAllocateBuffer failed");
}

Where bufferByteSize is 640 and Number of buffer is 3

To Start the Queue,

OSStatus errorCode = AudioQueueStart(mQueue,NULL);

Now, the thing is, i was expecting, it should hit the Callback automatically When it played buffer, but it was’t happening,

So as and when i am getting buffer, i am enqueue buffer , this is the code

void AudioStream::startQueueIfNeeded(){

    SetLooping(true);
    // prime the queue with some data before starting
    for (int i = 0; i < kNumberBuffersPLyer; ++i) 
    {
        AQBufferCallback (this, mQueue, mBuffers[0]);           
        //enQueueBuffer(this,mQueue,mBuffers[i]);
    }
    //  AudioSessionSetActive( true );
    OSStatus errorCode = AudioQueueStart(mQueue,NULL);
    mIsDone = false;
    mIsStarted = true;
}

i feel the buffer is proper but i can’t hear the sound, can anyone guide me, what i am doing wrong.

Thanks in advance

  • 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-23T03:14:15+00:00Added an answer on May 23, 2026 at 3:14 am

    Thanks for have a look on it, the problem was, i was running AudioQueue in C++ based thread class and it was terminated , when i take it out of thread class it worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to create my first iPhone app that would play back audio. When I
I would prefer that a console app would default to multithreaded debug. warning level
I have an app that would benefit from google-style autocompletion while filling in an
I have a fairly standard rails app and would like to be able to
I'm working at an app which would make a POST ajax request to a
I have a .NET Framework 2.0 app and would like to use the Windows
I'm building an app that authors would (hopefully) use to help them, uh.. author
I have a Pylons app where I would like to move some of the
I would like to post-process my app.config file and perform some token replacements after
I would like to create an iPhone app that can open the google maps

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.