• 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
Re: Some Really Basic Questions.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some Really Basic Questions.


  • Subject: Re: Some Really Basic Questions.
  • From: Morgan Packard <email@hidden>
  • Date: Wed, 08 Jun 2011 10:45:14 -0600

What I do is give the callback access to  a shared object which I can control from a UIViewController. 

// Set up the playback  callback

AURenderCallbackStruct callbackStruct;

callbackStruct.inputProc = playbackCallback;

//becomes *inRefCon in the playback callback

callbackStruct.inputProcRefCon = audioGeneratingObject;

Rather than setting global variables, you can set variables on this "synthesizer" object.

If you want to avoid thread collision issues, you may want to set up a message queue to tell your object what's happened on the UI side, but if you're just setting a boolean you can easily get away without doing that. Also note that it's not recommended that you call objective-c selectors from the render callback thread. You can use pure C or C++ to get around this. However, in my experience you can generally call objective-c selectors with no horrible results. But for the long-term, it may be better to think about using C or C++ for audio.

If that's not clear, I'm happy to go in to more detail about how  I do it. And people smarter than I will probably pipe up too :)

On Wed, Jun 8, 2011 at 3:41 AM, Jenny Andrews <email@hidden> wrote:
I need to know the best practice of some pretty basic stuff.

What is the best way of letting my callback know that the user has touched a tone (for example on a synth app).

I know i am doing it the wrong way by having a global variable, that is checked in an if statement in the callback. If the variable is YES, the sample number is 0
and it plays the sample, if it is NO, it just loops a muted part of that sample.    This global variable is updated in my UI class.

Sorry for posting noobishly on the list,   couldn't find answers elswere.

J.A

 _______________________________________________
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




--
================================
Web:
http://www.morganpackard.com

Music/Art:
Latest album: Moment Again Elsewhere
iOS app Thicket available on iTunes store.
================================

 _______________________________________________
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

References: 
 >Some Really Basic Questions. (From: Jenny Andrews <email@hidden>)

  • Prev by Date: AVAudioPlayer currentTime latency
  • Next by Date: Re: Problems with a Low Pass Filter process
  • Previous by thread: Some Really Basic Questions.
  • Next by thread: AVAudioPlayer currentTime latency
  • Index(es):
    • Date
    • Thread