Topic: Sound in Open Sonic with PulseAudio
Hi! I have found in the FAQ below tip:
The game has no sound! (Linux)
Games made using the Allegro game programming library can't play sounds on some Linux distributions (like Ubuntu 9.04) due to a problem with pulseaudio (check out the full explanation). This issue can be solved by removing the pulseaudio package. In Debian-based distributions, open a terminal and type:
sudo apt-get remove pulseaudio
In my opinion, removing the package (here it's a sound server), which somebody may need, isn't a solution for the problem. For example, I'm using the PulseAudio, because it can play GNOME sounds (like ESD), mixes sounds in various applications, allows to change their volume separately and doesn't eat much CPU. When I was installing it, I also had a problem with Allegro games, for example Open Sonic, but I managed to solve it without removing PA.
This tutorial describes how to force games using Allegro library to work with PulseAudio. Let's start:
1. In the beginning we must take care of basic configuration of the PulseAudio sound server. If you're using Ubuntu 8.10 or newer you can try to do it by this command:
asoundconf set-pulseaudioIf that works for you, restart your PC and go to 2 step. If not (or you're using Debian / Ubuntu 8.04 and older) open the terminal and type (you can replace gedit with your favourite editor):
gedit .asoundrcYou'll probably see the blank document. Paste into it below code:
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
pcm.!dmix {
type pulse
}Now save it in your HOME directory and restart PC (I think it should also work if you'll restart only your desktop environment). If you want to check whether it works, run pavucontrol and an application, which uses ALSA to play sound, for example Flash 10. If you're able to change volume of your app with pavucontrol, that means you configured PA correctly.
More information about configuring PulseAudio you can find here:
http://www.pulseaudio.org/wiki/PerfectSetup
2. ALSA is default driver used by Allegro apps to play music. Unfortunately alsa plug-in for Allegro doesn't work with PulseAudio, even with good configuration, which we have done in first step (WINE has similar problem). But don't worry, I didn't write that first point to waste your time, we'll need it later.
Now we must disable this broken plugin, so open the terminal and type (command for Ubuntu):
sudo gedit /usr/lib/allegro/4.4.1/modules.lstAgain you can use your own editor. Here we have two ways to achieve our purpose. I'm using and recommending 2a method.
2a. We must comment (disable) all sound plugins, so that we'll force Allegro to use OSS driver. Editing file should look like this:
alleg-vga.so
alleg-fbcon.so
alleg-svgalib.so
alleg-dga2.so
# alleg-esddigi.so
# alleg-artsdigi.so
alleg-sgialdigi.so
# alleg-alsadigi.so
alleg-alsamidi.so
# alleg-jackdigi.soNow you can save the file and go to third step.
2b. (Alternative method, not recommended)
Use this method only as alternative, when the recommended won't work. Why? Because it describes how to use ESD driver with Allegro apps, which gives big delays in playing sounds.
Here the modules.lst file should look like this one (alleg-esddigi.so is uncommented):
alleg-vga.so
alleg-fbcon.so
alleg-svgalib.so
alleg-dga2.so
alleg-esddigi.so
# alleg-artsdigi.so
alleg-sgialdigi.so
# alleg-alsadigi.so
alleg-alsamidi.so
# alleg-jackdigi.soNow you have to install a proper package. In Ubuntu it would be:
sudo apt-get install liballegro4.2-plugin-esdAnd that's all. You don't have to do the third step in this method. Now you can run Open Sonic with working sound and with running PulseAudio in background (remember about delays).
3. In this last step you'll learn how to mix sound in OSS applications with PA (previously we forced Allegro to use OSS). By default our sound server provides "padsp" app, which works nice with a large part of programs using OSS, but not with Allegro (yeah, I know you're now thinking, that nothing works with this allegro
). Of course you can try by yourself, but you won't be pleased. Fortunately, there's another application that works similar to padsp and we'll used it here. It's Alsa-Oss and it was designed to play sound in OSS applications using Alsa. PulseAudio works nice with it (that's because we need to make first step). In Ubuntu type a command:
sudo apt-get install alsa-ossNow the only thing you need to do is to remember, that you must run Open Sonic (and other allegro apps) with aoss. Example:
aoss opensonicIf you have an entry in the menu, you can edit it, so that will be easier to run it in feature.
Enjoy!
PS: I have a request to the admin. Please insert a link to this post in the FAQ, so that people would know there's another way to solve the problem ![]()
Last edited by SzynaW (2011-05-25 19:39:24)
computer science.