Sub Player_Complete
If RepeatMode = REPEAT_SONG Then
PlaySong ' repeat current song
Else If PlayList.Size > (SongIndex + 1) Then
SongIndex = SongIndex + 1 ' play next song
PlaySong
Else If RepeatMode = REPEAT_LIST Then
SongIndex = 0 ' replay list from start
PlaySong
Else
Status.Cancel(1)
Main.tUpdate.Enabled = False
If IsPaused(Main) Then
Main.ShowDisplay = False
Else
CallSub2(Main, "SongDisplayVisible", False)
End If
End If
End Sub