src/audio/arts/SDL_artsaudio.c
branchSDL-ryan-multiple-audio-device
changeset 3813 92f7304e50ff
parent 3812 35d1367020a3
child 3814 8e1af9ff0e1f
equal deleted inserted replaced
3812:35d1367020a3 3813:92f7304e50ff
    49 
    49 
    50 #ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
    50 #ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
    51 
    51 
    52 static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
    52 static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
    53 static void *arts_handle = NULL;
    53 static void *arts_handle = NULL;
    54 static int arts_loaded = 0;
       
    55 
    54 
    56 /* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
    55 /* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
    57 static int (*SDL_NAME(arts_init)) (void);
    56 static int (*SDL_NAME(arts_init)) (void);
    58 static void (*SDL_NAME(arts_free)) (void);
    57 static void (*SDL_NAME(arts_free)) (void);
    59 static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits,
    58 static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits,
    87 #undef SDL_ARTS_SYM
    86 #undef SDL_ARTS_SYM
    88 
    87 
    89 static void
    88 static void
    90 UnloadARTSLibrary()
    89 UnloadARTSLibrary()
    91 {
    90 {
    92     if (arts_loaded) {
    91     if (arts_handle != NULL) {
    93         SDL_UnloadObject(arts_handle);
    92         SDL_UnloadObject(arts_handle);
    94         arts_handle = NULL;
    93         arts_handle = NULL;
    95         arts_loaded = 0;
       
    96     }
    94     }
    97 }
    95 }
    98 
    96 
    99 static int
    97 static int
   100 LoadARTSLibrary(void)
    98 LoadARTSLibrary(void)
   101 {
    99 {
   102     int i, retval = -1;
   100     int i, retval = -1;
   103 
   101 
   104     if (!arts_loaded) {
   102     if (arts_handle == NULL) {
   105         arts_handle = SDL_LoadObject(arts_library);
   103         arts_handle = SDL_LoadObject(arts_library);
   106         if (arts_handle) {
   104         if (arts_handle != NULL) {
   107             arts_loaded = 1;
       
   108             retval = 0;
   105             retval = 0;
   109             for (i = 0; i < SDL_arraysize(arts_functions); ++i) {
   106             for (i = 0; i < SDL_arraysize(arts_functions); ++i) {
   110                 *arts_functions[i].func =
   107                 *arts_functions[i].func =
   111                     SDL_LoadFunction(arts_handle, arts_functions[i].name);
   108                     SDL_LoadFunction(arts_handle, arts_functions[i].name);
   112                 if (!*arts_functions[i].func) {
   109                 if (!*arts_functions[i].func) {