how to play only one sound at a time with AVAudioplayer
<p>i am playing sound when user tap on the respected button.</p>

<p>i have 10 buttons with 10 audio files.</p>

<p>i am playing the selected sound by using the AVAudioPlayer</p>

<pre><code>AVAudioPlayer *myaudio=[[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:[sounds objectAtIndex:button.tag] ofType:@"mp3"]]error:NULL];
[myaudio play];
</code></pre>

<p>Now i have a problem that if i click another button before completion of playing previous sound then both sounds are mixed and getting noise.</p>

<p>I need to play second sound after completion of first sound.</p>

<p>i mean at a time only one sound will be played.</p>

<p>How can i done,can any one please help me.</p>

<p>Let me add comment if this question is not understandable. </p>

<p>Thank u in advance. </p>
