コード例 #1
0
ファイル: SDL_esdaudio.c プロジェクト: 1414648814/Torque3D
static int
ESD_Init(SDL_AudioDriverImpl * impl)
{
    if (LoadESDLibrary() < 0) {
        return 0;
    } else {
        int connection = 0;

        /* Don't start ESD if it's not running */
        SDL_setenv("ESD_NO_SPAWN", "1", 0);

        connection = SDL_NAME(esd_open_sound) (NULL);
        if (connection < 0) {
            UnloadESDLibrary();
            SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
            return 0;
        }
        SDL_NAME(esd_close) (connection);
    }

    /* Set the function pointers */
    impl->OpenDevice = ESD_OpenDevice;
    impl->PlayDevice = ESD_PlayDevice;
    impl->WaitDevice = ESD_WaitDevice;
    impl->GetDeviceBuf = ESD_GetDeviceBuf;
    impl->CloseDevice = ESD_CloseDevice;
    impl->Deinitialize = ESD_Deinitialize;
    impl->OnlyHasDefaultOutputDevice = 1;

    return 1;   /* this audio target is available. */
}
コード例 #2
0
static int Audio_Available(void)
{
	int connection;
	int available;

	available = 0;
	if ( LoadESDLibrary() < 0 ) {
		return available;
	}
	connection = SDL_NAME(esd_open_sound)(NULL);
	if ( connection >= 0 ) {
		available = 1;
		SDL_NAME(esd_close)(connection);
	}
	UnloadESDLibrary();
	return(available);
}
コード例 #3
0
static int LoadESDLibrary(void)
{
	int i, retval = -1;

	esd_handle = SDL_LoadObject(esd_library);
	if ( esd_handle ) {
		esd_loaded = 1;
		retval = 0;
		for ( i=0; i<SDL_TABLESIZE(esd_functions); ++i ) {
			*esd_functions[i].func = SDL_LoadFunction(esd_handle, esd_functions[i].name);
			if ( !*esd_functions[i].func ) {
				retval = -1;
				UnloadESDLibrary();
				break;
			}
		}
	}
	return retval;
}
コード例 #4
0
ファイル: SDL_esdaudio.c プロジェクト: 1414648814/Torque3D
static void
ESD_Deinitialize(void)
{
    UnloadESDLibrary();
}
コード例 #5
0
static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
	free(device->hidden);
	free(device);
	UnloadESDLibrary();
}