コード例 #1
0
static int
DSOUND_Load(void)
{
    int loaded = 0;

    DSOUND_Unload();

    DSoundDLL = SDL_LoadObject("DSOUND.DLL");
    if (DSoundDLL == NULL) {
        SDL_SetError("DirectSound: failed to load DSOUND.DLL");
    } else {
        /* Now make sure we have DirectX 8 or better... */
        #define DSOUNDLOAD(f) { \
            p##f = (fn##f) SDL_LoadFunction(DSoundDLL, #f); \
            if (!p##f) loaded = 0; \
        }
        loaded = 1;  /* will reset if necessary. */
        DSOUNDLOAD(DirectSoundCreate8);
        DSOUNDLOAD(DirectSoundEnumerateW);
        DSOUNDLOAD(DirectSoundCaptureEnumerateW);
        #undef DSOUNDLOAD

        if (!loaded) {
            SDL_SetError("DirectSound: System doesn't appear to have DX8.");
        }
    }

    if (!loaded) {
        DSOUND_Unload();
    }

    return loaded;
}
コード例 #2
0
static int
DSOUND_Load(void)
{
    int loaded = 0;

    DSOUND_Unload();

    DSoundDLL = LoadLibrary(TEXT("DSOUND.DLL"));
    if (DSoundDLL == NULL) {
        SDL_SetError("DirectSound: failed to load DSOUND.DLL");
    } else {
        /* Now make sure we have DirectX 5 or better... */
        /*  (DirectSoundCaptureCreate was added in DX5) */
        if (!GetProcAddress(DSoundDLL, TEXT("DirectSoundCaptureCreate"))) {
            SDL_SetError("DirectSound: System doesn't appear to have DX5.");
        } else {
            DSoundCreate = (void *) GetProcAddress(DSoundDLL,
                                                   TEXT("DirectSoundCreate"));
        }

        if (!DSoundCreate) {
            SDL_SetError("DirectSound: Failed to find DirectSoundCreate");
        } else {
            loaded = 1;
        }
    }

    if (!loaded) {
        DSOUND_Unload();
    }

    return loaded;
}
コード例 #3
0
static void
DSOUND_Deinitialize(void)
{
    DSOUND_Unload();
}