RE: Max simultaneous source count with Remote I/O Callback much lower than with OpenAL
RE: Max simultaneous source count with Remote I/O Callback much lower than with OpenAL
- Subject: RE: Max simultaneous source count with Remote I/O Callback much lower than with OpenAL
- From: Hari Karam Singh <email@hidden>
- Date: Sun, 12 Feb 2012 14:43:10 +0000
- Expiry-date: Wed, 11 Apr 2012 23:00:00 +0000
- Organization: AncientBohemia Ltd.
Many many thanks Michael. You’re subsequent question about convolution actually tipped me off to the Accelerate framework. A preliminary reworking of the callback shows that I can play 20 unpitched sources with only 6% CPU usage instead of 12 taking 100%. Wow! As far as pitch, I think it can be done easily using the interpolation function vDSP_vlint()... I’m trying to keep it in the callback so I can run a limiter algorithm (eg http://www.musicdsp.org/showone.php?id=265) to better handle clipping...something I think you mentioned in your blog post on summing audio. I’ll share my results if I can get it working. Thanks again! Gratefully, Hari Karam Singh From: Michael Tyson [mailto:email@hidden] Sent: 11 February 2012 23:58 To: Hari Karam Singh Subject: Re: Max simultaneous source count with Remote I/O Callback much lower than with OpenAL Honestly, my first suggestion would be to use the built-in mixer if at all possible, rather than reinventing the wheel - it's fairly likely that the utilities that Apple provide will frequently be more optimal than anything you can do yourself, as they have access to low-level stuff that we don't. If you do wish to do your own mixing for whatever reason - which is perfectly valid - you may find better performance by vectorising your code, instead of performing it all using scalar operations (take a look at the Accelerate framework, if you're not already familiar). On 10 Feb 2012, at 12:01, Hari Karam Singh wrote:
Hi,
I'm working on an iPhone4+ app which plays multiple long samples simultaneously, streaming them from the disk. I original had it working pretty smoothly in OpenAL with 32 sources. After discovering OpenAL was a wrapper for the AU 3D Mixer, I thought I'd get better performance rewriting the engine (minus all the 3D stuff) as a Remote I/O unit with an input render callback. I was wrong. Even though I'm just summing the sources I get about 1/5 the performance - heavy CPU use and cracking up at 10-15 simultaneous sources.
Can anyone help me understand this disparity in performance? Is the AU 3D Mixer super optimised with assembly is there something I should be doing better in my callback? "register" variables maybe? Or adding more than 1 source to the total with each loop?? I'm getting desperate here!
I've pasted the callback code below (is this encouraged on this list??) and here as well: http://pastebin.com/AJDVY1j0 |
_______________________________________________
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