[A4.4.2] No sound at all
Alexandre Martins

hi,

After upgrading from 4.4.1.1 to 4.4.2, Allegro is no longer playing any sounds at all.

alexandre@alenot:~$ uname -a
Linux alenot 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux

install_sound() fails. Example applications like exsample and playogg just don't work anymore. As a workaround, we have been using aoss to make the audio work. Sadly, that isn't working either.

alexandre@alenot:~/Downloads/allegro-4.4.2/build/addons/logg$ aoss ./play_ogg ~/Projects/opensurge/samples/1up.ogg 
alexandre@alenot:~/Downloads/allegro-4.4.2/build/addons/logg$ 

I got no sound. Apparently, others have found no solution yet.

Please, can somebody help us out with this?

My (previously working) code is attached.

thank you. :)

Edgar Reynaldo

What parameters are you using for install_sound()? Does allegro.log provide any clues? What does allegro_error say immediately after install_sound fails?

Alexandre Martins

Edgar,

install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL)

audio_init()
Reserving voices...
Warning: unable to reserve voices.
Insufficient digital voices available <-- allegro_error

Others have reported the same issue.

Any ideas?

Matthew Leverton

Does it still work on 4.4.1, or was it an Ubuntu upgrade that broke it?

Edgar Reynaldo

Okay, next thing to try :

#SelectExpand
1 2#include <cstdio> 3#include <allegro.h> 4 5int unix_sound_drivers[5] = { 6 DIGI_OSS, 7 DIGI_ESD, 8 DIGI_ARTS, 9 DIGI_ALSA, 10 DIGI_JACK 11}; 12 13const char* unix_sound_driver_names[5] = { 14 "DIGI_OSS", 15 "DIGI_ESD", 16 "DIGI_ARTS", 17 "DIGI_ALSA", 18 "DIGI_JACK" 19}; 20 21void check_sound_drivers(); 22 23 24int main(int argc , char** argv) { 25 if (!allegro_init()) {return 1;} 26 27 check_sound_drivers(); 28 29 return 0; 30} 31END_OF_MAIN() 32 33 34void check_sound_drivers() { 35 for (int i = 0 ; i < 5 ; ++i) { 36 printf("Sound driver #%i (%s) has %i voices available.\n" , i , unix_sound_driver_names[i] , detect_digi_driver(unix_sound_drivers[i])); 37 } 38}

Alexandre Martins

The bleeding edge version of our game is compiled using 4.4.1.1, and the sound is working just fine here.

Any ideas? ???

edit: trying Edgar's code...

edit #2: nope.

Sound driver #0 (DIGI_OSS) has 0 voices available.
Sound driver #1 (DIGI_ESD) has 65535 voices available.
Sound driver #2 (DIGI_ARTS) has 65535 voices available.
Sound driver #3 (DIGI_ALSA) has 65535 voices available.
Sound driver #4 (DIGI_JACK) has 65535 voices available.

In spite of this, even when trying DIGI_ALSA or others, I still get no sound in my game or in the example applications. I tried a slighly modified version of Edgar's code. Here are the results:

alexandre@alenot:~$ g++ edgar.cpp -o edgar `allegro-config --libs` && ./edgar 
Sound driver #0 (DIGI_OSS) has 0 voices available.
Sound driver #1 (DIGI_ESD) has 65535 voices available.
Sound driver #2 (DIGI_ARTS) has 65535 voices available.
Sound driver #3 (DIGI_ALSA) has 65535 voices available.
Sound driver #4 (DIGI_JACK) has 65535 voices available.
error: /dev/dsp: No such file or directory
alexandre@alenot:~$ g++ edgar.cpp -o edgar `allegro-config --libs` && aoss ./edgar 
Sound driver #0 (DIGI_OSS) has 0 voices available.
Sound driver #1 (DIGI_ESD) has 65535 voices available.
Sound driver #2 (DIGI_ARTS) has 65535 voices available.
Sound driver #3 (DIGI_ALSA) has 65535 voices available.
Sound driver #4 (DIGI_JACK) has 65535 voices available.
error: /dev/dsp: No such file or directory
alexandre@alenot:~$ 

