AVaudioPlayer regarding song overlaping
<p>I have using AVAudioPlayer in my app but the problem is that when i play the song from list it will played while before stopping the song i am again goes to song list then select another song then both song will start playing simultaneously so please tell me the code which will terminate my first song.</p>

<p>I use flag variable for initializing the song file---</p>

<pre><code>fileURL = [[NSURL alloc] initFileURLWithPath: [[NSBundle mainBundle] pathForResource:@" Om Namo" ofType:@"aac"]];
self._player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];
if (self._player)
{
_fileName.text = [NSString stringWithFormat: @"%@ (%d ch.)", [[self._player.url relativePath] lastPathComponent], self._player.numberOfChannels, nil];
[self updateViewForPlayerInfo];
[self updateViewForPlayerState];
}

[fileURL release];
break;

Play and push function---

- (void)startPlayback
{

if ([self._player play])
{
//[self stop];
[self updateViewForPlayerState];
self._player.delegate = self;
}
else
NSLog(@"Could not play %@\n", self._player.url);
}

- (void)pausePlayback
{
[self._player pause];
[self updateViewForPlayerState];
}
</code></pre>

<p>I also make stop function---</p>

<pre><code>-(void)stop
{
[_player release];
self._player=nil;
}
</code></pre>

<p>Please help me .
Is correct my stop function.
and where i put our stop function or any other solution to fix this problem...</p>
