static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
	SDL_free(device->hidden->caption);
	SDL_free(device->hidden);
	SDL_free(device);
	UnloadPulseLibrary();
}
static int Audio_Available(void)
{
	pa_sample_spec paspec;
	pa_simple *connection;
	int available;

	available = 0;
	if ( LoadPulseLibrary() < 0 ) {
		return available;
	}

	
	paspec.format = PA_SAMPLE_U8;
	paspec.rate = 11025;
	paspec.channels = 1;
	connection = SDL_NAME(pa_simple_new)(
		NULL,                        
		"Test stream",               
		PA_STREAM_PLAYBACK,          
		NULL,                        
		"Simple DirectMedia Layer",  
		&paspec,                     
		NULL,                        
		NULL,                        
		NULL                         
	);
	if ( connection != NULL ) {
		available = 1;
		SDL_NAME(pa_simple_free)(connection);
	}

	UnloadPulseLibrary();
	return(available);
}
Esempio n. 3
0
static int Audio_Available(void)
{
	pa_sample_spec paspec;
	pa_simple *connection;
	int available;

	available = 0;
	if ( LoadPulseLibrary() < 0 ) {
		return available;
	}
	
	/* Connect with a dummy format. */
	paspec.format = PA_SAMPLE_U8;
	paspec.rate = 11025;
	paspec.channels = 1;
	connection = SDL_NAME(pa_simple_new)(
		SDL_getenv("PASERVER"),      /* server */
		"Test stream",               /* application name */
		PA_STREAM_PLAYBACK,          /* playback mode */
		SDL_getenv("PADEVICE"),      /* device on the server */
		"Simple DirectMedia Layer",  /* stream description */
		&paspec,                     /* sample format spec */
		NULL,                        /* channel map */
		NULL,                        /* buffering attributes */
		NULL                         /* error code */
	);
	if ( connection != NULL ) {
		available = 1;
		SDL_NAME(pa_simple_free)(connection);
	}
	
	UnloadPulseLibrary();
	return(available);
}
static int LoadPulseLibrary(void)
{
	int i, retval = -1;

	pulse_handle = SDL_LoadObject(pulse_library);
	if ( pulse_handle ) {
		pulse_loaded = 1;
		retval = 0;
		for ( i=0; i<SDL_arraysize(pulse_functions); ++i ) {
			*pulse_functions[i].func = SDL_LoadFunction(pulse_handle, pulse_functions[i].name);
			if ( !*pulse_functions[i].func ) {
				retval = -1;
				UnloadPulseLibrary();
				break;
			}
		}
	}
	return retval;
}