src/sound/sdl_s.cpp
changeset 7666 a5fccd76176a
parent 6573 7624f942237f
child 10429 1b99254f9607
equal deleted inserted replaced
7665:ded23f6bc34c 7666:a5fccd76176a
     8 #include "../mixer.h"
     8 #include "../mixer.h"
     9 #include "../sdl.h"
     9 #include "../sdl.h"
    10 #include "sdl_s.h"
    10 #include "sdl_s.h"
    11 #include <SDL.h>
    11 #include <SDL.h>
    12 
    12 
       
    13 static FSoundDriver_SDL iFSoundDriver_SDL;
       
    14 
    13 static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
    15 static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
    14 {
    16 {
    15 	MxMixSamples(stream, len / 4);
    17 	MxMixSamples(stream, len / 4);
    16 }
    18 }
    17 
    19 
    18 static const char *SdlSoundStart(const char * const *parm)
    20 const char *SoundDriver_SDL::Start(const char * const *parm)
    19 {
    21 {
    20 	SDL_AudioSpec spec;
    22 	SDL_AudioSpec spec;
    21 
    23 
    22 	const char *s = SdlOpen(SDL_INIT_AUDIO);
    24 	const char *s = SdlOpen(SDL_INIT_AUDIO);
    23 	if (s != NULL) return s;
    25 	if (s != NULL) return s;
    30 	SDL_CALL SDL_OpenAudio(&spec, &spec);
    32 	SDL_CALL SDL_OpenAudio(&spec, &spec);
    31 	SDL_CALL SDL_PauseAudio(0);
    33 	SDL_CALL SDL_PauseAudio(0);
    32 	return NULL;
    34 	return NULL;
    33 }
    35 }
    34 
    36 
    35 static void SdlSoundStop()
    37 void SoundDriver_SDL::Stop()
    36 {
    38 {
    37 	SDL_CALL SDL_CloseAudio();
    39 	SDL_CALL SDL_CloseAudio();
    38 	SdlClose(SDL_INIT_AUDIO);
    40 	SdlClose(SDL_INIT_AUDIO);
    39 }
    41 }
    40 
    42 
    41 const HalSoundDriver _sdl_sound_driver = {
       
    42 	SdlSoundStart,
       
    43 	SdlSoundStop,
       
    44 };
       
    45 
       
    46 #endif /* WITH_SDL */
    43 #endif /* WITH_SDL */