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

4.1.8 Mix_QuerySpec

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

frequency
A pointer to an int where the frequency actually used by the opened audio device will be stored.
format
A pointer to a Uint16 where the output format actually being used by the audio device will be stored.
channels
A pointer to an int where the number of audio channels will be stored.
2 will mean stereo, 1 will mean mono.

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

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.

 
// 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:
4.1.4 Mix_OpenAudio



This document was generated on November, 13 2009 using texi2html