Files
@ r9652:8dc9b501f076
Branch filter:
Location: cpp/openttd-patchpack/source/src/sound/sdl_s.cpp - annotation
r9652:8dc9b501f076
866 B
text/x-c
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
r5584:545d748cc681 r5584:545d748cc681 r9111:983de9c5a848 r9111:983de9c5a848 r6124:7054f2e8fadf r6124:7054f2e8fadf r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5988:7f6f0097eeb1 | /* $Id$ */
/** @file sdl_s.cpp Playing sound via SDL. */
#ifdef WITH_SDL
#include "../stdafx.h"
#include "../driver.h"
#include "../mixer.h"
#include "../sdl.h"
#include "sdl_s.h"
#include <SDL.h>
static FSoundDriver_SDL iFSoundDriver_SDL;
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
{
MxMixSamples(stream, len / 4);
}
const char *SoundDriver_SDL::Start(const char * const *parm)
{
SDL_AudioSpec spec;
const char *s = SdlOpen(SDL_INIT_AUDIO);
if (s != NULL) return s;
spec.freq = GetDriverParamInt(parm, "hz", 11025);
spec.format = AUDIO_S16SYS;
spec.channels = 2;
spec.samples = 512;
spec.callback = fill_sound_buffer;
SDL_CALL SDL_OpenAudio(&spec, &spec);
SDL_CALL SDL_PauseAudio(0);
return NULL;
}
void SoundDriver_SDL::Stop()
{
SDL_CALL SDL_CloseAudio();
SdlClose(SDL_INIT_AUDIO);
}
#endif /* WITH_SDL */
|