Files
@ r4346:fa4ac6b6f852
Branch filter:
Location: cpp/openttd-patchpack/source/sound/sdl_s.c - annotation
r4346:fa4ac6b6f852
862 B
text/x-c
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
-Codechange: use IsValidXXX where ever possible
Note: both changes to prepare for new pool system, which needs those changes.
For every pool there are 2 ugly lines, which will be removed when done
implementing new pool system.
Based on FS#13 by blathijs, partly implemented.
-Codechange: use IsValidXXX where ever possible
Note: both changes to prepare for new pool system, which needs those changes.
For every pool there are 2 ugly lines, which will be removed when done
implementing new pool system.
Based on FS#13 by blathijs, partly implemented.
r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2189:2faee8988cf3 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2977:6a8a4298e856 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2174:494188320cb1 r2189:2faee8988cf3 r2189:2faee8988cf3 | /* $Id$ */
#include "../stdafx.h"
#ifdef WITH_SDL
#include "../openttd.h"
#include "../driver.h"
#include "../mixer.h"
#include "../sdl.h"
#include "sdl_s.h"
#include <SDL.h>
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
{
MxMixSamples(stream, len / 4);
}
static const char *SdlSoundStart(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;
}
static void SdlSoundStop(void)
{
SDL_CALL SDL_CloseAudio();
SdlClose(SDL_INIT_AUDIO);
}
const HalSoundDriver _sdl_sound_driver = {
SdlSoundStart,
SdlSoundStop,
};
#endif
|