Dear all,
I try to use Sdl_Mixer and place some MP3 files in my folder ( I select
these music file randomly so they are not of the same format ), the game
often break down when switch the music.
I initial the audio system only once when start the game, then I use the
code like this:
( in pascal )
procedure start;
begin
//other codes.
SDL_Init(SDL_INIT_AUDIO);
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024);
//other codes.
end;
procedure switch(filename: string);
begin
if music <> nil then
Mix_FreeMusic(music);
music := nil;
if fileexists(filename) then
begin
Music := Mix_LoadMUS(filename);
Mix_volumemusic(MIX_MAX_VOLUME div 3);
Mix_PlayMusic(music, times);
end;
end;
Anyone knows the reason? I forgot something in the code, or to use musics
which are of different formats is not good?
Thanks.–
View this message in context: http://www.nabble.com/Use-Mixer-tp18663871p18663871.html
Sent from the SDL mailing list archive at Nabble.com.