[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1.2 Mix_Init

int Mix_Init(int flags)

flags
bitwise OR'd set of sample/music formats to support by loading a library now. The values you may OR together to pass in are:
MIX_INIT_FLAC
MIX_INIT_MOD
MIX_INIT_MP3
MIX_INIT_OGG

Initialize by loading support as indicated by the flags, or at least return success if support is already loaded. You may call this multiple times, which will actually require you to call Mix_Quit just once to clean up. You may call this function with a 0 to retrieve whether support was built-in or not loaded yet.
Note: you can call Mix_Init with the right MIX_INIT_* flags OR'd together before you program gets busy, to prevent a later hiccup while it loads and unloads the library, and to check that you do have the support that you need before you try and use it.
Note: this function does not always set the error string, so do not depend on Mix_GetError being meaningful all the time.

Returns: a bitmask of all the currently initted sample/music loaders.

 
// load support for the OGG and MOD sample/music formats
int flags=MIX_INIT_OGG|MIX_INIT_MOD;
int initted=Mix_Init(flags);
if(initted&flags != flags) {
    printf("Mix_Init: Failed to init required ogg and mod support!\n");
    printf("Mix_Init: %s\n", Mix_GetError());
    // handle error
}

See Also:
4.1.3 Mix_Quit



This document was generated on November, 13 2009 using texi2html