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 6047251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:19:50+00:00 2026-05-23T07:19:50+00:00

I am using the apple example code SpleakHere . in this code there is

  • 0

I am using the apple example code SpleakHere. in this code there is a calss called AQRecorder, it is a C class. i want to send the sound bytes to an objective-c object i have. this object send the dat over udp. here is the function in which im trying to perform an objective-c function inside the c code.

    void AQRecorder::MyInputBufferHandler(  void *                                  inUserData,
                                        AudioQueueRef                       inAQ,
                                    AudioQueueBufferRef                 inBuffer,
                                    const AudioTimeStamp *              inStartTime,
                                    UInt32                              inNumPackets,
                                    const AudioStreamPacketDescription* inPacketDesc)
{
AQRecorder *aqr = (AQRecorder *)inUserData;
try {
    if (inNumPackets > 0) {
        // write packets to file
        XThrowIfError(AudioFileWritePackets(aqr->mRecordFile, FALSE, inBuffer->mAudioDataByteSize,
                                         inPacketDesc, aqr->mRecordPacket, &inNumPackets, inBuffer->mAudioData),
                   "AudioFileWritePackets failed");
        aqr->mRecordPacket += inNumPackets;
        NSData* data=[NSData dataWithBytes:inBuffer->mAudioData length:inBuffer->mAudioDataByteSize];
      [(Udp*)udpp  sendData:data];
    }

    // if we're not stopping, re-enqueue the buffe so that it gets filled again
    if (aqr->IsRunning())
        XThrowIfError(AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL), "AudioQueueEnqueueBuffer failed");
} catch (CAXException e) {
    char buf[256];
    fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
}

}

although the NSData functions works fine, i am not able to ad my object (Udp) to the class and therefore cant call its functions. i tried declaring the Udp object everywhere (inside class,outside class,header .mm file ,as void*…) but nothing would compile…

though i wan’t able to add an object in order to send the data… i used NSNptification instead in order to port the data from the c object to the objective-c object.

help please


though i wan’t able to add an object in order to send the data… i used NSNotification instead in order to port the data from the c object to the objective-c object

  • 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-23T07:19:50+00:00Added an answer on May 23, 2026 at 7:19 am

    Try changing the extension of all .m files to .mm.

    If that works, then you have a dependency issue. If an Objective-C file includes a C++ file, then the extension of that Obj-C file should be .mm instead of .m. Moreover, if this Objective-C file now gets included in some other Objective-C file, then the extension of that file should be .mm as well.

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

Sidebar

Related Questions

I am using some code which was originally taken from the Apple sample ViewTransitions
Why does this code fail to display the category name Apples using the current
I've come across this issue in my application, and have reproduced it using Apple's
In Apple's example code, the method tableView:cellForRowAtIndexPath: of a UITableViewDataSource returns a cell with
I am re-using Apple's AdvancedTableViewCells example to create a custom, fast-scrolling tableview. Specifically, I
I recently started a project, using Apple's Utility Application example project. In the example
I've been using this method (I think I got it from one of Apple's
Using the Apple OS X Cocoa framework, how can I post a sheet (slide-down
Apple strongly recommends using the binary plist format when reading large XML-based data sets
We have a Java Applet built using AWT. This applet lets you select pictures

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.