The code:

#SelectExpand
1#include <cstdio> 2#include <allegro.h> 3using namespace std; 4 5int unix_sound_drivers[5] = { 6 DIGI_OSS, 7 DIGI_ESD, 8 DIGI_ARTS, 9 DIGI_ALSA, 10 DIGI_JACK 11}; 12 13const char* unix_sound_driver_names[5] = { 14 "DIGI_OSS", 15 "DIGI_ESD", 16 "DIGI_ARTS", 17 "DIGI_ALSA", 18 "DIGI_JACK" 19}; 20 21void check_sound_drivers(); 22 23 24int main(int argc , char** argv) { 25 if (0 != allegro_init()) {return 1;} 26 27 check_sound_drivers(); 28 if(0 == install_sound(DIGI_ALSA, MIDI_NONE, 0)) 29 printf("error: %s\n", allegro_error); 30 31 return 0; 32} 33END_OF_MAIN() 34 35 36void check_sound_drivers() { 37 for (int i = 0 ; i < 5 ; ++i) { 38 printf("Sound driver #%i (%s) has %i voices available.\n" , i , unix_sound_driver_names[i] , detect_digi_driver(unix_sound_drivers[i])); 39 } 40}

So... Any other ideas? ???

Edgar Reynaldo

Try installing the sound with ESD, ARTS, and JACK as well.

error: /dev/dsp: No such file or directory

Sounds like you're missing a package or something...

allegro/src/unix/uoss.c line 11 said:

* Open Sound System driver. Supports for /dev/dsp and /dev/audio.

Alexandre Martins

Still not working. I don't know which package I might be missing, since the sound is working fine on my bleeding edge (which uses 4.4.1.1). :( Any ideas?

I tried a modified version of Edgar's code, but I got no playback at all, no matter which DIGI_* option I used.

#SelectExpand
1#include <cstdio> 2#include <allegro.h> 3using namespace std; 4 5int unix_sound_drivers[5] = { 6 DIGI_ESD, 7 DIGI_ARTS, 8 DIGI_ALSA, 9 DIGI_JACK, 10 DIGI_OSS 11}; 12 13const char* unix_sound_driver_names[5] = { 14 "DIGI_ESD", 15 "DIGI_ARTS", 16 "DIGI_ALSA", 17 "DIGI_JACK", 18 "DIGI_OSS" 19}; 20 21void check_sound_drivers(); 22 23 24int main(int argc , char** argv) { 25 if (0 != allegro_init()) {return 1;} 26 install_timer(); 27 28 check_sound_drivers(); 29 30 return 0; 31} 32END_OF_MAIN() 33 34 35void check_sound_drivers() { 36 for (int i = 0 ; i < 5 ; ++i) { 37 printf("Sound driver #%i (%s) has %i voices available.\n" , i , unix_sound_driver_names[i] , detect_digi_driver(unix_sound_drivers[i])); 38 if(!install_sound(unix_sound_drivers[i], MIDI_NONE, 0)) { 39 SAMPLE *s = load_sample("./checkpoint.wav"); 40 if(s) { 41 42 if(play_sample(s, 255, 128, 1000, 0) >= 0) 43 printf("playing... %s\n", allegro_error); 44 else 45 printf("no voices available. %s\n", allegro_error); 46 47 rest(1000); 48 destroy_sample(s); 49 } 50 else 51 printf("can't play sample using %s\n", unix_sound_driver_names[i]); 52 53 remove_sound(); 54 } 55 else 56 printf("can't install sound\n%s\n", allegro_error); 57 } 58}

Results:

