author | celestar |
Mon, 19 Mar 2007 12:38:16 +0000 | |
branch | gamebalance |
changeset 9895 | 7bd07f43b0e3 |
parent 6450 | 1c2016673250 |
child 6720 | 35756db7e577 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6450
1c2016673250
(svn r8860) -Cleanup: some style changes, proper #endif comments, variable initialisation, WINCE ifdef and a vsprintf to vsnprintf change.
Darkvater
parents:
6314
diff
changeset
|
3 |
#ifdef WITH_SDL |
1c2016673250
(svn r8860) -Cleanup: some style changes, proper #endif comments, variable initialisation, WINCE ifdef and a vsprintf to vsnprintf change.
Darkvater
parents:
6314
diff
changeset
|
4 |
|
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
|
5 |
#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
|
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 "../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
|
8 |
#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
|
9 |
#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
|
10 |
#include "sdl_s.h" |
0 | 11 |
#include <SDL.h> |
12 |
||
13 |
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len) |
|
14 |
{ |
|
2977 | 15 |
MxMixSamples(stream, len / 4); |
0 | 16 |
} |
17 |
||
1301
313804601383
(svn r1805) Teach the driver layer a few things about const correctness
tron
parents:
1299
diff
changeset
|
18 |
static const char *SdlSoundStart(const char * const *parm) |
0 | 19 |
{ |
20 |
SDL_AudioSpec spec; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
21 |
|
1301
313804601383
(svn r1805) Teach the driver layer a few things about const correctness
tron
parents:
1299
diff
changeset
|
22 |
const char *s = SdlOpen(SDL_INIT_AUDIO); |
423 | 23 |
if (s != NULL) return s; |
24 |
||
0 | 25 |
spec.freq = GetDriverParamInt(parm, "hz", 11025); |
26 |
spec.format = AUDIO_S16SYS; |
|
27 |
spec.channels = 2; |
|
28 |
spec.samples = 512; |
|
423 | 29 |
spec.callback = fill_sound_buffer; |
0 | 30 |
SDL_CALL SDL_OpenAudio(&spec, &spec); |
31 |
SDL_CALL SDL_PauseAudio(0); |
|
32 |
return NULL; |
|
33 |
} |
|
34 |
||
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6450
diff
changeset
|
35 |
static void SdlSoundStop() |
0 | 36 |
{ |
37 |
SDL_CALL SDL_CloseAudio(); |
|
38 |
SdlClose(SDL_INIT_AUDIO); |
|
39 |
} |
|
40 |
||
41 |
const HalSoundDriver _sdl_sound_driver = { |
|
42 |
SdlSoundStart, |
|
43 |
SdlSoundStop, |
|
44 |
}; |
|
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
|
45 |
|
6314
f738bcf05ad6
(svn r8691) -Cleanup: Some proper #endif comments for sound/music/video files, and a little elimination of magic numbers in Win32SoundStart
Darkvater
parents:
5835
diff
changeset
|
46 |
#endif /* WITH_SDL */ |