author | richk |
Sat, 14 Jul 2007 19:42:58 +0000 | |
branch | NewGRF_ports |
changeset 6720 | 35756db7e577 |
parent 6573 | 7624f942237f |
child 10429 | 1b99254f9607 |
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 |
||
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6573
diff
changeset
|
13 |
static FSoundDriver_SDL iFSoundDriver_SDL; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6573
diff
changeset
|
14 |
|
0 | 15 |
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len) |
16 |
{ |
|
2977 | 17 |
MxMixSamples(stream, len / 4); |
0 | 18 |
} |
19 |
||
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6573
diff
changeset
|
20 |
const char *SoundDriver_SDL::Start(const char * const *parm) |
0 | 21 |
{ |
22 |
SDL_AudioSpec spec; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
23 |
|
1301
313804601383
(svn r1805) Teach the driver layer a few things about const correctness
tron
parents:
1299
diff
changeset
|
24 |
const char *s = SdlOpen(SDL_INIT_AUDIO); |
423 | 25 |
if (s != NULL) return s; |
26 |
||
0 | 27 |
spec.freq = GetDriverParamInt(parm, "hz", 11025); |
28 |
spec.format = AUDIO_S16SYS; |
|
29 |
spec.channels = 2; |
|
30 |
spec.samples = 512; |
|
423 | 31 |
spec.callback = fill_sound_buffer; |
0 | 32 |
SDL_CALL SDL_OpenAudio(&spec, &spec); |
33 |
SDL_CALL SDL_PauseAudio(0); |
|
34 |
return NULL; |
|
35 |
} |
|
36 |
||
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6573
diff
changeset
|
37 |
void SoundDriver_SDL::Stop() |
0 | 38 |
{ |
39 |
SDL_CALL SDL_CloseAudio(); |
|
40 |
SdlClose(SDL_INIT_AUDIO); |
|
41 |
} |
|
42 |
||
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
|
43 |
#endif /* WITH_SDL */ |