Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?)

share|improve this question
Yes, that should be everything that's needed to play. Odd. – Jari Komppa Aug 20 '12 at 8:49

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.