HOWTO nForce2 hw mixing

Contents

[hide]
  • 1 Introduction
    • 1.1 Comment:
  • 2 Preparing Kernel 2.6
  • 3 Inserting nvsound module
  • 4 System configuration
  • 5 ALSA/OSS mixers
  • 6 Known problems
    • 6.1 This guide is all wrong

[ edit]

Introduction

This HOWTO is based on the following thread from Gentoo Forums, started by -=GGW=- $ol!d $n4>|e. This article is devoted to all people with nvidia's SoundStorm integrated on motherboard and willing to obtain hardware sound mixing with ALSA.

[ edit]

Comment:

This HOWTO is not correct. The nvidia kernel module is for the Open Sound System and not alsa related. So skip the parts where alsa gets configured. Read at the bottom of this page what needs to be done or check the Release notes.

[ edit]

Preparing Kernel 2.6

First we have to change directory to /usr/src/linux and make menuconfig in order to configure our kernel

# cd /usr/src/linux
# make menuconfig 

You need to have these things checked as built in, not modular.

Linux Kernel Configuration: Kernel Configuration
Device Drivers --->
   Sound --->
      <*> Sound card support
      Advanced Linux Sound Architecture --->
         <*> Advanced Linux Sound Architecture
         <*> Sequencer support
         <*> OSS Mixer API
         <*> OSS PCM (digital audio) API
         PCI devices --->
            <*> Intel/SiS/nVidia/AMD/ALi AC97 Controller
      Open Sound System --->
         <*> Open Sound System (DEPRECATED)
         <*> VIA 82C686 Audio Codec


Assuming there have been changes in your kernel's configuration you will have to recompile it and install, otherwise you can pass to the next paragraph

# make && make modules_install
# cp arch/i386/boot/bzImage /boot/kernel-2.6
# cp System.map /boot/System.map-2.6
# cp .config /boot/config-2.6 

After that you need to reload your kernel which simply means rebooting

# reboot
[ edit]

Inserting nvsound module

Now you need to get nForce2 precompiled drivers provided by nvidia. You can download it form http://www.nvidia.com/object/unix.html and install manually yet as we are using Gentoo Linux, the most convenient way is to use Portage :D

# emerge nforce-audio

Next you will be most probably able to load your newly created module nvsound . Let's pray and let's test it

# modprobe nvsound
# modules-update

If no ugly message appears the module works :) To remove module just type:

# rmmod nvsound
Note: After each more serious recompilation of your kernel you will also have to reemerge (reinstall) nvsound module.
[ edit]

System configuration

Configure /etc/modules.d/alsa

File: /etc/modules.d/alsa
 
  # ALSA portion
  alias char-major-116 snd
  alias snd-card-0 snd-intel8x0
  # OSS/Free portion
  alias char-major-14 soundcore
  alias sound-slot-0 snd-card-0 snd-intel8x0
  
  # OSS/Free portion - card #1
  alias sound-service-0-0 snd-mixer-oss
  alias sound-service-0-1 snd-seq-oss
  alias sound-service-0-3 snd-pcm-oss
  alias sound-service-0-8 snd-seq-oss
  alias sound-service-0-12 snd-pcm-oss
  
  alias /dev/mixer snd-mixer-oss
  alias /dev/dsp snd-pcm-oss
  alias /dev/midi snd-seq-oss
  
  options snd cards_limit=1
  

To be safe, check to make sure /etc/devfsd.conf is set up properly

File: /etc/devfsd.conf
# ALSA/OSS stuff
# Comment/change these if you want to change the permissions on
# the audio devices
LOOKUP snd MODLOAD ACTION snd
LOOKUP dsp MODLOAD
LOOKUP mixer MODLOAD
LOOKUP midi MODLOAD
REGISTER sound/.* PERMISSIONS root.audio 660
REGISTER snd/.* PERMISSIONS root.audio 660

in order to have nvsound loaded at boot add nvsound into your /etc/modules.autoload.d/kernel-2.6

echo "nvsound" >> /etc/modules.autoload.d/kernel-2.6
Note: Since nvsound takes care of hw mixing there is no need to set up a /.asoundrc config file for dmixing. Infact, setting one up will break the built in hwmixing and cause conflicts with some programs.
[ edit]

ALSA/OSS mixers

In order to be able to save and restore your alsa mixer level you have to:

# emerge alsa-utils
# emerge alsa-oss

Now since the original /etc/init.d/alsasound will attempt to load modules that are all ready taken car of nvidia and will spit out long annoying ugly looking warning and erros at you when you boot up, we use a modified version of the script.

File: /etc/init.d/alsasound
#!/sbin/runscript
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound,v 1.23 2005/04/21 09:07:45 eradicator Exp $

alsactl=/usr/sbin/alsactl
asoundcfg=/etc/asound.state

opts="${opts} save"

depend() {
need bootmisc localmount
after modules isapnp coldplug hotplug
}

restore_mixer() {
ebegin "Restoring Mixer Levels"

local val=0

if [[ ! -r ${asoundcfg} ]] ; then
ewarn "No mixer config in ${asoundcfg}, you have to unmute your card!"
elif [[ -x ${alsactl} ]] ; then
local CARDS="$(cat /proc/asound/cards | awk '/: / { print $1 }')"
local CARDNUM
for CARDNUM in ${CARDS}
do
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
${alsactl} -f ${asoundcfg} restore ${CARDNUM}
((val=val+$?))
done
else
eerror -e "ERROR: Cannot find alsactl, did you forget to install media-sound/alsa-utils?"
val=1
fi

eend ${val}
return ${val}
}

save() {
ebegin "Storing ALSA Mixer Levels"

local val=0

if [[ -x ${alsactl} ]] ; then
${alsactl} -f ${asoundcfg} store
val=$?
else
eerror -e "ERROR: Cannot find alsactl."
val=1
fi

eend ${val}
return ${val}
}

start() {
restore_mixer
}

stop() {
save
}

Use your favorite text editor to make that and save it as root in /etc/init.d/ as alsarestore (or whatever you want it to be called). For the purpose of this guide I will assume you named it alsarestore.

In order to make the boot script executable, as root do

# chmod +x /etc/init.d/alsarestore

Now we add the script to the boot run level

# rc-update add alsarestore boot

Next you have to unmute your channels.

# amixer set Master 100% unmute
# amixer set PCM 100% unmute

Activate the script so that it will store the sound state

# /etc/init.d/alsarestore start

Just to be safe

# alsactl store
[ edit]

Known problems

  • Hardware mixing works only with ALSA, OSS using programs will block sound device.
  • Although this may seem not related to sound, people with nForce2 motherboards in order to get USB keyboard/mouse properly working should check in kernel configuration OHCI HCD Support instead of UHCI HCD (most Intel and VIA) support
  • As well as that if you use nForce2 LAN Controler you should check Reverse Engineered nForce Ethernet support (EXPERIMENTAL)


[ edit]

This guide is all wrong

The new nvsound module is OSS only and supports hardware-mixing. You don't need any of the alsa stuff in the kernel. You just need to enable "Open Sound System" in the linux-kernel. Then emerge nforce-audio and load the nvsound module. Use nvmixer to set up your speaker options. To store the settings and get them loaded after a reboot, add the following to "/etc/conf.d/local.start"

/usr/bin/nvmix-reg -f /etc/nvmixrc -L >/dev/null 1>&2

You don't need to start alsa at boot. (do 'rc-update del alsasound')

Retrieved from " http://gentoo-wiki.com/HOWTO_nForce2_hw_mixing"

你可能感兴趣的:(linux,Module,System,audio,deprecated,permissions)