comparison src/audio/alsa/SDL_alsa_audio.c @ 1361:19418e4422cb

New configure-based build system. Still work in progress, but much improved
author Sam Lantinga <slouken@libsdl.org>
date Thu, 16 Feb 2006 10:11:48 +0000
parents c71e05b4dc2e
children c0a74f199ecf
comparison
equal deleted inserted replaced
1360:70a9cfb4cf1b 1361:19418e4422cb
25 /* Allow access to a raw mixing buffer */ 25 /* Allow access to a raw mixing buffer */
26 26
27 #include <sys/types.h> 27 #include <sys/types.h>
28 #include <signal.h> /* For kill() */ 28 #include <signal.h> /* For kill() */
29 29
30 #include "SDL_timer.h"
30 #include "SDL_audio.h" 31 #include "SDL_audio.h"
31 #include "SDL_audiomem.h" 32 #include "../SDL_audiomem.h"
32 #include "SDL_audio_c.h" 33 #include "../SDL_audio_c.h"
33 #include "SDL_timer.h"
34 #include "SDL_alsa_audio.h" 34 #include "SDL_alsa_audio.h"
35 35
36 #ifdef ALSA_DYNAMIC 36 #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
37 #ifdef USE_DLVSYM
38 #ifndef __USE_GNU
39 #define __USE_GNU
40 #endif
41 #endif
42 #include <dlfcn.h> 37 #include <dlfcn.h>
43 #include "SDL_name.h" 38 #include "SDL_name.h"
44 #include "SDL_loadso.h" 39 #include "SDL_loadso.h"
45 #else 40 #else
46 #define SDL_NAME(X) X 41 #define SDL_NAME(X) X
58 static void ALSA_WaitAudio(_THIS); 53 static void ALSA_WaitAudio(_THIS);
59 static void ALSA_PlayAudio(_THIS); 54 static void ALSA_PlayAudio(_THIS);
60 static Uint8 *ALSA_GetAudioBuf(_THIS); 55 static Uint8 *ALSA_GetAudioBuf(_THIS);
61 static void ALSA_CloseAudio(_THIS); 56 static void ALSA_CloseAudio(_THIS);
62 57
63 #ifdef ALSA_DYNAMIC 58 #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
64 59
65 static const char *alsa_library = ALSA_DYNAMIC; 60 static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC;
66 static void *alsa_handle = NULL; 61 static void *alsa_handle = NULL;
67 static int alsa_loaded = 0; 62 static int alsa_loaded = 0;
68 63
69 static int (*SDL_snd_pcm_open)(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode); 64 static int (*SDL_snd_pcm_open)(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);
70 static int (*SDL_NAME(snd_pcm_open))(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode); 65 static int (*SDL_NAME(snd_pcm_open))(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);
129 if (alsa_handle) { 124 if (alsa_handle) {
130 alsa_loaded = 1; 125 alsa_loaded = 1;
131 retval = 0; 126 retval = 0;
132 for (i = 0; i < SDL_TABLESIZE(alsa_functions); i++) { 127 for (i = 0; i < SDL_TABLESIZE(alsa_functions); i++) {
133 /* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/ 128 /* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/
134 #ifdef USE_DLVSYM 129 #if HAVE_DLVSYM
135 *alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9"); 130 *alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9");
136 if (!*alsa_functions[i].func) 131 if (!*alsa_functions[i].func)
137 #endif 132 #endif
138 *alsa_functions[i].func = dlsym(alsa_handle,alsa_functions[i].name); 133 *alsa_functions[i].func = dlsym(alsa_handle,alsa_functions[i].name);
139 if (!*alsa_functions[i].func) { 134 if (!*alsa_functions[i].func) {
154 149
155 static int LoadALSALibrary(void) { 150 static int LoadALSALibrary(void) {
156 return 0; 151 return 0;
157 } 152 }
158 153
159 #endif /* ALSA_DYNAMIC */ 154 #endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
160 155
161 static const char *get_audio_device(int channels) 156 static const char *get_audio_device(int channels)
162 { 157 {
163 const char *device; 158 const char *device;
164 159