Problem with SDL_mixer

Hello !

When I commented out printf(), it still didn’t work, so I’m pretty sure
that

the problem is with the Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024)…

Any suggestions?

We need more information. Do you use SDL_Init
(SDL_INIT_VIDEO|SDL_INIT_AUDIO) ?

Please compile and test the example app that comes with SDL_mixer.
Try your soundfiles there and see if then SDL_mixer also crashes.

CU

Turns out it was because I was initializing the Video Mode before the mixer.
Initializing the mixer straight after SDL_Init() fixed the problem…

Turns out it was because I was initializing the Video Mode before the mixer.
Initializing the mixer straight after SDL_Init() fixed the problem…

I thought the order of the initialization only matters for windows with
the directX driver? because the directX driver needs the window
callback. What should be done first?

Martin

Hello !

I thought the order of the initialization only matters for windows with
the directX driver? because the directX driver needs the window
callback. What should be done first?

The safest thing is to open a window
and then open the audio stuff.

This is not needed on all systems,
for example not on Linux, but that way
it works on all archs and you don’t have to care
about what system your app is running on.

A good example to see how to use SDL_mixer correctly
is Sam Lantingas “Aliens” game :

http://www.libsdl.org/projects/aliens/

I have the feeling that the author of the mail you
replyed to is doing something wrong when using SDL_mixer.

CU

The safest thing is to open a window
and then open the audio stuff.

This is not needed on all systems,
for example not on Linux, but that way
it works on all archs and you don’t have to care
about what system your app is running on.

A good example to see how to use SDL_mixer correctly
is Sam Lantingas “Aliens” game :

Thanks for the answer, i looked at the code and:

in the code it’s exactly the opposite. Sam is first doing the audio,
then the video init call.

Martin

Hello !

Thanks for the answer, i looked at the code and:

in the code it’s exactly the opposite. Sam is first doing the audio,
then the video init call.

Hmm, okay. That is strange.

CU

Hello !

A good example to see how to use SDL_mixer correctly
is Sam Lantingas “Aliens” game :

Thanks for the answer, i looked at the code and:

in the code it’s exactly the opposite. Sam is first doing the audio,
then the video init call.

@ Sam Lantinga :

Should it not be vice versa ?

CU

I have the feeling that the author of the mail you
replyed to is doing something wrong when using SDL_mixer.

I don’t think that I was doing anything wrong - the problem that I was
having was fixed when I switched the way they were initialized. I also found
that when I commented out the SDL_Mixer and SDL_TTF initialization, leaving
only the Video, the program still froze - it just didn’t give the Seg Fault.

So, Audio before Video when initializing, at least on Windows anyway… :stuck_out_tongue:

I’ve never had any problem (that anyone has reported).

I usually init video first. If that fails, bail.
Then init sound. If that fails, we just live without sound.On Sun, Jun 22, 2008 at 10:14:50PM +0100, Ben Ockmore wrote:

So, Audio before Video when initializing, at least on Windows anyway… :stuck_out_tongue:


-bill!
“Tux Paint” - free children’s drawing software for Windows / Mac OS X / Linux!
Download it today! http://www.tuxpaint.org/