SDL test program, no sound and no error either

I compiled and ran an SDL test program made in KDE KDevelop on gentoo.

The program runs but it does not produce a sound as expected. Neither
does it output an error. The source code is on this page:
http://gpwiki.org/index.php/C:Playing_a_WAV_Sound_File_With_SDL_mixer

Below are the outputs of various emerge commands:
tux ~ # emerge -pv sdl-mixer
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild R ] media-libs/sdl-mixer-1.2.8 USE=“mikmod vorbis -mp3
-timidity” 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB

tux ~ # emerge -pv libsdl
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild R ] media-libs/libsdl-1.2.11-r2 USE=“X alsa opengl xv
-aalib -arts -custom-cflags -dga -directfb -esd -fbcon -ggi -libcaca
-nas -noaudio -nojoystick -novideo -oss (-svga) -xinerama” 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB

I am running the program with the command like the following:
tux ~ # SDL_AUDIODRIVER=alsa ./yourapp

The file I am trying to play is a wave file, but I don’t know any more
details about its format.

Any help would be appreciated, thanks.

Daniel

Still a lot of things unclear:

Have you noticed, that you have timidity, mp3 and oss support disabled?
Was that your intention?

Can you show the full source of your app? There are only code snippets
on the site. Or have you used the SDL PlaySound.zip on the site?

Please post the output of amixer.

How long is the app running? Does it quit immediatly or does it run
exactly as long as the sound?

Post the output of the app.

Are you able to play the sound.wav by another player (for example VLC or
whatever you are using normally)?Am Freitag, den 07.03.2008, 16:18 +0000 schrieb Daniel Grace:

I compiled and ran an SDL test program made in KDE KDevelop on gentoo.

The program runs but it does not produce a sound as expected. Neither
does it output an error. The source code is on this page:
http://gpwiki.org/index.php/C:Playing_a_WAV_Sound_File_With_SDL_mixer

Below are the outputs of various emerge commands:
tux ~ # emerge -pv sdl-mixer
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild R ] media-libs/sdl-mixer-1.2.8 USE=“mikmod vorbis -mp3
-timidity” 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB

tux ~ # emerge -pv libsdl
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild R ] media-libs/libsdl-1.2.11-r2 USE=“X alsa opengl xv
-aalib -arts -custom-cflags -dga -directfb -esd -fbcon -ggi -libcaca
-nas -noaudio -nojoystick -novideo -oss (-svga) -xinerama” 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB

I am running the program with the command like the following:
tux ~ # SDL_AUDIODRIVER=alsa ./yourapp

The file I am trying to play is a wave file, but I don’t know any more
details about its format.

Any help would be appreciated, thanks.

Daniel


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Still a lot of things unclear:

Have you noticed, that you have timidity, mp3 and oss support disabled?

I see now.

Was that your intention?

Not particularly.

Can you show the full source of your app? There are only code snippets
on the site.

My app is made from those snippets.

Or have you used the SDL PlaySound.zip on the site?

No.

Please post the output of amixer.

What is amixer ?

How long is the app running? Does it quit immediatly or does it run
exactly as long as the sound?

I think the app quits immediately.

Post the output of the app.

There is none, it just says “press a key…” when it has finished.

Are you able to play the sound.wav by another player (for example VLC or
whatever you are using normally)?

aplay is able to play the wav.On Fri, Mar 7, 2008 at 4:37 PM, Albert Zeyer <albert.zeyer at rwth-aachen.de> wrote:

My app is made from those snippets.

Or have you used the SDL PlaySound.zip on the site?

No.

And…? Does this work?

Please post the output of amixer.

What is amixer ?

Mixer for alsa. Just post the output…

How long is the app running? Does it quit immediatly or does it run
exactly as long as the sound?

I think the app quits immediately.

What do you mean with “I think”? Try it out.

Post the output of the app.

There is none, it just says “press a key…” when it has finished.

I don’t see any code in the sample which could produce this output.

Are you starting the app normally in a console?

Perhaps put further debug messages into to see if they got printed.

Just try a bit around… Don’t wait that we ask you always for all small
details.

Perhaps also try to enable the current disabled features, perhaps SDL
behaves a bit different (buggy) without them. I would at least test to
enable OSS-support (even if you don’t want to use it later).Am Samstag, den 08.03.2008, 14:47 +0000 schrieb Daniel Grace:

On Fri, Mar 7, 2008 at 4:37 PM, Albert Zeyer <@Albert_Zeyer> wrote:

