[SDL] SDL_mixer "Mix_PlayMusic" crash issue, need some help...

SlntHero at aol.com SlntHero at aol.com
Wed Sep 6 13:28:24 PDT 2006


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) 
 
 
 
 
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060906/a839126e/attachment-0007.htm>


More information about the SDL mailing list