LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   setting up alsa defaults (https://www.linuxquestions.org/questions/linux-general-1/setting-up-alsa-defaults-97930/)

LinFreak! 09-28-2003 03:19 PM

setting up alsa defaults
 
Hi all,

Does anyone know how to setup default volume levels and unmute line in for alsa? I presume you put something in the /usr/share/alsa/alsa.conf but I can find no mention of it in the readme's, howto's or on lq.
On my system I have made ~./.asoundrc and inserted:

pcm.cmipci {
type hw
card 0
}

ctl.cmipci {
type hw
card 0
}

Sound works fine but I have to umute things and adjust volumes at startup:(

Any help would be appreciated.

ps. perhaps this should be in the howto?

Nechos 09-28-2003 03:29 PM

how about alsamixer?

LinFreak! 09-28-2003 04:42 PM

No, you misunderstand, I can use that to set up volumes but I want to save those settings (alsamixer exits without saving its settings).
edit: no mention of it in alsamixer man page:(

breakerfall 09-28-2003 05:39 PM

I had this problem originally.

When I came to re-installing ALSA, I added it to the startup.

Try rc-update add alsasound boot and reboot and then check the levels in the alsa mixer. I knew that they weren't by default with me. But after adding this line so that it would start at boot time, when checking, the mixer already had the levels set and I didn't need to do it manually [whereas I did previously after every time I started the computer]

Anyway, give it a try and tell us what happens.

[EDIT] changed line!!!

rc-update add alsasound boot is correct

LinFreak! 09-28-2003 05:59 PM

Hmm. Do you mean for me to type "rc-update add alsa boot" as root? If so, the command rc-update doesn't exist on my system:( . I haven't missed something obvious have I?:)

edit: same applies with alsasound.....

breakerfall 09-29-2003 08:42 AM

hmmm.. I'm not sure about slack then... but try starting alsa whilst you're in the system. There should be a way that you can get ALSA to auto load. When you do this, it should have the channels unmuted.

Am I correct in thinking that at the moment you have to load up ALSA mixer to un-mute after every bootup?

I'm just checking some info and I've come across some that I didn't need to do. You might need to do this.

Quote:

Running and unmuting

Since we're Linux users, we don't want to reboot. So we'll start the alsasound script manually.

Code listing 3.2

# /etc/init.d/alsasound start

ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running lsmod. However, sound won't work yet, because the channels are still muted. We need amixer for this.

Code listing 3.3: Running amixer

# amixer

Warning: You shouldn't get this, but if you get an error about "amixer: Mixer attach default error: No such file or directory", you should manually modprobe snd-mixer-oss and snd-pcm-oss once. After that run amixer again.

Code listing 3.4: only if you get an error when running amixer

# modprobe snd-mixer-oss
# modprobe snd-pcm-oss
# amixer

If you got this far, now unmute Master and PCM channels. Some hardware even requires you to unmute the center channel or even the surround channel.

Code listing 3.5: Unmuting channels

# amixer set Master 100 unmute
# amixer set PCM 100 unmute
Only if the above doesn't succeed on its own:
# amixer set Center 100 unmute
# amixer set Surround 100 unmute
Test the sound:
# aplay $KDEDIR/share/sounds/pop.wav // (pop.wav is part of KDE)

We check to see if sound is working by using the aplay (alsa play) command. If you hear a pop, then sound is indeed working. Then, adjust the volume settings to your liking; the ncurses-based alsamixer is a great way to get them "just so".

You may want to emerge alsa-xmms as that will provide ALSA support for XMMS.
When you reboot your system, the alsasound init script will properly save and restore your volume settings.

LinFreak! 09-29-2003 11:59 AM

Thanks very much for all the info and for finding that piece of text. I'll give it a try as soon as I have some time and let you know how it goes:)

LinFreak! 09-29-2003 01:58 PM

I don't have init.d type system, instead I have /etc/rc.d/*.rc which handle runlevels, modules, internet etc....
I do however have the alsa sources and in the "driver" source package is the script "alsasound" in which can be found the lines:

function stop() {
#
# store driver settings
#
if [ -x $alsactl ]; then
$alsactl -f $asoundcfg store
else
echo -n -e "${rc_warning}!!!alsactl not found!!!${rc_reset} "
fi

so, in a rood console, I typed "alsactl -f asoundcfg store" and hey presto!

Thanks again for info breakerfall:)

breakerfall 09-30-2003 04:12 PM

Glad you got it working in the end :)

petarsabev 09-30-2003 07:32 PM

I do this by modules.conf file.
Put this :
post-install snd-xxx-xxx /usr/sbin/alsactl restore
pre-remove snd-xxx-xxx /usr/sbin/alsactl store
After this you can make your changes in alsamixer and do alsactl store .
Reboot.
There must be sound now .
Here is my modules.conf:

alias char-major-116 snd
alias snd-card-0 snd-intel8x0
alias char-major-14 soundcore
post-install snd-intel8x0 /usr/sbin/alsactl restore
pre-remove snd-intel8x0 /usr/sbin/alsactl store
alias sound-slot-0 snd-card-0
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
options snd major=116 cards_limit=1 device_mode=0666
options snd-intel8x0 index=0

LinFreak! 10-01-2003 12:13 PM

Glad you posted that petatsabev as my previous post doesn't seem to do the trick, it said it saved the settings but when I rebooted I found that the line input was still muted!:(

I'll wade through what you posted and see what happens.

ps. I'll reboot and test it this time - before I post "It works!!!" ;)


All times are GMT -5. The time now is 12:31 AM.