My app is made from those snippets.

Or have you used the SDL PlaySound.zip on the site?
No.
And…? Does this work?

My app is the same.

Mixer for alsa. Just post the output…

OK, here it is:

tux ~ # amixer
Simple mixer control ‘Master’,0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 23 [74%] [-12.00dB] [on]
Front Right: Playback 23 [74%] [-12.00dB] [on]
Simple mixer control ‘Master Mono’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 31
Mono: Playback 23 [74%] [-12.00dB] [on]
Simple mixer control ‘Master Surround’,0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-46.50dB] [off]
Front Right: Playback 0 [0%] [-46.50dB] [off]
Simple mixer control ‘Headphone Jack Sense’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘PCM’,0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 23 [74%] [0.00dB] [on]
Front Right: Playback 23 [74%] [0.00dB] [on]
Simple mixer control ‘Surround’,0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-46.50dB] [off]
Front Right: Playback 0 [0%] [-46.50dB] [off]
Simple mixer control ‘Surround Jack Mode’,0
Capabilities: enum
Items: ‘Shared’ 'Independent’
Item0: 'Shared’
Simple mixer control ‘Center’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 31
Mono: Playback 31 [100%] [0.00dB] [off]
Simple mixer control ‘LFE’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 31
Mono: Playback 0 [0%] [-46.50dB] [off]
Simple mixer control ‘Line’,0
Capabilities: pvolume pswitch cswitch cswitch-exclusive
Capture exclusive group: 0
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Simple mixer control ‘Line Jack Sense’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘CD’,0
Capabilities: pvolume pswitch cswitch cswitch-exclusive
Capture exclusive group: 0
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Simple mixer control ‘Mic’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch
cswitch-exclusive
Capture exclusive group: 0
Playback channels: Mono
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono: Playback 0 [0%] [-34.50dB] [off]
Front Left: Capture [on]
Front Right: Capture [on]
Simple mixer control ‘Mic Boost (+20dB)’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘Mic Select’,0
Capabilities: enum
Items: ‘Mic1’ 'Mic2’
Item0: 'Mic1’
Simple mixer control ‘Video’,0
Capabilities: cswitch cswitch-exclusive
Capture exclusive group: 0
Capture channels: Front Left - Front Right
Front Left: Capture [off]
Front Right: Capture [off]
Simple mixer control ‘Phone’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch
cswitch-exclusive
Capture exclusive group: 0
Playback channels: Mono
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono: Playback 0 [0%] [-34.50dB] [off]
Front Left: Capture [off]
Front Right: Capture [off]
Simple mixer control ‘IEC958’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘IEC958 Output’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘IEC958 Playback AC97-SPSA’,0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 3
Mono: 3 [100%]
Simple mixer control ‘IEC958 Playback Source’,0
Capabilities: enum
Items: ‘AC-Link’ 'A/D Converter’
Item0: 'AC-Link’
Simple mixer control ‘Aux’,0
Capabilities: pvolume pswitch cswitch cswitch-exclusive
Capture exclusive group: 0
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Simple mixer control ‘Capture’,0
Capabilities: cvolume cswitch
Capture channels: Front Left - Front Right
Limits: Capture 0 - 15
Front Left: Capture 0 [0%] [0.00dB] [on]
Front Right: Capture 0 [0%] [0.00dB] [on]
Simple mixer control ‘Mix’,0
Capabilities: cswitch cswitch-exclusive
Capture exclusive group: 0
Capture channels: Front Left - Front Right
Front Left: Capture [off]
Front Right: Capture [off]
Simple mixer control ‘Mix Mono’,0
Capabilities: cswitch cswitch-exclusive
Capture exclusive group: 0
Capture channels: Front Left - Front Right
Front Left: Capture [off]
Front Right: Capture [off]
Simple mixer control ‘Channel Mode’,0
Capabilities: enum
Items: ‘2ch’ ‘4ch’ '6ch’
Item0: '2ch’
Simple mixer control ‘Downmix’,0
Capabilities: enum
Items: ‘Off’ ‘6 -> 4’ '6 -> 2’
Item0: 'Off’
Simple mixer control ‘Exchange Front/Surround’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘External Amplifier’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control ‘High Pass Filter Enable’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control ‘Input Source Select’,0
Capabilities: enum
Items: ‘Input1’ 'Input2’
Item0: 'Input1’
Simple mixer control ‘Input Source Select’,1
Capabilities: enum
Items: ‘Input1’ 'Input2’
Item0: 'Input1’
Simple mixer control ‘Spread Front to Surround and Center/LFE’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control ‘VIA DXS’,0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 31 [100%] [-48.00dB]
Front Right: Playback 31 [100%] [-48.00dB]
Simple mixer control ‘VIA DXS’,1
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 31 [100%] [-48.00dB]
Front Right: Playback 31 [100%] [-48.00dB]
Simple mixer control ‘VIA DXS’,2
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 31 [100%] [-48.00dB]
Front Right: Playback 31 [100%] [-48.00dB]
Simple mixer control ‘VIA DXS’,3
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 31 [100%] [-48.00dB]
Front Right: Playback 31 [100%] [-48.00dB]
Simple mixer control ‘V_REFOUT Enable’,0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]

How long is the app running? Does it quit immediatly or does it run
exactly as long as the sound?
I think the app quits immediately.
What do you mean with “I think”? Try it out.

Yes, the app flickers it does not last, so the sound file seems to be ignored.

Post the output of the app.

There is none, it just says “press a key…” when it has finished.

I don’t see any code in the sample which could produce this output.

Are you starting the app normally in a console?

Yes, I start it as you told me:
SDL_AUDIODRIVER=alsa ./sdlmixtest

Perhaps put further debug messages into to see if they got printed.

I’m not sure that would help, the app runs to the end.

Just try a bit around… Don’t wait that we ask you always for all small
details.

Perhaps also try to enable the current disabled features, perhaps SDL
behaves a bit different (buggy) without them. I would at least test to
enable OSS-support (even if you don’t want to use it later).

I enabled oss in ufed and then I remerged sdl-mixer and libsdl.
Do I need to emerge world now ?On Sat, Mar 8, 2008 at 11:14 PM, Albert Zeyer <albert.zeyer at rwth-aachen.de> wrote:

Am Samstag, den 08.03.2008, 14:47 +0000 schrieb Daniel Grace:

On Fri, Mar 7, 2008 at 4:37 PM, Albert Zeyer <albert.zeyer at rwth-aachen.de> wrote:

My app is made from those snippets.

Or have you used the SDL PlaySound.zip on the site?
No.
And…? Does this work?

My app is the same.

Mixer for alsa. Just post the output…

OK, here it is:

tux ~ # amixer
[…]
Simple mixer control ‘Master Surround’,0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-46.50dB] [off]
Front Right: Playback 0 [0%] [-46.50dB] [off]
[…]
Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
[…]

A lot of the channels are muted or at volume 0%, including some surround
channels. It’s possible that the ALSA implementation of SDL uses these
channels.

Unmute them. (Just for testing unmute everything.)

How long is the app running? Does it quit immediatly or does it run
exactly as long as the sound?
I think the app quits immediately.
What do you mean with “I think”? Try it out.

Yes, the app flickers it does not last, so the sound file seems to be ignored.

How long does the app run? ‘Immediatly returning’ really means that you
don’t really recognise any runtime.

The soundfile itself is also not that long.

Use ‘time ./yourapp’.

Post the output of the app.

There is none, it just says “press a key…” when it has finished.

I don’t see any code in the sample which could produce this output.

Are you starting the app normally in a console?

Yes, I start it as you told me:
SDL_AUDIODRIVER=alsa ./sdlmixtest

Why are you getting this output?

Which terminal are you using?

Perhaps put further debug messages into to see if they got printed.

I’m not sure that would help, the app runs to the end.

How do you know that if no message occurs?

(‘Press any key’ does not belong to your app. Or have you added this?)

Just try a bit around… Don’t wait that we ask you always for all small
details.

Perhaps also try to enable the current disabled features, perhaps SDL
behaves a bit different (buggy) without them. I would at least test to
enable OSS-support (even if you don’t want to use it later).

I enabled oss in ufed and then I remerged sdl-mixer and libsdl.
Do I need to emerge world now ?

No, that’s already enough. (Though I am not sure if you have the
ALSA-OSS layer correctly installed in the kernel.)

Is there any difference if you use this now:

SDL_AUDIODRIVER=oss ./yourapp

(But as I mentioned, this is only for testing. You should try to get it
working with ALSA, OSS is deprecated.)Am Sonntag, den 09.03.2008, 18:04 +0000 schrieb Daniel Grace:

On Sat, Mar 8, 2008 at 11:14 PM, Albert Zeyer <@Albert_Zeyer> wrote:

Am Samstag, den 08.03.2008, 14:47 +0000 schrieb Daniel Grace:

On Fri, Mar 7, 2008 at 4:37 PM, Albert Zeyer <@Albert_Zeyer> wrote:

Unmute them. (Just for testing unmute everything.)

How do I do that ? I’ve used the command before is it alsamixer ?

How long is the app running? Does it quit immediatly or does it run
exactly as long as the sound?
I think the app quits immediately.
What do you mean with “I think”? Try it out.
Yes, the app flickers it does not last, so the sound file seems to be ignored.
How long does the app run? ‘Immediatly returning’ really means that you
don’t really recognise any runtime.

I was missing the while loop at the end of my application.

The soundfile itself is also not that long.

Use ‘time ./yourapp’.

OK, I’ll try this later.

There is none, it just says “press a key…” when it has finished.
Why are you getting this output?

KDevelop outputs this message, or something similar.

Which terminal are you using?

Perhaps put further debug messages into to see if they got printed.

OK, I’ll try this later.

Just try a bit around… Don’t wait that we ask you always for all small
details.

Perhaps also try to enable the current disabled features, perhaps SDL
behaves a bit different (buggy) without them. I would at least test to
enable OSS-support (even if you don’t want to use it later).

I enabled oss in ufed and then I remerged sdl-mixer and libsdl.
Do I need to emerge world now ?

No, that’s already enough. (Though I am not sure if you have the
ALSA-OSS layer correctly installed in the kernel.)

Is there any difference if you use this now:

SDL_AUDIODRIVER=oss ./yourapp

That gives an error:
Unable to initialize audio: No available audio deviceOn Sun, Mar 9, 2008 at 6:28 PM, Albert Zeyer <albert.zeyer at rwth-aachen.de> wrote:

Unmute them. (Just for testing unmute everything.)

How do I do that ? I’ve used the command before is it alsamixer ?

Doesn’t matter which mixer you are using. Just unmute them.

How long is the app running? Does it quit immediatly or
does it run

exactly as long as the sound?
I think the app quits immediately.
What do you mean with “I think”? Try it out.
Yes, the app flickers it does not last, so the sound file seems
to be ignored.
How long does the app run? ‘Immediatly returning’ really means
that you
don’t really recognise any runtime.

I was missing the while loop at the end of my application.

Are you serious?? You forgot to include it in your code? (You said before that your code is equal to the ZIP file…)

Of course without the loop the app will quit immediatly and therefore also not play anything.

The soundfile itself is also not that long.

Use ‘time ./yourapp’.

OK, I’ll try this later.

There is none, it just says “press a key…” when it has
finished.> Why are you getting this output?

KDevelop outputs this message, or something similar.

Why KDevelop?? I thought you are starting the application in a terminal?

SDL_AUDIODRIVER=oss ./yourapp

That gives an error:
Unable to initialize audio: No available audio device

OK, not that unexpected. Probably OSS is not configured on your system. But don’t care about this.

----- Original Message -----
From: danwgrace@gmail.com (Daniel Grace)
Date: Sunday, March 9, 2008 9:29 pm
Subject: Re: [SDL] SDL test program, no sound and no error either
To: “A list for developers using the SDL library. (includes SDL-announce)”
On Sun, Mar 9, 2008 at 6:28 PM, Albert Zeyer <@Albert_Zeyer> wrote:

Unmute them. (Just for testing unmute everything.)
How do I do that ? I’ve used the command before is it alsamixer ?
Doesn’t matter which mixer you are using. Just unmute them.

How ? Is it an amixer parameter ? Or some other command ?

Are you serious?? You forgot to include it in your code? (You said before that your code is equal to the ZIP file…)

I made a mistake.

Of course without the loop the app will quit immediatly and therefore also not play anything.
OK.

There is none, it just says “press a key…” when it has
finished.> Why are you getting this output?
KDevelop outputs this message, or something similar.
Why KDevelop?? I thought you are starting the application in a terminal?

I have used KDevelop to build the app. I am using both ways to lauch the
app, but you are right there is no output when I launch from a terminal.

SDL_AUDIODRIVER=oss ./yourapp
That gives an error:
Unable to initialize audio: No available audio device
OK, not that unexpected. Probably OSS is not configured on your system. But don’t care about this.

OK.> > On Sun, Mar 9, 2008 at 6:28 PM, Albert Zeyer <albert.zeyer at rwth-aachen.de> wrote: