Mix_QuerySpec

Name

Mix_QuerySpec -- gets the actual mixer parameters.

Synopsis

#include "SDL_mixer.h"

int Mix_QuerySpec(int *frequency, Uint16 *format, int *channels);

Description

Mix_QuerySpec gets the actual audio format in use by the opened audio device. This may or may not match the parameters you passed to Mix_OpenAudio.

Parameters

Return Value

Returns 0 on error. If the device was open the number of times it was opened will be returned. The values of the arguments variables are not set on an error.

Example

// get and print the audio format in use
int numtimesopened, frequency, channels;
Uint16 format;
numtimesopened=Mix_QuerySpec(&frequency, &format, &channels);
if(!numtimesopened) {
    printf("Mix_QuerySpec: %s\n",Mix_GetError());
}
else {
    char *format_str="Unknown";
    switch(format) {
        case AUDIO_U8: format_str="U8"; break;
        case AUDIO_S8: format_str="S8"; break;
        case AUDIO_U16LSB: format_str="U16LSB"; break;
        case AUDIO_S16LSB: format_str="S16LSB"; break;
        case AUDIO_U16MSB: format_str="U16MSB"; break;
        case AUDIO_S16MSB: format_str="S16MSB"; break;
    }
    printf("opened=%d times  frequency=%dHz  format=%s  channels=%d",
            numtimesopened, frequency, format_str, channels);
}

See Also

Mix_OpenAudio

Mix_QuerySpec (last edited 2008-04-17 08:18:08 by localhost)