alsa: rework mixer logic

Completely rework mixer logic. This now allows controlling a full set of
elements from a single sink's volume slider/mute button.

This also introduces sink and source "ports" that can be used to choose
different input or output ports with the UI. (i.e. "mic"/"line-in" or
"speaker"/"headphones".

The mixer paths and device maps are now configered in external
configuration files and can be tweaked as necessary.
This commit is contained in:
Lennart Poettering 2009-06-17 03:45:14 +02:00
parent e9c70ac41b
commit 31575f7766
54 changed files with 7029 additions and 1694 deletions

View file

@ -0,0 +1,32 @@
# For devices, where we have an Aux element
[General]
priority = 90
name = analog-input
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
switch = off
volume = off
[Element Line]
switch = off
volume = off
[Element Aux]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Video]
switch = off
volume = off
.include analog-input.conf.common

View file

@ -0,0 +1,44 @@
# For devices where we have an FM element
[General]
priority = 70
name = analog-input-radio
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
switch = off
volume = off
[Element Line]
switch = off
volume = off
[Element Aux]
switch = off
volume = off
[Element Video]
switch = off
volume = off
[Element Mic/Line]
switch = off
volume = off
[Element TV Tuner]
switch = off
volume = off
[Element FM]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
.include analog-input.conf.common

View file

@ -0,0 +1,43 @@
# For devices, where we have a Line element
[General]
priority = 90
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
switch = off
volume = off
[Element Line]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Aux]
switch = off
volume = off
[Element Video]
switch = off
volume = off
[Element Mic/Line]
switch = off
volume = off
[Element TV Tuner]
switch = off
volume = off
[Element FM]
switch = off
volume = off
.include analog-input.conf.common

View file

@ -0,0 +1,44 @@
# For devices where we have a Mic/Lineb element
[General]
priority = 90
name = analog-input
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
switch = off
volume = off
[Element Line]
switch = off
volume = off
[Element Aux]
switch = off
volume = off
[Element Video]
switch = off
volume = off
[Element Mic/Line]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element TV Tuner]
switch = off
volume = off
[Element FM]
switch = off
volume = off
.include analog-input.conf.common

View file

@ -0,0 +1,45 @@
# For devices where we have a Mic element
[General]
priority = 100
name = analog-input-microphone
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Line]
switch = off
volume = off
[Element Aux]
switch = off
volume = off
[Element Video]
switch = off
volume = off
[Element Mic/Line]
switch = off
volume = off
[Element TV Tuner]
switch = off
volume = off
[Element FM]
switch = off
volume = off
.include analog-input.conf.common
.include analog-input-mic.conf.common

View file

@ -0,0 +1,41 @@
;;; 'Mic Select'
[Element Mic Select]
enumeration = select
[Option Mic Select:Mic1]
name = input-microphone
priority = 20
[Option Mic Select:Mic2]
name = input-microphone
priority = 19
;;; Various Boosts
[Element Mic Boost (+20dB)]
switch = select
[Option Mic Boost (+20dB):on]
name = input-boost-on
[Option Mic Boost (+20dB):off]
name = input-boost-off
[Element Mic Boost]
switch = select
[Option Mic Boost:on]
name = input-boost-on
[Option Mic Boost:off]
name = input-boost-off
[Element Front Mic Boost]
switch = select
[Option Front Mic Boost:on]
name = input-boost-on
[Option Front Mic Boost:off]
name = input-boost-off

View file

@ -0,0 +1,44 @@
# For devices, where we have a TV Tuner element
[General]
priority = 70
name = analog-input-video
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
switch = off
volume = off
[Element Line]
switch = off
volume = off
[Element Aux]
switch = off
volume = off
[Element Video]
switch = off
volume = off
[Element Mic/Line]
switch = off
volume = off
[Element TV Tuner]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element FM]
switch = off
volume = off
.include analog-input.conf.common

View file

@ -0,0 +1,31 @@
# For devices, where we have a Video element
[General]
priority = 70
[Element Capture]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
switch = off
volume = off
[Element Line]
switch = off
volume = off
[Element Aux]
switch = off
volume = off
[Element Video]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
.include analog-input.conf.common

View file

