Re: Some Really Basic Questions.
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
--
================================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