View previous topic :: View next topic |
Author |
Message |
HackingM2 Apprentice
Joined: 26 Jul 2004 Posts: 245 Location: Cambridge, England
|
Posted: Tue Mar 14, 2006 9:05 pm Post subject: [HOWTO] ALSA - Application specific volume controls |
|
|
Application specific volume controls
We've all had the problem which prompted this howto. You're listening to some music and you want it louder so you turn up the volume on XMMS until it is at full but things still aren't quite loud enough so you reach over and crank up the volume on the amp. That's better. All of a sudden a friend signs into MSN and GAIM makes the loudest trumpeting noise you've ever heard!
Well I got sick of this the other day and decided to see what could be done about it. After checking the ALSA documentation, epsecially the section regarding plugins, I knocked up the following asound.conf.
I'll try to walk you through it so that people with little understanding of ALSA can follow along. I'll give a complete version of the asound.conf file at the end too if you just want to cut'n'paste.
I'll assume that you currently have ALSA working for your card. By working I mean that you can play more than one sound at a time using either hardware of software mixing. There are more than enough ALSA guides out there to get you to this point.
Output Devices
The first step is to define any output devices. Here just one is created (called output_main) which is a dmix (software mixing) device sending its output to the first device on the first card. If you have additional sound output devices (such as USB headsets or another sound card) then you will need to define additional devices for those cards with the appropriate hw:X,Y (hw:1,0 being the second device, etc) lines.
Code: | pcm.output_main
{
type dmix
ipc_key 1024
ipc_perm 0666
slave
{
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 8192
}
} |
If your card is capable of hardware mixing you can change the type from dmix to plug and remove the period_xxx and buffer_size statements..
Input Devices
Next we must define any input devices. Here we define two input devices. The first uses hw:0,0 while the second uses hw:1,0 - which in my case is a USB microphone. If you have a headset then you will need to define an additional output device as described above.
Code: | pcm.input_mic
{
type dsnoop
ipc_key 2048
slave.pcm "hw:0,0"
}
pcm.input_usbmic
{
type dsnoop
ipc_key 2049
slave.pcm "hw:1,0"
} |
It is worth noting at this point that all ipc_key values must be unique for the entire file. A convention seems to be to start numbering inputs from 1024 and outputs from 2048. If you only have one input device then ignore the second pcm entry above. In case you are interested dsnoop provides the same software mixing abilities for an input that dmix provides for an output.
Asym Devices
Sometimes it is handy to be able to map different input and output devices to different pcm plugs. In my setup I want the main input (in this case line-in) to be used for some capturing but my USB microphone to be used for others. Below is an example of two asym devices used for exactly that. The first uses the main input and output, the second uses the main output and the USB input.
Code: | pcm.asym_main_mic
{
type asym
playback.pcm "output_main_control"
capture.pcm "input_mic"
}
pcm.asym_main_usbmic
{
type asym
playback.pcm "output_main_control"
capture.pcm "input_usbmic"
} |
Now for the fun bit. The volume controls. That is after all why you have read this far.
Volume Controls
Firstly we need to define a volume control which we will use to control the overall output volume. Those paying extra close attention will see that we have used it as the output device above and I never mentioned it. It uses our original dmix device (output_main) for its output, it is called "All" and will be associated with the first mixer device. I also create another volume control device called default_control which will be used for output to unassigned plug devices.
Code: | pcm.output_main_control
{
type softvol
slave.pcm "output_main"
control
{
name "All"
card 0
}
}
pcm.default_control
{
type softvol
slave.pcm "asym_main_mic"
control
{
name "Unassigned"
card 0
}
} |
Next we just have to decide what categories of volume controls we want. I have chosen Music, Film, Gaim and System. They are defined below. As you can see they mostly use the output_main_control pcm device as their output. This allows them all to be controlled by the main volume slider defined above. The exceptions use the asym devices we created earlier. This is because I want GAIM to use my speakers for audio output and my USB microphone for audio input (assuming that GAIM2.0 supports VV ) and the "System" device (which we use for Gnome later) to use my speakers for output and my line-in for input.
Code: | pcm.music_control
{
type softvol
slave.pcm "output_main_control"
control
{
name "Music"
card 0
}
}
pcm.film_control
{
type softvol
slave.pcm "output_main_control"
control
{
name "Film"
card 0
}
}
pcm.gaim_control
{
type softvol
slave.pcm "asym_main_usbmic"
control
{
name "GAIM"
card 0
}
}
pcm.system_control
{
type softvol
slave.pcm "asym_main_mic"
control
{
name "System"
card 0
}
} |
Are we nearly there yet?
You would imagine that this would probably be the end of things. I certainly did when I tried it the first time. To my surprise nothing could output to any of the volume controls. This, it turns out, is because the sample rate trickles upwards from the hardware to the top device layer and nothing we have created so far supports sample rate conversion. That is the job of the plug device. So lets create some plug devices already.
Plug Devices
First things first, lets create some defaults. These will be used by any ALSA programs unless something else is specified in their config. If anyone knows the difference between these and why they seem to both be needed I'd love to know.
Code: | pcm.!default
{
type plug
slave.pcm "default_control"
}
pcm.default
{
type plug
slave.pcm "default_control"
} |
I want the input from line-in as the default so I have used asym_main_mic when creating the default volume control. If you want your USB microphone or something else which you defined earlier now is the time to change it.
Next we create all the plug devices to connect to for our specific classes of application.
Code: | pcm.music
{
type plug
slave.pcm "music_control"
}
pcm.film
{
type plug
slave.pcm "film_control"
}
pcm.gaim
{
type plug
slave.pcm "gaim_control"
}
pcm.system
{
type plug
slave.pcm "system_control"
} |
We're done! That is it for the configuration of asound.conf.
Changes as of alsa-lib-1.0.11
Well, that used to be it. All that was required was a restart of alsa. For some reason since the release of alsa-lib-1.0.11 some more work is required.
To make the mixer devices available you need to run the following commands, modified for the devices you have created of course.
Code: | aplay /path/to/a.wav -Dfilm
aplay /path/to/a.wav -Dgaim
aplay /path/to/a.wav -Dsystem
aplay /path/to/a.wav -Dmusic
aplay /path/to/a.wav |
Application Configuration
All we have to do now is configure our ALSA applications to use the new plug devices. Thankfully this is fairly easy. I'll give a brief description below for anyone who doesn't know how.
Gnome
This is easy if you use the ESD sound server. If you do then you just need to modify your /etc/esd/esd.conf as below. The key portion is the -d system on the end of spawn_options. You can then check that it works using the test feature of the Multimedia Systems Selector. Don't forget to set it to use esound as the output type too.
Code: | [esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 1 -d system
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
default_options= -as 1 |
If you use ALSA sink then you will need to configure it to use the system plug device which we created earlier. I have never managed to get Gnome to do this so if you know how I would appreciate a post and I'll add it to this howto.
XMMS
XMMS is easy. Just run it, open the options screen (Ctrl+P), go to Audio I/O plugins, select ALSA as the output plugin, click configure and enter music in the Audio device box. You can then use the Music mixer device (on Mixer card 0 unless you changed something) instead of a software volume control.
GAIM
GAIM is almost as easy as XMMS. Open the main window and then the options screen (again Ctrl+P), navigate to Sounds (under Interface) and select Command under Sound Method and enter "aplay -D gaim %s" - without the quotes obviously. This will use the ALSA utility aplay to play back GAIM sounds using the gaim plug device.
XINE
XINE is slightly more complex. You have to run it, obviously. Then click on the small spanner icon to bring up the setup screen. From there navigate to the Audio tab and enter "film" (without the quotes) into the boxes labeled "device used for mono output" and "device used for stereo output". I personally don't set the "sound card can do mmap" option but it works as far as I know.
Enjoy...
When you next fire up a mixer (after a reboot or a restart of alsasound) you should see the new mixer devices. Test them out and enjoy being able to have your system notifications at a reasonable volume even when listening to music. Being able to mute them while watching a film is nice too.
It is worth pointing out at this juncture that some mixer applications require you to select new mixer channels from some kind of menu in their preferences screen.
I hope some of you find this usefull. If you have any questions or comments I'd love to hear them.
Known issues
OSS devices do not play nicely with this configuration. For some reason the volume controls do nothing so all OSS sound is very loud. If anyone knows how to fix this I would be very pleased indeed to hear how. For now Skype is a PITA.
As noted by Jykke if you want to undo this you will have to follow some steps in the correct order.
1) Shutdown ALSA
2) Delete the mixer settings stored in /etc/asound.state
3) Remove the custom /etc/asound.conf
4) Start ALSA
The ALSA init scripts save the mixer settings to /etc/asound.state on shutdown so deleting it first will not work.
EDIT: I just realised that the default device is set to use the asym devices directly so it is VERY loud. Scared me half to death. I've fixed that now so there is a seperate slider for Unassigned output.
Last edited by HackingM2 on Thu Jun 01, 2006 4:29 pm; edited 14 times in total |
|
Back to top |
|
|
HackingM2 Apprentice
Joined: 26 Jul 2004 Posts: 245 Location: Cambridge, England
|
Posted: Tue Mar 14, 2006 9:09 pm Post subject: |
|
|
I just remembered that I promised to post the complete config file for you cut'n'pasters.
Code: | # cat /etc/asound.conf
#################################################################
# #
# PCM output devices #
# #
# Define pcm output devices using dmix for mixing and #
# the appropriate hardware device for output. In most #
# cases there will only be one here but if you have a #
# second sound card or USB headset then you can define #
# more. #
# #
#################################################################
# First sound card uses hw:0,0 as the output device
pcm.output_main
{
type dmix
ipc_key 1024
ipc_perm 0666
slave
{
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 8192
#rate 8000
}
}
# Use only the first two channels for dmix
bindings
{
0 0 # from 0 => to 0
1 1 # from 1 => to 1
}
#################################################################
# #
# PCM input devices #
# #
# Define pcm input devices using dsnoop for mixing #
# and the appropriate hardware device for input. In #
# most cases there will only be one here but if you #
# have a second sound card or USB microphone or headset #
# then you can define more. #
# #
#################################################################
# First one for the first sound card
pcm.input_mic
{
type dsnoop
ipc_key 2048
slave.pcm "hw:0,0"
}
# Then one for the second sound card, which is my case
# is a USB microphone which I use with Skype.
pcm.input_usbmic
{
type dsnoop
ipc_key 2049
slave.pcm "hw:1,0"
}
#################################################################
# #
# Asym devices #
# #
# Sometimes you don't want to use the inputs and outputs from #
# the same card at the same time. Here I define some asym #
# devices to allow this. #
# #
#################################################################
pcm.asym_main_mic
{
type asym
playback.pcm "output_main_control"
capture.pcm "input_mic"
}
pcm.asym_main_usbmic
{
type asym
playback.pcm "output_main_control"
capture.pcm "input_usbmic"
}
#################################################################
# #
# Hardware control devices #
# #
# These devices allow ALSA to control various aspects of the #
# sound cards. Below are simple mixer definitions for two #
# devices. #
# #
#################################################################
ctl.mixer0
{
type hw
card 0
}
ctl.mixer1
{
type hw
card 1
}
#################################################################
# #
# Volume controls #
# #
# Here we will define some SoftVol controls #
# #
#################################################################
pcm.output_main_control
{
type softvol
slave.pcm "output_main"
control
{
name "All"
card 0
}
}
# One for the default output from things that
# we haven't or can't configure
pcm.default_control
{
type softvol
slave.pcm "asym_main_mic"
control
{
name "Unassigned"
card 0
}
}
# One for music output from things like XMMS
pcm.music_control
{
type softvol
slave.pcm "output_main_control"
control
{
name "Music"
card 0
}
}
# One for video output from things like Xine
pcm.film_control
{
type softvol
slave.pcm "output_main_control"
control
{
name "Film"
card 0
}
}
# One for GAIM so that the notifications can be quieter
pcm.gaim_control
{
type softvol
slave.pcm "asym_main_usbmic"
control
{
name "GAIM"
card 0
}
}
# One for the system output such as Gnome
pcm.system_control
{
type softvol
slave.pcm "asym_main_usbmic"
control
{
name "System"
card 0
}
}
# Now one for our OSS device - doesn't seem to work though!
pcm.output_oss
{
type softvol
slave.pcm "asym_main_usbmic"
control
{
name "OSS"
card 0
}
}
#################################################################
# #
# OSS devices #
# #
#################################################################
pcm.dsp0
{
type plug
slave.pcm "output_oss"
}
################################################################
# #
# Default ALSA devices #
# #
# Default pcm devices should use our asymetric device too #
# #
#################################################################
pcm.!default
{
type plug
slave.pcm "default_control"
}
pcm.default
{
type plug
slave.pcm "default_control"
}
# Custom plug devices
pcm.music
{
type plug
slave.pcm "music_control"
}
pcm.film
{
type plug
slave.pcm "film_control"
}
pcm.gaim
{
type plug
slave.pcm "gaim_control"
}
pcm.system
{
type plug
slave.pcm "system_control"
}
|
Last edited by HackingM2 on Thu Apr 20, 2006 5:22 pm; edited 2 times in total |
|
Back to top |
|
|
Ankan n00b
Joined: 26 Nov 2004 Posts: 23 Location: Luleå, Sweden
|
Posted: Tue Mar 14, 2006 11:22 pm Post subject: |
|
|
Thank you very much! Great job, I have been looking for something just like this. I'm not that used to the configuration files of ALSA, but this guide will make it easy. |
|
Back to top |
|
|
evermind Guru
Joined: 10 Jan 2004 Posts: 322
|
Posted: Tue Mar 21, 2006 8:38 am Post subject: |
|
|
nice howto thy |
|
Back to top |
|
|
Jykke Apprentice
Joined: 31 Mar 2006 Posts: 246
|
Posted: Mon Apr 17, 2006 11:03 am Post subject: |
|
|
This sound exactly like the stuff I need.
I got also interested in this:
http://www.mythtv.org/wiki/index.php/Configuring_Digital_Sound#How_do_I_set_up_Myth_plugins_to_use_digital_sound_with_mplayer.3F
after all myth is myth is my target.
However, I tried this one out and I got two new controls in alsamixer
All and Unassigned - how am I able to remove them again?
Firstly the steps what brought them there are not quite clear - yes I made
/etc/asound.conf and afterwards - I assume this is not necessary alsaconf
(I believe /etc/init.d/alsasound restart) should suffice, right?
Anyway now the controls are there - how do I delete them?
Removing that file and restarting alsasound did not work -
the system reacts again to the controls as before but the controls
are now there and they are dud?
Before I start really experimenting I'd like to know how to return the things
as they were (just in case) |
|
Back to top |
|
|
HackingM2 Apprentice
Joined: 26 Jul 2004 Posts: 245 Location: Cambridge, England
|
Posted: Tue Apr 18, 2006 2:20 pm Post subject: |
|
|
Jykke wrote: | However, I tried this one out and I got two new controls in alsamixer
All and Unassigned - how am I able to remove them again? |
You should be able to remove them again simply by deleting /etc/asound.conf and restarting ALSA.
Jykke wrote: | Firstly the steps what brought them there are not quite clear - yes I made
/etc/asound.conf and afterwards - I assume this is not necessary alsaconf |
You are correct. ~/.alsaconf is not required when using a global asound.conf
Jykke wrote: | Anyway now the controls are there - how do I delete them?
Removing that file and restarting alsasound did not work -
the system reacts again to the controls as before but the controls
are now there and they are dud? |
Strange. Have you tried deleting your mixer settings? Some mixers use the saved mixer list instead of the current list returned by ALSA.
Jykke wrote: | Before I start really experimenting I'd like to know how to return the things
as they were (just in case) |
Very sensible. If things don't return to the way they were after removing /etc/asound.conf and ~/.alsaconf let me know. |
|
Back to top |
|
|
Jykke Apprentice
Joined: 31 Mar 2006 Posts: 246
|
Posted: Tue Apr 18, 2006 9:06 pm Post subject: |
|
|
Hi,
nope I don't seem to be getting rid of them
there is also a file called /etc/asound.state
and it has this in it:
control.39 {
comment.access 'read write user'
comment.type INTEGER
comment.count 2
comment.range '0 - 255'
iface MIXER
name All
value.0 203
value.1 203
}
control.40 {
comment.access 'read write user'
comment.type INTEGER
comment.count 2
comment.range '0 - 255'
iface MIXER
name Unassigned
value.0 226
value.1 226
}
I made also trials removing these and now just as I write I got a brainstorming
First I removed them ... then stopped alsa and ... they were there again - damn it
deleted again and then started alsa and now finally they're gone. It obviously saves
them somewhere in memory and restores them in exit - evil bugger - I reckon ~/.asoundrc
is a little bit safer place to work and try before introducing systemwide changes.
Ok, that's solved then - thx - I think now I can try experimenting myself...
Anyway, I am working on this basis now:
http://www.mythtv.org/wiki/index-php/Configuring_Digital_Sound
I am not sure if you know the answer but I'll give it a shot.
When I use this .asoundrc I can give mythtv as a device "ALSA:analog", for example,
then the mixer would be "analog" - If I did not use it I could give as a device ALSA:hw:0,0
but I don't have the faintest idea what to give as a mixer...
(perversely xmms takes as a device analog and as a mixer analog...or whatever - without that ALSA: prefix)
The point is that with this .asoundrc ALL controls in the mixer stop responding - without this file (and /etc/asound.conf)
PCM slider causes some response (at least on xmms - mplayer -ao alsa:device=hw=0,0 blablabla.mp3
obeys no controls except PCM mute but perhaps I could give it a mixer - don't know how though)
So I get simultaneous sound and can define output but loose the volume control.
I am wondering whether I can assign the control to the "existing" sliders - the master, for instance, is
completely dud control for any sound application what I am trying to use.
You made new controls in your example - is it possible to use the existing ones and make them actually do something?
If I take the example from mythtv wiki how would I assign a control?
Is it possible to define more than one slave?
I don't know where exactly to point them but how does this sound as addition:
pcm.new_impressive_mixer (
slave.pcm "analog-hw"
control
{
name "PCM"
card 0
}
}
(and so on for all hardware references digital-hw dmix-analog and dmix-digital?)
Should I then get four new sliders or if I defined it four times and always used name "PCM"
would they all get harnessed to existing "PCM" slider?
From your example I got only two new sliders "ALL" and "Unassigned" was this the intention
or was there also supposed to be Music Film Gaim and Sytem sliders too?
I am sorry it's a bit late and I had no time to make the formulation clearer, there's so much to ask - I hope you can follow
what I am trying to say... |
|
Back to top |
|
|
HackingM2 Apprentice
Joined: 26 Jul 2004 Posts: 245 Location: Cambridge, England
|
Posted: Thu Apr 20, 2006 5:19 pm Post subject: |
|
|
Jykke wrote: | nope I don't seem to be getting rid of them
there is also a file called /etc/asound.state
Ok, that's solved then - thx - I think now I can try experimenting myself... |
Sorry. I should have explained. The mixer settings are stored in /etc/asound.state. You are correct that ALSA writes this file when it is shutdown so deleting it while it is running does nothing. I'll add this as a tip in the howto.
The link doesn't seem to work so I can look at the .asoundrc file you mention. I'm guessing that you want output to both analog and digital outs at the same time - yes? Fix the link and I'll have a look.
Jykke wrote: | I am wondering whether I can assign the control to the "existing" sliders - the master, for instance, is
completely dud control for any sound application what I am trying to use.
You made new controls in your example - is it possible to use the existing ones and make them actually do something? |
As far as I know there is no way to make the existing controls functional if they aren't already. They do nothing on my system too. I am looking into this amongst other things though so I'll get back to you on that.
Jykke wrote: | From your example I got only two new sliders "ALL" and "Unassigned" was this the intention
or was there also supposed to be Music Film Gaim and Sytem sliders too? |
There were meant to be other sliders too. I'll edit the post of the complete config to be my current file to make sure it is correct. Did you just copy it exactly? If you modified it make sure that all the end-points exist. If they don't everything which needs them will not be present either.
Jykke wrote: | I am sorry it's a bit late and I had no time to make the formulation clearer, there's so much to ask - I hope you can follow
what I am trying to say... |
I'm doing ok so far. I hope you understand me also. |
|
Back to top |
|
|
Jykke Apprentice
Joined: 31 Mar 2006 Posts: 246
|
|
Back to top |
|
|
HackingM2 Apprentice
Joined: 26 Jul 2004 Posts: 245 Location: Cambridge, England
|
Posted: Fri Apr 21, 2006 2:04 pm Post subject: |
|
|
OK. I'll have a look.
As you modified my file I would suggest you check the output of aplay -L
It should give you a list of all the defined ALSA objects. I have included mine below so you can compare...
Code: | $ aplay -L
PCM list:
hw {
@args.0 CARD
@args.1 DEV
@args.2 SUBDEV
@args.CARD {
type string
default {
@func getenv
vars {
0 ALSA_PCM_CARD
1 ALSA_CARD
}
default {
@func refer
name 'defaults.pcm.card'
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars {
0 ALSA_PCM_DEVICE
}
default {
@func refer
name 'defaults.pcm.device'
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name 'defaults.pcm.subdevice'
}
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
plughw {
@args.0 CARD
@args.1 DEV
@args.2 SUBDEV
@args.CARD {
type string
default {
@func getenv
vars {
0 ALSA_PCM_CARD
1 ALSA_CARD
}
default {
@func refer
name 'defaults.pcm.card'
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars {
0 ALSA_PCM_DEVICE
}
default {
@func refer
name 'defaults.pcm.device'
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name 'defaults.pcm.subdevice'
}
}
type plug
slave.pcm {
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
}
plug {
@args.0 SLAVE
@args.SLAVE {
type string
}
type plug
slave.pcm $SLAVE
}
shm {
@args.0 SOCKET
@args.1 PCM
@args.SOCKET {
type string
}
@args.PCM {
type string
}
type shm
server $SOCKET
pcm $PCM
}
tee {
@args.0 SLAVE
@args.1 FILE
@args.2 FORMAT
@args.SLAVE {
type string
}
@args.FILE {
type string
}
@args.FORMAT {
type string
default raw
}
type file
slave.pcm $SLAVE
file $FILE
format $FORMAT
}
file {
@args.0 FILE
@args.1 FORMAT
@args.FILE {
type string
}
@args.FORMAT {
type string
default raw
}
type file
slave.pcm null
file $FILE
format $FORMAT
}
null {
type null
}
cards 'cards.pcm'
front 'cards.pcm.front'
rear 'cards.pcm.rear'
center_lfe 'cards.pcm.center_lfe'
side 'cards.pcm.side'
surround40 'cards.pcm.surround40'
surround41 'cards.pcm.surround41'
surround50 'cards.pcm.surround50'
surround51 'cards.pcm.surround51'
surround71 'cards.pcm.surround71'
iec958 'cards.pcm.iec958'
spdif 'cards.pcm.iec958'
modem 'cards.pcm.modem'
phoneline 'cards.pcm.phoneline'
dmix 'cards.pcm.dmix'
dsnoop 'cards.pcm.dsnoop'
output_main {
type dmix
ipc_key 1024
ipc_perm 666
slave {
pcm 'hw:0,0'
period_time 0
period_size 1024
buffer_size 8192
}
}
input_mic {
type dsnoop
ipc_key 2048
slave.pcm 'hw:0,0'
}
input_usbmic {
type dsnoop
ipc_key 2049
slave.pcm 'hw:1,0'
}
asym_main_mic {
type asym
playback.pcm output_main_control
capture.pcm input_mic
}
asym_main_usbmic {
type asym
playback.pcm output_main_control
capture.pcm input_usbmic
}
output_main_control {
type softvol
slave.pcm output_main
control {
name All
card 0
}
}
default_control {
type softvol
slave.pcm asym_main_mic
control {
name Unassigned
card 0
}
}
music_control {
type softvol
slave.pcm output_main_control
control {
name Music
card 0
}
}
film_control {
type softvol
slave.pcm output_main_control
control {
name Film
card 0
}
}
gaim_control {
type softvol
slave.pcm asym_main_usbmic
control {
name GAIM
card 0
}
}
system_control {
type softvol
slave.pcm asym_main_usbmic
control {
name System
card 0
}
}
output_oss0 {
type softvol
slave.pcm asym_main_usbmic
control {
name OSS1
card 0
}
}
output_oss1 {
type softvol
slave.pcm asym_main_mic
control {
name OSS2
card 0
}
}
dsp0 {
type plug
slave.pcm output_oss0
}
dsp1 {
type plug
slave.pcm output_oss1
}
default {
type plug
slave.pcm default_control
}
music {
type plug
slave.pcm music_control
}
film {
type plug
slave.pcm film_control
}
gaim {
type plug
slave.pcm gaim_control
}
system {
type plug
slave.pcm system_control
} |
Hope this helps. I have a similar MythTV setup so I would be interested in getting this to work also. If / when I make any progress I'll get back to you. |
|
Back to top |
|
|
ingomueller.net n00b
Joined: 06 Dec 2006 Posts: 1
|
Posted: Wed Dec 06, 2006 7:39 pm Post subject: Re: [HOWTO] ALSA - Application specific volume controls |
|
|
Hi everybody!
HackingM2 wrote: | If anyone knows the difference between these and why they seem to both be needed I'd love to know.
Code: | pcm.!default
{
type plug
slave.pcm "default_control"
}
pcm.default
{
type plug
slave.pcm "default_control"
} |
|
I'm pretty shure, that the '!' in "pcm.!default" needs to be there, because you are redefining an already existing device "default". The definition of the second default device would then be unnecessary. At least that's how I understand the ALSA documentation about asoundrc.
HackingM2 wrote: | OSS devices do not play nicely with this configuration. For some reason the volume controls do nothing so all OSS sound is very loud. If anyone knows how to fix this I would be very pleased indeed to hear how. |
I'm not really shure about this one, because I didn't use any OSS application since I configured ALSA the last time. But I read in different places that OSS applications use /dev/dsp0 as their default sound card and /dev/mixer0 as their default mixer. One of them is http://www.sabi.co.uk/Notes/linuxSoundALSA.html under Examples of ALSA lib configurations.... The following configuration might help:
Code: | pcm.dsp0 { type plug;
slave.pcm "default_control"; }
ctl.dsp0 { type hw; card 0; }
ctl.mixer0 { type hw; card 0; } |
Greets, Ingo |
|
Back to top |
|
|
|
|
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
|
|