src/audio/alsa/SDL_alsa_audio.c
changeset 1161 05d4b93b911e
parent 942 41a59de7f2ed
child 1331 1cbaeee565b1
equal deleted inserted replaced
1160:72c6c3e5bb85 1161:05d4b93b911e
    91 static unsigned int (*SDL_NAME(snd_pcm_hw_params_set_periods_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
    91 static unsigned int (*SDL_NAME(snd_pcm_hw_params_set_periods_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
    92 static int (*SDL_NAME(snd_pcm_hw_params))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
    92 static int (*SDL_NAME(snd_pcm_hw_params))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
    93 static int (*SDL_NAME(snd_pcm_nonblock))(snd_pcm_t *pcm, int nonblock);
    93 static int (*SDL_NAME(snd_pcm_nonblock))(snd_pcm_t *pcm, int nonblock);
    94 #define snd_pcm_hw_params_sizeof SDL_NAME(snd_pcm_hw_params_sizeof)
    94 #define snd_pcm_hw_params_sizeof SDL_NAME(snd_pcm_hw_params_sizeof)
    95 
    95 
       
    96 /* cast funcs to char* first, to please GCC's strict aliasing rules. */
    96 static struct {
    97 static struct {
    97 	const char *name;
    98 	const char *name;
    98 	void **func;
    99 	void **func;
    99 } alsa_functions[] = {
   100 } alsa_functions[] = {
   100 	{ "snd_pcm_open",	(void**)&SDL_NAME(snd_pcm_open)		},
   101 	{ "snd_pcm_open",	(void**)(char*)&SDL_NAME(snd_pcm_open)		},
   101 	{ "snd_pcm_close",	(void**)&SDL_NAME(snd_pcm_close)	},
   102 	{ "snd_pcm_close",	(void**)(char*)&SDL_NAME(snd_pcm_close)	},
   102 	{ "snd_pcm_writei",	(void**)&SDL_NAME(snd_pcm_writei)	},
   103 	{ "snd_pcm_writei",	(void**)(char*)&SDL_NAME(snd_pcm_writei)	},
   103 	{ "snd_pcm_resume",	(void**)&SDL_NAME(snd_pcm_resume)	},
   104 	{ "snd_pcm_resume",	(void**)(char*)&SDL_NAME(snd_pcm_resume)	},
   104 	{ "snd_pcm_prepare",	(void**)&SDL_NAME(snd_pcm_prepare)	},
   105 	{ "snd_pcm_prepare",	(void**)(char*)&SDL_NAME(snd_pcm_prepare)	},
   105 	{ "snd_pcm_drain",	(void**)&SDL_NAME(snd_pcm_drain)	},
   106 	{ "snd_pcm_drain",	(void**)(char*)&SDL_NAME(snd_pcm_drain)	},
   106 	{ "snd_strerror",	(void**)&SDL_NAME(snd_strerror)		},
   107 	{ "snd_strerror",	(void**)(char*)&SDL_NAME(snd_strerror)		},
   107 	{ "snd_pcm_hw_params_sizeof",		(void**)&SDL_NAME(snd_pcm_hw_params_sizeof)		},
   108 	{ "snd_pcm_hw_params_sizeof",		(void**)(char*)&SDL_NAME(snd_pcm_hw_params_sizeof)		},
   108 	{ "snd_pcm_hw_params_any",		(void**)&SDL_NAME(snd_pcm_hw_params_any)		},
   109 	{ "snd_pcm_hw_params_any",		(void**)(char*)&SDL_NAME(snd_pcm_hw_params_any)		},
   109 	{ "snd_pcm_hw_params_set_access",	(void**)&SDL_NAME(snd_pcm_hw_params_set_access)		},
   110 	{ "snd_pcm_hw_params_set_access",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_access)		},
   110 	{ "snd_pcm_hw_params_set_format",	(void**)&SDL_NAME(snd_pcm_hw_params_set_format)		},
   111 	{ "snd_pcm_hw_params_set_format",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_format)		},
   111 	{ "snd_pcm_hw_params_set_channels",	(void**)&SDL_NAME(snd_pcm_hw_params_set_channels)	},
   112 	{ "snd_pcm_hw_params_set_channels",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_channels)	},
   112 	{ "snd_pcm_hw_params_get_channels",	(void**)&SDL_NAME(snd_pcm_hw_params_get_channels)	},
   113 	{ "snd_pcm_hw_params_get_channels",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_channels)	},
   113 	{ "snd_pcm_hw_params_set_rate_near",	(void**)&SDL_NAME(snd_pcm_hw_params_set_rate_near)	},
   114 	{ "snd_pcm_hw_params_set_rate_near",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_rate_near)	},
   114 	{ "snd_pcm_hw_params_set_period_size_near",	(void**)&SDL_NAME(snd_pcm_hw_params_set_period_size_near)	},
   115 	{ "snd_pcm_hw_params_set_period_size_near",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_period_size_near)	},
   115 	{ "snd_pcm_hw_params_set_periods_near",	(void**)&SDL_NAME(snd_pcm_hw_params_set_periods_near)	},
   116 	{ "snd_pcm_hw_params_set_periods_near",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_periods_near)	},
   116 	{ "snd_pcm_hw_params",	(void**)&SDL_NAME(snd_pcm_hw_params)	},
   117 	{ "snd_pcm_hw_params",	(void**)(char*)&SDL_NAME(snd_pcm_hw_params)	},
   117 	{ "snd_pcm_nonblock",	(void**)&SDL_NAME(snd_pcm_nonblock)	},
   118 	{ "snd_pcm_nonblock",	(void**)(char*)&SDL_NAME(snd_pcm_nonblock)	},
   118 };
   119 };
   119 
   120 
   120 static void UnloadALSALibrary(void) {
   121 static void UnloadALSALibrary(void) {
   121 	if (alsa_loaded) {
   122 	if (alsa_loaded) {
   122 /*		SDL_UnloadObject(alsa_handle);*/
   123 /*		SDL_UnloadObject(alsa_handle);*/