I'm attempting to write an app that can arrange timed playback of some (mostly tiny) audio files. The catch: it needs to be timed with accuracy worthy of music. The sounds won't be played frequently (it's not, for example, a sampler or a drum kit), but they will need to be absolutely precisely placed. There are two parts to this question:
How should I organize the timing? I've heard
NSTimer
is inaccurate, or at least unreliable? Should I use MIDI somehow? Or a tight loop and some time-getting function with high resolution?Once I've got the timing set up, and I know when to play my sounds... how should I play them? Is
NSSound
fast and reliable enough to maintain the accuracy needed?