1

can I set up a separate thread for an AU Callback (which is in C)? How ? If so what threads methods is best for CoreAudio? NSThreads? NSOperationQueue? GCD? Something else?

Many thanks.

André
  • 671
  • 1
  • 7
  • 21
  • 1
    Can you clarify a bit? Is this for realtime or offline rendering? Who is calling your render function? – sbooth Nov 18 '10 at 00:56
  • I meant building the AUGraph and reading the audio datas in the main loop but running the graph in a separate thread so that any UI action won't interfere with the audio rendering. Hope to be clearer. – André Nov 20 '10 at 19:04

2 Answers2

0

No, it is not possible, because:

A render callback lives on a real-time priority thread on which subsequent render calls arrive asynchronously. Apple Documentation

Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
0

Isn't your AU callback already running in a separate thread? In most cases, I'd say let the OS handle that for you. UI always should be on the main thread, while Core Audio typically does its stuff on another thread.

I've only had experience with NSThread and pthreads, since I started before GCD and NSOperationQueue, and haven't had a chance to see if and how they work with Core Audio.

lucius
  • 8,665
  • 3
  • 34
  • 41
  • I have created my AUGraph and preloaded my soundfiles on the main loop but I am running the AUGraph on a separate NSThread. On an iphone 1st Gen the UI responds make faster (before, if everything was on the main loop and the AU Callback was overloading the UI would get stuck). – André Nov 23 '10 at 13:32