[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize)
Initialize the mixer API.
This must be called before using other functions in this library.
SDL must be initialized with SDL_INIT_AUDIO before this call.
frequency would be 44100 for 44.1KHz, which is CD audio rate. Most games use 22050, because 44100 requires too much CPU power on older computers.
chunksize is the size of each mixed sample. The smaller this is the more your hooks will be called. If make this too small on a slow system, sound may skip. If made to large, sound effects will lag behind the action more. You want a happy medium for your target computer. You also may make this 4096, or larger, if you are just playing music.
MIX_CHANNELS(8) mixing channels will be allocated by default.
You may call this function multiple times, however you will have to call Mix_CloseAudio
just as many times for the device to actually close. The format will not changed on subsequent calls until fully closed. So you will have to close all the way before trying to open with different format parameters.
format is based on SDL audio support, see SDL_audio.h.
Here are the values listed there:
Returns: 0 on success, -1 on errors
|
See Also:
4.1.5 Mix_CloseAudio,
4.1.8 Mix_QuerySpec,
4.3.1 Mix_AllocateChannels
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |