Wednesday, April 2, 2008

Enable Sound for coLinux

In my previous post about installing coLinux with Gentoo, audio part is not touched. Here comes the solution on how to use PulseAudio to bridge coLinux to sound world. This is adapted from here with contents modified for Gentoo Linux.

Windows side

We need to install PulseAudio server on Windows. Frist download binaries for Windows from here. Extract to one directory (c:\bin\pulseaudio in my case).

In the directory of the binaries, create a text config file named default.pa with the content:

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-detect

We start PulseAudio automatically when coLinux starts, by adding the following line to the coLinux configuration file:

exec0=c:\bin\pulseaudio\pulseaudio.exe

Linux side

Install and configure PulseAudio client

Install PulseAudio by emerge pulseaudio. Then edit /etc/pulse/client.conf to set the address of the Windows host that runs the PulseAudio server:

default-server = 192.168.0.1

where 192.168.0.1 is the IP address of the Windows host.

Make sure to add USE flag alsa to /etc/make.conf. If you just add this USE flag, update your system with emerge -uDNv world. ALSA would be automatically emerged.

Install alsa-plugins

In addition, we should install alsa-plugins:

# echo "media-plugins/alsa-plugins pulseaudio" >> /etc/portage/package.use
# emerge alsa-plugins

Edit ~/.asoundrc with the following contents.

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}

pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

Test

As a final step, you can test with an ALSA player:

aplay /usr/share/sounds/alsa/Front_Center.wav

You should hear a voice saying "Front Center". Enjoy!

No comments:

Post a Comment