@ -0,0 +1,35 @@
# A fallback for devices that lack seperate Mic/Line/Aux/Video elements
[General]
priority = 100
[Element Capture]
required = volume
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Mic]
required-absent = any
[Element Line]
required-absent = any
[Element Aux]
required-absent = any
[Element Video]
required-absent = any
[Element Mic/Line]
required-absent = any
[Element TV Tuner]
required-absent = any
[Element FM]
required-absent = any
.include analog-input.conf.common
.include analog-input-mic.conf.common

View file

@ -0,0 +1,239 @@
# Mixer path for PulseAudio's ALSA backend. If multiple options by the
# same id are discovered they will be suffixed with a number to
# distuingish them, in the same order they appear here.
#
# Source selection should use the following names:
#
# input -- If we don't know the exact kind of input
# input-microphone
# input-microphone-internal
# input-microphone-external
# input-linein
# input-video
# input-radio
# input-docking-microphone
# input-docking-linein
# input-docking
#
# We explicitly don't want to wrap the following sources:
#
# CD
# Synth/MIDI
# Phone
# Mix
# Digital/SPDIF
# Master
# PC Speaker
#
;;; 'Input Source Select'
[Element Input Source Select]
enumeration = select
[Option Input Source Select:Input1]
name = input
priority = 10
[Option Input Source Select:Input2]
name = input
priority = 5
;;; 'Input Source'
[Element Input Source]
enumeration = select
[Option Input Source:Mic]
name = input-microphone
priority = 20
[Option Input Source:Microphone]
name = input-microphone
priority = 20
[Option Input Source:Front Mic]
name = input-microphone
priority = 19
[Option Input Source:Front Microphone]
name = input-microphone
priority = 19
[Option Input Source:Line]
name = input-linein
priority = 18
[Option Input Source:Line-In]
name = input-linein
priority = 18
[Option Input Source:Line In]
name = input-linein
priority = 18
;;; ' Capture Source'
[Element Capture Source]
enumeration = select
[Option Capture Source:TV Tuner]
name = input-video
[Option Capture Source:FM]
name = input-radio
[Option Capture Source:Mic/Line]
name = input
[Option Capture Source:Line/Mic]
name = input
[Option Capture Source:Mic]
name = input-microphone
[Option Capture Source:Microphone]
name = input-microphone
[Option Capture Source:Int Mic]
name = input-microphone-internal
[Option Capture Source:Int DMic]
name = input-microphone-internal
[Option Capture Source:Internal Mic]
name = input-microphone-internal
[Option Capture Source:iMic]
name = input-microphone-internal
[Option Capture Source:i-Mic]
name = input-microphone-internal
[Option Capture Source:Internal Microphone]
name = input-microphone-internal
[Option Capture Source:Front Mic]
name = input-microphone
[Option Capture Source:Front Microphone]
name = input-microphone
[Option Capture Source:Rear Mic]
name = input-microphone
[Option Capture Source:Mic1]
name = input-microphone
[Option Capture Source:Mic2]
name = input-microphone
[Option Capture Source:D-Mic]
name = input-microphone
[Option Capture Source:IntMic]
name = input-microphone-internal
[Option Capture Source:ExtMic]
name = input-microphone-external
[Option Capture Source:Ext Mic]
name = input-microphone-external
[Option Capture Source:E-Mic]
name = input-microphone-external
[Option Capture Source:e-Mic]
name = input-microphone-external
[Option Capture Source:LineIn]
name = input-linein
[Option Capture Source:Analog]
name = input
[Option Capture Source:Line]
name = input-linein
[Option Capture Source:Line-In]
name = input-linein
[Option Capture Source:Line In]
name = input-linein
[Option Capture Source:Video]
name = input-video
[Option Capture Source:Aux]
name = input
[Option Capture Source:Aux0]
name = input
[Option Capture Source:Aux1]
name = input
[Option Capture Source:Aux2]
name = input
[Option Capture Source:Aux3]
name = input
[Option Capture Source:AUX IN]
name = input
[Option Capture Source:Aux In]
name = input
[Option Capture Source:AOUT]
name = input
[Option Capture Source:AUX]
name = input
[Option Capture Source:Cam Mic]
name = input-microphone
[Option Capture Source:Digital Mic]
name = input-microphone
[Option Capture Source:Digital Mic 1]
name = input-microphone
[Option Capture Source:Digital Mic 2]
name = input-microphone
[Option Capture Source:Analog Inputs]
name = input
[Option Capture Source:Unknown1]
name = input
[Option Capture Source:Unknown2]
name = input
[Option Capture Source:Docking-Station]
name = input-docking
[Option Capture Source:Dock Mic]
name = input-docking-microphone
;;; Various Boosts
[Element Capture Boost]
switch = select
[Option Capture Boost:on]
name = input-boost-on
[Option Capture Boost:off]
name = input-boost-off
[Element Auto Gain Control]
switch = select
[Option Auto Gain Control:on]
name = input-agc-on
[Option Auto Gain Control:off]
name = input-agc-off

View file

@ -0,0 +1,53 @@
# Path for mixers that have a Headphone slider
[General]
priority = 90
[Element Hardware Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Master Mono]
switch = off
volume = off
[Element Headphone]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Front]
switch = off
volume = off
[Element Rear]
switch = off
volume = off
[Element Sourround]
switch = off
volume = off
[Element Side]
switch = off
volume = off
[Element Center]
switch = off
volume = off
[Element LFE]
switch = off
volume = off
.include analog-output.conf.common

View file

@ -0,0 +1,54 @@
# Intended for usage in laptops that have a seperate LFE speaker
# connected to the Master mono connector
[General]
priority = 40
[Element Hardware Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Master]
switch = mute
volume = merge
override-map.1 = all-no-lfe
override-map.2 = all-left,all-right
[Element Master Mono]
required = any
switch = mute
volume = merge
override-map.1 = lfe
override-map.2 = lfe,lfe
[Element Headphone]
switch = off
volume = off
[Element Front]
switch = off
volume = off
[Element Rear]
switch = off
volume = off
[Element Sourround]
switch = off
volume = off
[Element Side]
switch = off
volume = off
[Element Center]
switch = off
volume = off
[Element LFE]
switch = off
volume = off
.include analog-output.conf.common

View file

@ -0,0 +1,51 @@
# Intended for usage on boards that have a seperate Mono output plug.
[General]
priority = 50
[Element Hardware Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Master]
switch = off
volume = off
[Element Master Mono]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Headphone]
switch = off
volume = off
[Element Front]
switch = off
volume = off
[Element Rear]
switch = off
volume = off
[Element Sourround]
switch = off
volume = off
[Element Side]
switch = off
volume = off
[Element Center]
switch = off
volume = off
[Element LFE]
switch = off
volume = off
.include analog-output.conf.common

View file

@ -0,0 +1,62 @@
# Intended for the 'default' output
[General]
priority = 100
[Element Hardware Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element Master Mono]
switch = off
volume = off
[Element Headphone]
switch = off
volume = off
[Element Front]
switch = mute
volume = merge
override-map.1 = all-front
override-map.2 = front-left,front-right
[Element Rear]
switch = mute
volume = merge
override-map.1 = all-rear
override-map.2 = rear-left,rear-right
[Element Surround]
switch = mute
volume = merge
override-map.1 = all-rear
override-map.2 = rear-left,rear-right
[Element Side]
switch = mute
volume = merge
override-map.1 = all-side
override-map.2 = side-left,side-right
[Element Center]
switch = mute
volume = merge
override-map.1 = all-center
override-map.2 = all-center,all-center
[Element LFE]
switch = mute
volume = merge
override-map.1 = lfe
override-map.2 = lfe,lfe
.include analog-output.conf.common

View file

@ -0,0 +1,40 @@
# Common part of all paths
# [General]
# priority = ...
# description = ...
#
# [Option ...:...]
# name = ...
# priority = ...
#
# [Element ...]
# required = ignore | switch | volume | enumeration | any
# required-absent = ignore | switch | volume
#
# switch = ignore | mute | off | on | select
# volume = ignore | merge | off | zero
# enumeration = ignore | select
#
# direction = playback | capture
# direction-try-other = no | yes
#
# override-map.1 = ...
# override-map.2 = ...
[Element PCM]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
[Element External Amplifier]
switch = select
[Option External Amplifier:on]
name = output-amplifier-on
priority = 0
[Option External Amplifier:off]
name = output-amplifier-off
priority = 10