D benchmark code review

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Sun Dec 15 07:36:24 PST 2013


On Sunday, 15 December 2013 at 14:43:45 UTC, Manu wrote:
> Audio involves so much bit-twiddling, I'd never want to do 
> audio work in a non-native language!

True!

> I only worry about the garbage collector. Audio processing is 
> my biggest
> fear case when there is a GC involved that is known to execute
> unpredictably, often taking a very long time in the rare event 
> it does execute.

On OS-X there are at least two ways to do audio programming. The 
easiest is to use a large buffer and use a pre made AudioUnit. 
The low latency option is to write your own AudioUnit which is 
called as a callback by the kernel on a real time thread (20+ 
times per second) and communicate with this thread from the main 
program using CAS instructions to avoid race-conditions. I guess 
it doesn't matter too much if the main program is under GC if the 
called from the AudioUnit never is touched by GC and all objects 
transferred to the AudioUnit is not under GC.

Might be possible, depending on how GC works on OS-X with D.



More information about the Digitalmars-d mailing list