Tao.Sdl SDK Documentation

SdlMixer.Mix_QuerySpec Method 

Get output format.

[Visual Basic]
Public Shared Function Mix_QuerySpec( _
   ByRef frequency As Integer, _
   ByRef format As Short, _
   ByRef channels As Integer _
) As Integer
[C#]
public static int Mix_QuerySpec(
   out int frequency,
   out short format,
   out int channels
);

Parameters

frequency
A pointer to an int where the frequency actually used by the opened audio device will be stored.
format
A pointer to a short 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.

Return Value

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.

Remarks

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.

Binds to C-function in SDL_mixer.h

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

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, channels);
            }
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_OpenAudio