alexandre@alenot:~$ g++ edgar.cpp -o edgar `allegro-config --libs` && aoss ./edgar 
Sound driver #0 (DIGI_ESD) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #1 (DIGI_ARTS) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #2 (DIGI_ALSA) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #3 (DIGI_JACK) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #4 (DIGI_OSS) has 0 voices available.
can't install sound
/dev/dsp: No such file or directory
alexandre@alenot:~$ g++ edgar.cpp -o edgar `allegro-config --libs` && ./edgar 
Sound driver #0 (DIGI_ESD) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #1 (DIGI_ARTS) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #2 (DIGI_ALSA) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #3 (DIGI_JACK) has 65535 voices available.
playing... /dev/dsp: No such file or directory
Sound driver #4 (DIGI_OSS) has 0 voices available.
can't install sound
/dev/dsp: No such file or directory

Seems like a pretty odd output. It should play a sample, but I hear nothing.

Thoughts? ???

torhu

You could just diff the two versions of Allegro and see if there are any suspicious changes to the sound code.

Edgar Reynaldo

Don't know why the other drivers aren't working when they say there are 65536 voices available, but this may explain OSS :

Once you know the sound input works, next you just need to use padsp in front of your command above, for instance:

padsp mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp1 ...

This command makes a /dev/dsp access for your command on the fly and pipes the sound via pulseaudio. See details here:

http://manpages.ubuntu.com/manpages/hardy/man1/padsp.1.html

10.10 Maverick finally disabled the very old OSS drivers (which provided /dev/dsp, so the padsp wrapper is the easiest way to handle if it you can't select ALSA or PulseAudio directly. – Kees Cook Nov 7 '10 at 1:47

padsp does not work for all programs, and does not provide complete emulation. The alternative OSS proxy (ossp) is even worse. – David Jul 5 at 19:24

Other than that, and what torhu suggested, try google :
http://www.google.com/search?q=%22%2Fdev%2Fdsp%3A+No+such+file+or+directory%22+ubuntu&hl=en&num=10&lr=&ft=i&cr=&safe=images

Alexandre Martins

using padsp <program> works :)

... however, the sound gets cracked every now and then. It seems to be random, but it completely blows up gameplay: over time, this random cracking sound really gets on the nerves.

Please correct me if I'm wrong, but although padsp can be used as a temporary workaround, sadly the only option may be to throw away all the previously working Allegro audio code and switch to something else - perhaps OpenAL + kcat's ALURE. This is a bit unfortunate.

thank you for the help, guys.

Edgar Reynaldo

Is there any reason you need to use A4.4.2 instead of 4.4.1.1? Why not just keep using what works? If you really need 4.4.2, you're going to have to do some investigation into sound.c and src/unix/*.*. diff may even tell you what happened right away without much effort.

Thomas Fjellstrom

if padsp works, its PulseAudio getting in the way. I think 4.4 has a PulseAudio driver (not 100% sure), just have to make sure it was compiled in.

Alexandre Martins

@Edgar: because package maintainers use the latest version. Also, I'd like to have all the recent updates. One thing it's worth mentioning is that the 4.4.1.1 binary was compiled in some other machine (not only the binary, but the .so as well). When I run aoss <program> in my machine, for that binary only, the sound works. aoss doesn't work for a 4.4.2 binary compiled in my machine.

@Thomas: are you talking about DIGI_ESD (it doesn't work)? Or is this driver documented somewhere? I've been digging the official docs, and it seems I have already tried all possible drivers. I also couldn't find anything relevant by typing ccmake .. when compiling Allegro.

Thomas Fjellstrom

are you talking about DIGI_ESD (it doesn't work)?

Nope. Looks like I'm wrong. I could swear someone made a PulseAudio driver for Allegro 4. But I'm probably just mistaking that for the one in Allegro 5. Sorry about that.

I would say stop PulseAudio, and see if ALSA then works.

Edgar Reynaldo

Well, download the source for 4.4.1.1 and the source for 4.4.2 and put them side by side and then diff the directories, or diff src/sound.c and src/unix/*.* That's probably the only way you're going to find out what broke it.

Thread #609089. Printed from Allegro.cc