AVAudioPlayer hanging the entire application
<p>I'm using AVAudioPlayer to play sound effects in an iPhone game.
This is part of my code:</p>

<pre><code>AVAudioPlayer *player = [dict objectForKey:@"Player"];
if (player.playing) {
    player.currentTime = 0;
} else {
    [player play];
}
</code></pre>

<p>One sound that can be played repeatedly and very often, since it plays based on user interaction. As the user moves his finger, I call this piece of code repeatedly.</p>

<p>If you do so, the application hangs and this is the error I get on the crash log:</p>

<pre><code>0   libSystem.B.dylib               0x3146bb18 semaphore_timedwait_signal_trap + 8
1   libSystem.B.dylib               0x3146297c semaphore_timedwait_signal + 8
2   libSystem.B.dylib               0x3145f0fe _pthread_cond_wait + 898
3   libSystem.B.dylib               0x3145f25a pthread_cond_timedwait_relative_np + 10
4   AudioToolbox                    0x348ddd50 CAGuard::WaitFor(unsigned long long) + 116
5   AudioToolbox                    0x3491b94c ClientAudioQueue::ServicePendingCallbacks() + 232
6   AudioToolbox                    0x3491ba60 AudioQueueReset + 44
7   AVFoundation                    0x34d16668 -[AVAudioPlayer setCurrentTime:] + 444
</code></pre>

<p>This looks to me like a locking issue inside AVAudioPlayer, and I haven't been able to solve it. I tried with different sound formats (CAFF and IMA4) and both fail in the same way.</p>

<p>Any pointer? I'd really like to stick to AVAudioPlayer since its much simpler to use than Audio Queues, but I need the sounds to play and not crash my application.</p>
