So I wanted to add a song to my first game, and after a bit of research and hard work, it works.
The only trouble I have left is that the music doesn't loop...
Code:
if SDL_Init( SDL_INIT_AUDIO or SDL_INIT_VIDEO ) <> 0 then
halt;
if Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 4096) = -1 then
halt;
Music := Mix_LoadMUS('CrazyAceFighter.ogg');
if Music = nil begin
SDL_Quit;
halt;
end;
=== -1 = Loops infinite ... not working ... tried 2 (plays twice not working)
if Mix_PlayMusic(Music, -1) = -1 then
begin
SDL_Quit;
halt;
end;
... Event Loop here ...
Mix_CloseAudio;
SDL_Quit;
The music plays once, no other commands are used...
Where did I go wrong
CheGueVerra
Bookmarks