X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fsdl.c;h=ddf1137deca11805b06f36b10306a2a4e09b5a66;hp=51f125a75e9d21020c8de8bc0ecbc9a09ee0146e;hb=a8b2caa1d373c84c1b3fc2f615370c2a319051ca;hpb=b96c3dc500494652748c24f0aa48a8201ea202dd diff --git a/src/sdl.c b/src/sdl.c index 51f125a7..ddf1137d 100644 --- a/src/sdl.c +++ b/src/sdl.c @@ -12,7 +12,7 @@ * sdl.c * ***********************************************************/ -#ifdef USE_SDL_LIBRARY +#ifdef TARGET_SDL #include "main.h" #include "misc.h" @@ -183,4 +183,24 @@ inline void SDLDrawSimpleLine(SDL_Surface *surface, int from_x, int from_y, SDL_MapRGB(surface->format, color_r, color_g, color_b)); } -#endif /* USE_SDL_LIBRARY */ +inline boolean SDLInitAudio(void) +{ + if (SDL_Init(SDL_INIT_AUDIO) < 0) + { + Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError()); + return FALSE; + } + + if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0) + { + Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError()); + return FALSE; + } + + Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4); + Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4); + + return TRUE; +} + +#endif /* TARGET_SDL */