I configure SDL for my windows 2000 by msys and mingw, I write some code test my configure, when I open audio, I be block. Why?
#include <SDL.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct sound_attr {
Uint8 *samples;
Uint32 length;
}sound_attr;
static void AudioCallback(void *user_data, Uint8 *audio, int length);
/* my first SDL Test Program. */
int main(int argc, char *argv[])
{
SDL_Surface *screen;
const SDL_VideoInfo *video_info;
char dri[32];
SDL_AudioSpec desired, obtained;
sound_attr sa;
printf(“sdl1 version 0.2\n”);
printf(“Copyleft wuxh\n”);
/* Initialize SDL, to use SDL, must call that before any. /
/ if(SDL_Init(SDL_INIT_VIDEO) != 0) {
printf(“Unable to initialize SDL : %s\n”, SDL_GetError());
return 1;
}
*/
/* Set screen mode. /
/ if(!(screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN))) {
printf(“Unable to set video mode : %s\n”, SDL_GetError());
SDL_Quit();
return 1;
} */
printf(“Enjoy, SDL Initialize Success.\n”);
/* Audio Test part */
if(SDL_Init(SDL_INIT_AUDIO) != 0) {
printf(“unable to initialize SDL Audio subsystem.\n”);
SDL_Quit();
}
/* open sound device */
desired.freq = 44100;
desired.format = AUDIO_S16;
desired.samples = 4096;
desired.channels = 2;
desired.callback = AudioCallback;
desired.userdata = NULL;
if(SDL_OpenAudio(&desired, &obtained) < 0) {
printf(“unable to open audio device : %s\n”, SDL_GetError());
SDL_Quit();
return 1;
}
SDL_Quit();
return 0;
}
void AudioCallback(void *user_data, Uint8 *audio, int length)
{
}
HELP!