Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting different sounddevices in a particular order!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
persia
Tux's lil' helper
Tux's lil' helper


Joined: 02 Oct 2003
Posts: 109
Location: The Netherlands

PostPosted: Thu Aug 19, 2004 11:29 pm    Post subject: Booting different sounddevices in a particular order! Reply with quote

Hello I have a SB Live and a Bt878 Tv-Tuner that also has a
soundcard in it. If I enable this sound as Modules in my kernel this soundcard will bott first and most programs wont be working with sound anymore. This is because Alsa loads my SB LIVE as the SECOND card. I dont want this. I want SB LIVE to be my First! soundcard that is loaded. How do I get Alsa to load my sb live as the first card ?

I have tried this already but no luck.

options snd_emu10k1 index=0
options snd_bt87x index=1

alias sound-slot-0 snd-emu10k1
alias sound-slot-1 snd-bt87x


Thanks for the help. :)
_________________
P4-2400mhz - 512MB Samsung(2700)
Asus P4PE - GForce TI 4200 POV 128MB -
Western Digital 80&120GB 7200rpm 8 MB Cache
Realtek NIC (BCM 4400) & Logitech MX500
BrookTree 878 Tv-Tuner Card
Back to top
View user's profile Send private message
psyqil
Advocate
Advocate


Joined: 26 May 2003
Posts: 2767

PostPosted: Fri Aug 20, 2004 12:06 am    Post subject: Reply with quote

There is an option, but I don't remember it :D
In the meantime you could compile the SB driver into the kernel and load the bt878 as module...
Back to top
View user's profile Send private message
phranzee
Guru
Guru


Joined: 22 Nov 2003
Posts: 397
Location: katowice/pl

PostPosted: Fri Aug 20, 2004 4:40 am    Post subject: Reply with quote

Code:
#               for DRIVER in ${DRIVERS}                                                 
#               do                                                                       
#                       if [ ! "${DRIVER}" = off ] ; then                                 
#                               einfo "Loading drv: ${DRIVER}"                           
#                               /sbin/modprobe ${DRIVER}                                 
#                       fi                                                               
#               done                                                                     
                                                                                         
einfo "Loading drivers ( hacked ;)"                                                       
/sbin/modprobe snd-pcm-oss                                                               
/sbin/modprobe snd-mixer-oss                                                             
/sbin/modprobe snd_emu10k1                                                               
/sbin/modprobe snd_intel8x0                                                             
/sbin/modprobe snd-bt87x   
/etc/init.d/alsasound :) hope it helps.
_________________
signature fault
post dumped ;]
Back to top
View user's profile Send private message
nerdbert
l33t
l33t


Joined: 09 Feb 2003
Posts: 981
Location: Berlin

PostPosted: Fri Aug 20, 2004 10:16 am    Post subject: Reply with quote

just a thought:
maybe it makes a difference if you put this into /etc/modules.conf:

Code:
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1


I know it's part of the OSS/Free portion, but maybe it's still there for a reason.
_________________
I'm really wondering what Lovechild is doing nowadays...
Back to top
View user's profile Send private message
persia
Tux's lil' helper
Tux's lil' helper


Joined: 02 Oct 2003
Posts: 109
Location: The Netherlands

PostPosted: Fri Aug 20, 2004 2:26 pm    Post subject: Reply with quote

phranzee

Your part is interesting but also confusing. I am not sure where excactly to put these lines in the alsasound file. My alsasound file looks a bit different I guess

einfo "Loading drivers ( hacked ;)"
/sbin/modprobe snd-pcm-oss
/sbin/modprobe snd-mixer-oss
/sbin/modprobe snd_emu10k1
/sbin/modprobe snd_intel8x0
/sbin/modprobe snd-bt87x



Quote:

#!/sbin/runscript
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound,v 1.14 2004/06/18 08:07:53 eradicator Exp $
#
# Gentoo users: add this script to 'boot' run level.
# ==================================================
#
# alsasound This shell script takes care of starting and stopping
# the ALSA sound driver.
#
# This script requires /usr/sbin/alsactl and /usr/bin/aconnect programs
# from the alsa-utils package.
#
# Copyright (c) by Jaroslav Kysela <perex@suse.cz>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# Edited to support Linux kernel 2.5 and above as well as 2.4
# John Mylchreest <johnm@gentoo.org>
# July 29, 2003

# Rewritten for better support for built-in drivers
# Jeremy Huddleston <eradicator@gentoo.org>
# 2004.06.02

alsactl=/usr/sbin/alsactl
asoundcfg=/etc/asound.state
aconnect=/usr/bin/aconnect
alsascrdir=/etc/alsa.d

depend() {
need bootmisc localmount
before modules
after isapnp
provide alsa-modules
}

load_modules() {
DRIVERS="$(modprobe -c | grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | awk '{print $3}')"

if modprobe -c | grep -q "snd.*oss$" ; then
# Test for use of OSS
einfo "Using ALSA OSS emulation"
OSS="$(modprobe -l | grep "snd.*oss" | sed -e "s:\/.*\/::" -e "s:\..*::")"
# Add oss modules to list
for i in ${OSS}
do
DRIVERS="${i} ${DRIVERS}"
done
fi

# Fall back on the automated aliases if we don't have ALSA configured properly...
if [ -z "${DRIVERS}" ]; then
ewarn "Could not detect custom ALSA settings. Loading all detected alsa drivers."
DRIVERS="$(modprobe -c | grep pci: | awk '{ print $3 }' | grep snd.* | sort | uniq)"
fi

[ -z "${DRIVERS}" ] && eerror "Unable to find any ALSA drivers. Have you compiled alsa-drivers correctly?"

for DRIVER in ${DRIVERS}
do
if [ ! "${DRIVER}" = off ] &&
[ -z `cut -d' ' -f1 /proc/modules | egrep "^${DRIVER}\$"` ] &&
[ -z `cut -d' ' -f1 /proc/modules | egrep "^${DRIVER//-/_}\$"` ]; then
einfo "Loading: ${DRIVER}"
/sbin/modprobe ${DRIVER}
fi
done

sleep 1

if [ -f /proc/asound/seq/drivers ] ; then
# We want to ensure snd-seq is loaded as it is needed for things like timidity even if
# we don't use a real sequencer.
SEQUENCERS="snd-seq $(awk -F, '$2~/^empty$/ {print $1}' /proc/asound/seq/drivers)"
for SEQUENCER in ${SEQUENCERS}
do
if [ -z `cut -d' ' -f1 /proc/modules | egrep "^${SEQUENCER}\$"` ] &&
[ -z `cut -d' ' -f1 /proc/modules | egrep "^${SEQUENCER//-/_}\$"` ]; then
einfo "Loading: ${SEQUENCER}"
[ -n "${SEQUENCER}" ] && /sbin/modprobe ${SEQUENCER}
fi
done
fi

einfo "Running card-dependent scripts"
for DRIVER in ${DRIVERS}
do
TMP=${DRIVER##snd-}
TMP=${TMP##snd_}
[ -x "${alsascrdir}/${TMP}" ] && ${alsascrdir}/${TMP}
done

[ ! -d /proc/asound ] && eerror "ERROR: Failed to load necessary drivers"
}

unload_modules() {
LOADED_MODULES="$(/sbin/lsmod | grep -E "^snd" | awk '{print $1}')"
for MODULE in ${LOADED_MODULES}
do
/sbin/rmmod ${MODULE} >& /dev/null
done
/sbin/rmmod soundcore >& /dev/null
/sbin/rmmod gameport >& /dev/null
# Return success if the modules are unloaded
test -z "$(/sbin/lsmod | grep -E "^snd" | awk '{print $1}')"
}

terminate() {
#
# Kill processes holding open sound devices
#
# DEVS=`find /dev/ -follow -type c -maxdepth 1 -print 2>/dev/null | xargs ls -dils | grep "1*1[46]," | cut -d: -f2 | cut -d" " -f2; echo /proc/asound/dev/*`
ossdevs="/dev/admmidi? /dev/adsp? /dev/amidi? /dev/audio* /dev/dmfm* \
/dev/dmmidi? /dev/dsp* /dev/dspW* /dev/midi0? /dev/mixer? /dev/music \
/dev/patmgr? /dev/sequencer* /dev/sndstat"
alsadevs="/proc/asound/dev/* /dev/sound/* /dev/snd/*"
fuser -k $ossdevs $alsadevs 2> /dev/null 1>/dev/null

#
# remove all sequencer connections if any
#
[ -f /proc/asound/seq/clients -a -x $aconnect ] && $aconnect --removeall
}

restore_mixer() {
if [ ! -r $asoundcfg ]; then
ewarn "No mixer config in $asoundcfg, you have to unmute your card!"
return 1
elif [ -x $alsactl ]; then
CARDS="$(cat /proc/asound/cards | awk '/: / { print $1 }')"
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}
done
else
eerror -e "ERROR: Cannot find alsactl, did you forget to install media-sound/alsa-utils?"
return 1
fi

return 0
}

save_mixer() {
if [ -x $alsactl ]; then
$alsactl -f $asoundcfg store
else
eerror -e "ERROR: Cannot find alsactl, did you forget to install media-sound/alsa-utils?"
return 1
fi

return 0
}

start() {
if [ -d /proc/asound ] && [ -z "$(grep ' no soundcards ' /proc/asound/cards)" ] ; then
ebegin "ALSA Detected"
else
ebegin "Loading ALSA drivers"
load_modules
fi

einfo "Restoring Mixer Levels"
restore_mixer
eend 0
}

stop() {
if [ ! -d /proc/asound ] ; then
eerror "ALSA is not loaded"
return 0
fi

ebegin "Unloading ALSA"
terminate

einfo "Storing ALSA Mixer Levels"
if ! save_mixer; then
eend 1
fi

einfo "Unloading modules"
if ! unload_modules; then
eend 1
fi

eend 0
}


_________________
P4-2400mhz - 512MB Samsung(2700)
Asus P4PE - GForce TI 4200 POV 128MB -
Western Digital 80&120GB 7200rpm 8 MB Cache
Realtek NIC (BCM 4400) & Logitech MX500
BrookTree 878 Tv-Tuner Card
Back to top
View user's profile Send private message
phranzee
Guru
Guru


Joined: 22 Nov 2003
Posts: 397
Location: katowice/pl

PostPosted: Sun Aug 22, 2004 6:29 pm    Post subject: Reply with quote

i've just removed automatic driver loading and replaced it by this 'hacked' part ;) this way i forced the emu10k1 module to load _before_ intel8x0, so emu10k1 gets /dev/dsp not dsp2. that's all.

just search for the commented part in your alsasound file and replace it as me. it could differ a bit, because i did it some time ago.

good luck
_________________
signature fault
post dumped ;]
Back to top
View user's profile Send private message
Konsti
l33t
l33t


Joined: 10 Dec 2002
Posts: 691

PostPosted: Sun Aug 22, 2004 8:05 pm    Post subject: Reply with quote

I have
Code:
##  ALSA portion
alias snd-card-0 snd-ens1371
alias snd-card-1 snd-emu10k1
alias snd-card-2 snd-cmipci

##  OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2

in my /etc/modules.d/alsa and my ens1371 is always the first!
Do you have tried the snd-card alias thingy?
Otherwise tell the Applications a specific alsa device.
I use mplayer often with 2nd than 1st card:

/opt/mplayer-cvs/bin/mplayer -ao alsa:mmap:device=hw=1

Or when ens1371 is already busy its fed on their second channel:

/opt/mplayer-cvs/bin/mplayer -ao alsa:mmap:device=hw=0.1

Most Programs support specific Device usage...

Konsti
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum