I'm attempting to stream audio for my C++ game which uses SDL through the mingw32 environment. From my understanding it's a fairly simple affair:
extern "C" void audioStep(void* unused, Uint8* stream, int len);
void initAudio()
{
SDL_AudioSpec* fmt;
fmt = (SDL_AudioSpec*)malloc(sizeof(SDL_AudioSpec));
fmt->freq = 22050;
fmt->format = AUDIO_S16;
fmt->channels = 1;
fmt->samples = 8192;
fmt->callback = audioStep;
fmt->userdata = NULL;
SDL_AudioSpec obFmt;
if (SDL_OpenAudio(fmt, &obFmt) < 0)
{
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
getchar();
exit(1);
}
SDL_PauseAudio(0);
}
.
.
.
extern "C" void audioStep(void* unused, Uint8* stream, int len)
{
// Do stuff.
}
The issue I'm experiencing is that audioStep never seems to be called. Before initAudio is run SDL_Init is called with SDL_INIT_EVERYTHING. Then graphics are fully initialized (SDL_SetVideoMode and such) and then the audio system is initialized with the code above.
Is it possible somehow I compiled SDL without audio support? (Is there a way to check if audio is enabled or if it's using some sort of null audio device?)