2 Add SDL.lib, SDLmain.lib and SDL_mixer.lib to your project settings.
3 g++ -o sdl02 sdl.c `sdl-config --cflags --libs`
13 #include <SDL/SDL_mixer.h>
19 void playWAV(const char *wav
);
20 void playMP3(const char *mp3
);
26 void sound::playWAV(const char *wav
){
28 Mix_OpenAudio(44100, AUDIO_S16SYS
, 2, 2048);
29 music
= Mix_LoadWAV(wav
);
30 Mix_PlayChannel(1,music
,0);
33 void sound::playMP3(const char *mp3
){
35 Mix_OpenAudio(44100, AUDIO_S16SYS
, 2, 2048);
36 music
= Mix_LoadMUS(mp3
);
38 Mix_PlayMusic(music
,-1);
This page took 0.635804 seconds and 4 git commands to generate.