SDL_mixer "Mix_PlayMusic" crash issue, need some help

SDL_mixer “Mix_PlayMusic” crash issue, need some help…------------------------------------------------------------------------------

Mix_Music *MusicTrack[MusicTotal];
int MusicVolume;

Mix_Chunk *SoundFX[SoundTotal];
int SoundVolume;


void Audio::LoadMusic(void)
{
MusicTrack[0] = Mix_LoadMUS(“Music/Music_Track_1.MP3”);
if(!MusicTrack[0])
{
fprintf(stderr, “Couldn’t load %s: %s\n”, “Music/Music_Track_1.MP3”,
Mix_GetError());
}
//----------------------------------------------------------------------------

MusicTrack[1] = Mix_LoadMUS(“Music/Music_Track_2.MP3”);
if(!MusicTrack[1])
{
fprintf(stderr, “Couldn’t load %s: %s\n”, “Music/Music_Track_2.MP3”,
Mix_GetError());
}
//----------------------------------------------------------------------------

MusicTrack[2] = Mix_LoadMUS(“Music/Music_Track_3.MP3”);
if(!MusicTrack[2])
{
fprintf(stderr, “Couldn’t load %s: %s\n”, “Music/Music_Track_3.MP3”,
Mix_GetError());
}
//----------------------------------------------------------------------------

MusicTrack[3] = Mix_LoadMUS(“Music/Music_Track_4.MP3”);
if(!MusicTrack[3])
{
fprintf(stderr, “Couldn’t load %s: %s\n”, “Music/Music_Track_4.MP3”,
Mix_GetError());
}
//----------------------------------------------------------------------------

MusicTrack[4] = Mix_LoadMUS(“Music/Music_Track_5.MP3”);
if(!MusicTrack[4])
{
fprintf(stderr, “Couldn’t load %s: %s\n”, “Music/Music_Track_4.MP3”,
Mix_GetError());
}
//----------------------------------------------------------------------------

Mix_VolumeMusic(MusicVolume);


void Audio::PlayMusic(Uint8 musicIndex)
{
if (Mix_PlayingMusic() == 1) Mix_HaltMusic();
SDL_Delay(1000);

  Mix_VolumeMusic(MusicVolume);

  if(Mix_PlayMusic(MusicTrack[musicIndex],  -1)==-1)

{
printf(“Mix_PlayMusic: %s\n”, Mix_GetError());
}
}


Problem:
Sometimes application crashes (perhaps 1 out of 30 times)
when “Mix_PlayMusic” is executed in above function class.

Anyone with ideas ?

Jesse
SLNTHERO at AOL.com (mailto:SLNTHERO at AOL.com)
www.SilentHeroProductions.com (http://www.SilentHeroProductions.com)