Initialising audio

Is there anyway I can try to init the video and audio, but continue if the
audio initialisation fails?________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Robert Clayton wrote:

Is there anyway I can try to init the video and audio, but continue if the
audio initialisation fails?


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Hi, well some time ago I have posted a similar question,
but noone has given answer yet.

So here it is again:

SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO)

This initialize the SDL video and the SDL AUDIO. Okie.

But what if this fails ? How do I know if there is something
wrong with video or audio ?

I mean, is it possible to do somthing like:

if (SDL_Init (SDL_INIT_VIDEO) < 0)
{
/* couldn’t initialize, we exit … */
exit(1);
}

/* Video initialized, so we try to initialize sound /
/
I don’t know if this could be done. /
/
so is it possible to call SDL_Init more than once ? */

if (SDL_Init (SDL_INIT_AUDIO) < 0)
{
/* Audio doesn’t work, so we go on with out audio. */
audio_flag = DISABLE_AUDIO;
}

Is that ok ? or should I always do:
if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0)
{
/* error ok, but what failed ? */
}–

  • @G.Gabriele ---------------+
    | |
    ±----------------- think Open Source -+

Hi, well some time ago I have posted a similar question,
but noone has given answer yet.
So here it is again:
SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO)
This initialize the SDL video and the SDL AUDIO. Okie.

But what if this fails ? How do I know if there is something
wrong with video or audio ?

I mean, is it possible to do somthing like:
if (SDL_Init (SDL_INIT_VIDEO) < 0)
{
/* couldn’t initialize, we exit … /
exit(1);
}
/
Video initialized, so we try to initialize sound /
/
I don’t know if this could be done. /
/
so is it possible to call SDL_Init more than once ? /
if (SDL_Init (SDL_INIT_AUDIO) < 0)
{
/
Audio doesn’t work, so we go on with out audio. */
audio_flag = DISABLE_AUDIO;
}
Is that ok ? or should I always do:

Yes, that’s OK. However, there’s some issue about doing this with
DirectX (you have to do it in a particular order).
You can also use SDL_QuitSubSystem(SDL_INIT_AUDIO), for instance, to
shut down just the audio system. SDL_Quit just calls
SDL_QuitSubSystem(SDL_INIT_EVERYTHING).

SDL keeps internal flags to prevent programs from accidentally shutting
down a subsystem that isn’t initialized, or from initializing a
subsystem twice.

-John