author | rubidium |
Sat, 09 Dec 2006 14:14:51 +0000 | |
changeset 5298 | 6d4c150bdd94 |
parent 2977 | 0240dd4704a7 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
2189
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
3 |
#include "../stdafx.h" |
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
4 |
|
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
5 |
#ifdef WITH_SDL |
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
6 |
|
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
7 |
#include "../openttd.h" |
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
8 |
#include "../driver.h" |
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
9 |
#include "../mixer.h" |
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
10 |
#include "../sdl.h" |
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
11 |
#include "sdl_s.h" |
0 | 12 |
#include <SDL.h> |
13 |
||
14 |
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len) |
|
15 |
{ |
|
2977 | 16 |
MxMixSamples(stream, len / 4); |
0 | 17 |
} |
18 |
||
1301
313804601383
(svn r1805) Teach the driver layer a few things about const correctness
tron
parents:
1299
diff
changeset
|
19 |
static const char *SdlSoundStart(const char * const *parm) |
0 | 20 |
{ |
21 |
SDL_AudioSpec spec; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
22 |
|
1301
313804601383
(svn r1805) Teach the driver layer a few things about const correctness
tron
parents:
1299
diff
changeset
|
23 |
const char *s = SdlOpen(SDL_INIT_AUDIO); |
423 | 24 |
if (s != NULL) return s; |
25 |
||
0 | 26 |
spec.freq = GetDriverParamInt(parm, "hz", 11025); |
27 |
spec.format = AUDIO_S16SYS; |
|
28 |
spec.channels = 2; |
|
29 |
spec.samples = 512; |
|
423 | 30 |
spec.callback = fill_sound_buffer; |
0 | 31 |
SDL_CALL SDL_OpenAudio(&spec, &spec); |
32 |
SDL_CALL SDL_PauseAudio(0); |
|
33 |
return NULL; |
|
34 |
} |
|
35 |
||
423 | 36 |
static void SdlSoundStop(void) |
0 | 37 |
{ |
38 |
SDL_CALL SDL_CloseAudio(); |
|
39 |
SdlClose(SDL_INIT_AUDIO); |
|
40 |
} |
|
41 |
||
42 |
const HalSoundDriver _sdl_sound_driver = { |
|
43 |
SdlSoundStart, |
|
44 |
SdlSoundStop, |
|
45 |
}; |
|
2189
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
46 |
|
d240b9097139
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
47 |
#endif |