add hotplug support for external usb device by using udev to switch to use external device as default [release 1.0.27.2-2mamba;Sat Dec 07 2013]

This commit is contained in:
Silvan Calarco 2024-01-05 20:21:32 +01:00
parent e6333ecc12
commit 74df584623
11 changed files with 1435 additions and 0 deletions

View File

@ -1,2 +1,11 @@
# alsa-utils
The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system.
ALSA has the following significant features:
- efficient support for all types of audio interfaces, from consumer soundcards to professional multichannel audio interfaces
- fully modularized sound drivers
- SMP and thread-safe design
- user space library (alsa-lib) to simplify application programming and provide higher level functionality
- support for the older OSS API, providing binary compatibility for most OSS programs

449
alsa-asound.conf Normal file
View File

@ -0,0 +1,449 @@
#
# openmamba system default configuration for the Advanced Linux Sound Architecture (ALSA)
#
# hardware devices -> dmix for output
pcm.dmixed {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
pcm.dmixed1 {
type dmix
ipc_key 1024
slave {
pcm "hw:2,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
# hardware devices -> dsnoop for input
pcm.dsnooped {
ipc_key 1025
type dsnoop
slave {
pcm "hw:0,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
pcm.dsnooped1 {
ipc_key 1025
type dsnoop
slave {
pcm "hw:2,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
# hardware devices -> dmix -> softvol
pcm.softvol_out {
type softvol
slave {
pcm "dmixed" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Output Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 20.0
}
pcm.softvol_in {
type softvol
slave {
pcm "dsnooped" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Capture Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 50.0
}
pcm.softvol_out1 {
type softvol
slave {
pcm "dmixed1" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Output Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 20.0
}
pcm.softvol_in1 {
type softvol
slave {
pcm "dsnooped1" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Capture Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 50.0
}
# softvol_in + softvol_out -> asym
pcm.asymed {
type asym
playback.pcm "softvol_out"
capture.pcm "softvol_in"
}
pcm.pasymed {
type plug
slave.pcm "asymed"
}
pcm.asymed1 {
type asym
playback.pcm "softvol_out1"
capture.pcm "softvol_in1"
}
pcm.pasymed1 {
type plug
slave.pcm "asymed1"
}
pcm.!default {
type plug
slave.pcm "asymed"
hint {
show on
description "System default (recommended)"
}
}
pcm.!default1 {
type plug
slave.pcm "asymed1"
hint {
show on
description "External device"
}
}
ctl.!default {
type hw
card 0
}
# Other special pcms
pcm.skype {
type route
slave.pcm "dsnooped"
ttable.0.1 1
ttable.1.0 1
}
#for aoss:
pcm.dsp0 {
type plug
slave.pcm "asymed"
}
ctl.mixer0 {
type hw
card 0
}
##a quick plug plugin for above device to do the converting magic
#pcm.pasymed {
# type plug
# slave.pcm "asymed"
#}
##a ctl device to keep xmms happy
#ctl.pasymed {
# type hw
# card 0
#}
# Jack Loop 1
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_1 {
type plug
slave.pcm "hw:Loopback,0,0"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_1 {
type plug
slave.pcm "hw:Loopback,0,1"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_1 {
type asym
playback.pcm "jack_playback_1"
capture.pcm "jack_capture_1"
hint {
show on
description "ALSA Jack Interface 1"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_1 {
type plug
slave.pcm "hw:Loopback,1,0"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_1 {
type plug
slave.pcm "hw:Loopback,1,1"
}
# Jack Loop 2
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_2 {
type plug
slave.pcm "hw:Loopback,0,2"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_2 {
type plug
slave.pcm "hw:Loopback,0,3"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_2 {
type asym
playback.pcm "jack_playback_2"
capture.pcm "jack_capture_2"
hint {
show on
description "ALSA Jack Interface 2"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_2 {
type plug
slave.pcm "hw:Loopback,1,2"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_2 {
type plug
slave.pcm "hw:Loopback,1,3"
}
###############
# Jack Loop 3 ##############################################
###############
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_3 {
type plug
slave.pcm "hw:Loopback,0,4"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_3 {
type plug
slave.pcm "hw:Loopback,0,5"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_3 {
type asym
playback.pcm "jack_playback_3"
capture.pcm "jack_capture_3"
hint {
show on
description "ALSA Jack Interface 3"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_3 {
type plug
slave.pcm "hw:Loopback,1,4"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_3 {
type plug
slave.pcm "hw:Loopback,1,5"
}
###############
# Jack Loop 4 ##############################################
###############
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_4 {
type plug
slave.pcm "hw:Loopback,0,6"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_4 {
type plug
slave.pcm "hw:Loopback,0,7"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_4 {
type asym
playback.pcm "jack_playback_4"
capture.pcm "jack_capture_4"
hint {
show on
description "ALSA Jack Interface 4"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_4 {
type plug
slave.pcm "hw:Loopback,1,6"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_4 {
type plug
slave.pcm "hw:Loopback,1,7"
}

450
alsa-asound.conf-usb Normal file
View File

@ -0,0 +1,450 @@
#
# openmamba system default configuration for the Advanced Linux Sound Architecture (ALSA)
#
# hardware devices -> dmix for output
pcm.dmixed {
type dmix
ipc_key 1024
slave {
pcm "hw:2,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
pcm.dmixed1 {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
# hardware devices -> dsnoop for input
pcm.dsnooped {
ipc_key 1025
type dsnoop
slave {
pcm "hw:2,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
pcm.dsnooped1 {
ipc_key 1025
type dsnoop
slave {
pcm "hw:0,0" # you cannot use a "plug" device here, darn.
period_time 0
period_size 1024 # must be power of 2
#buffer_time 0
#buffer_size 4096
#format "S32_LE"
#periods 128
#rate 48000
}
bindings {
0 0
1 1
}
}
# hardware devices -> dmix -> softvol
pcm.softvol_out {
type softvol
slave {
pcm "dmixed" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Output Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 20.0
}
pcm.softvol_in {
type softvol
slave {
pcm "dsnooped" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Capture Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 50.0
}
pcm.softvol_out1 {
type softvol
slave {
pcm "dmixed1" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Output Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 20.0
}
pcm.softvol_in1 {
type softvol
slave {
pcm "dsnooped1" #redirect the output to dmix (instead of "hw:0,0")
}
control {
name "Capture Gain" #override the PCM slider to set the softvol volume level globally
card 0
}
max_dB 50.0
}
# softvol_in + softvol_out -> asym
pcm.asymed {
type asym
playback.pcm "softvol_out"
capture.pcm "softvol_in"
}
pcm.pasymed {
type plug
slave.pcm "asymed"
}
pcm.asymed1 {
type asym
playback.pcm "softvol_out1"
capture.pcm "softvol_in1"
}
pcm.pasymed1 {
type plug
slave.pcm "asymed1"
}
pcm.!default {
type plug
slave.pcm "asymed"
hint {
show on
description "System default (recommended)"
}
}
pcm.!default1 {
type plug
slave.pcm "asymed1"
hint {
show on
description "Internal device"
}
}
ctl.!default {
type hw
card 0
}
# Other special pcms
pcm.skype {
type route
slave.pcm "dsnooped"
ttable.0.1 1
ttable.1.0 1
}
#for aoss:
pcm.dsp0 {
type plug
slave.pcm "asymed"
}
ctl.mixer0 {
type hw
card 0
}
##a quick plug plugin for above device to do the converting magic
#pcm.pasymed {
# type plug
# slave.pcm "asymed"
#}
##a ctl device to keep xmms happy
#ctl.pasymed {
# type hw
# card 0
#}
# Jack Loop 1
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_1 {
type plug
slave.pcm "hw:Loopback,0,0"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_1 {
type plug
slave.pcm "hw:Loopback,0,1"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_1 {
type asym
playback.pcm "jack_playback_1"
capture.pcm "jack_capture_1"
hint {
show on
description "ALSA Jack Interface 1"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_1 {
type plug
slave.pcm "hw:Loopback,1,0"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_1 {
type plug
slave.pcm "hw:Loopback,1,1"
}
# Jack Loop 2
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_2 {
type plug
slave.pcm "hw:Loopback,0,2"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_2 {
type plug
slave.pcm "hw:Loopback,0,3"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_2 {
type asym
playback.pcm "jack_playback_2"
capture.pcm "jack_capture_2"
hint {
show on
description "ALSA Jack Interface 2"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_2 {
type plug
slave.pcm "hw:Loopback,1,2"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_2 {
type plug
slave.pcm "hw:Loopback,1,3"
}
###############
# Jack Loop 3 ##############################################
###############
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_3 {
type plug
slave.pcm "hw:Loopback,0,4"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_3 {
type plug
slave.pcm "hw:Loopback,0,5"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_3 {
type asym
playback.pcm "jack_playback_3"
capture.pcm "jack_capture_3"
hint {
show on
description "ALSA Jack Interface 3"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_3 {
type plug
slave.pcm "hw:Loopback,1,4"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_3 {
type plug
slave.pcm "hw:Loopback,1,5"
}
###############
# Jack Loop 4 ##############################################
###############
############ ALSA Side ############
######################################
# Playback Device for Alsa Programs. #
######################################
pcm.jack_playback_4 {
type plug
slave.pcm "hw:Loopback,0,6"
}
#####################################
# Capture Device for Alsa Programs. #
#####################################
pcm.jack_capture_4 {
type plug
slave.pcm "hw:Loopback,0,7"
}
#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################
pcm.jack_link_4 {
type asym
playback.pcm "jack_playback_4"
capture.pcm "jack_capture_4"
hint {
show on
description "ALSA Jack Interface 4"
}
}
############ JACK Side ############
####################################
# ALSA Input for Jack Connections. #
####################################
pcm.alsa_input_4 {
type plug
slave.pcm "hw:Loopback,1,6"
}
#####################################
# ALSA Output for Jack Connections. #
#####################################
pcm.alsa_output_4 {
type plug
slave.pcm "hw:Loopback,1,7"
}

62
alsa-initscript Normal file
View File

@ -0,0 +1,62 @@
#! /bin/bash
#
# alsa
#
# This script takes care of starting alsa oss compatibility modules for
# pcm and saving/restoring mixer volume settings.
# If an alsa driver is not loaded this script does nothing.
#
# Copyright (c) 2004-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# chkconfig: 2345 87 14
# description: ALSA volumes set and oss compatibiliy layer
#
### END INIT INFO
[ -r /etc/init.d/functions ] && . /etc/init.d/functions
[ -r /etc/sysconfig/sound ] && . /etc/sysconfig/sound
# see how we were called.
case "$1" in
start)
if [ -d /proc/asound ]; then
[ "$ENABLE_LEGACY_OSS" = "true" -o "$ENABLE_LEGACY_OSS" = "1" ] && {
echo -n "Loading ALSA-OSS legacy sound modules: "
modprobe snd-seq-oss
modprobe snd-mixer-oss
modprobe snd-pcm-oss
evaluate_retval
echo
}
# Restore is now called by udev
echo -n "Restoring sound card volumes"
/usr/sbin/alsactl restore >/dev/null 2>&1 || /usr/sbin/alsactl init >/dev/null 2>&1
evaluate_retval
echo
else
echo "ALSA driver is not running."
fi
;;
stop)
# stop oss emulation modules
if [ -d /proc/asound ]; then
echo -n "Saving sound card volumes"
/usr/sbin/alsactl store >/dev/null 2>&1
evaluate_retval
fi
;;
restart|reload)
$0 stop
$0 start
;;
status)
[ -n "`lsmod | grep snd[-_]mixer[-_]oss`" ] \
&& echo "ALSA-OSS legacy modules loaded." \
|| echo "ALSA-OSS legacy modules not loaded."
;;
*)
echo "Usage: alsa {start|stop|restart|status}"
exit 1
esac
exit 0

View File

@ -0,0 +1,5 @@
SUBSYSTEM!="sound", GOTO="asoundconf_alsa_end"
KERNEL=="controlC[0-9]*", SUBSYSTEMS!="usb", ACTION=="add", RUN+="/usr/sbin/update-alternatives --set asound.conf /etc/asound.conf.alsa"
KERNEL=="controlC[0-9]*", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/sbin/update-alternatives --set asound.conf /etc/asound.conf.alsa-usb"
KERNEL=="controlC[0-9]*", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="/usr/sbin/update-alternatives --set asound.conf /etc/asound.conf.alsa"
LABEL="asoundconf_alsa_end"

View File

@ -0,0 +1,17 @@
diff -Nru alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c alsa-utils-1.0.18/alsactl/init_sysdeps.c
--- alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c 2008-11-13 12:24:15.000000000 +0100
+++ alsa-utils-1.0.18/alsactl/init_sysdeps.c 2008-11-13 12:23:25.000000000 +0100
@@ -18,6 +18,7 @@
*/
#ifdef __GLIBC__
+#ifndef __USE_BSD
static size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -60,4 +61,5 @@
*q = '\0';
return bytes;
}
+#endif /* __USE_BSD */
#endif /* __GLIBC__ */

View File

@ -0,0 +1,25 @@
diff -Nru alsa-utils-1.0.19.orig/alsaconf/alsaconf.in alsa-utils-1.0.19/alsaconf/alsaconf.in
--- alsa-utils-1.0.19.orig/alsaconf/alsaconf.in 2009-01-19 12:17:19.000000000 +0100
+++ alsa-utils-1.0.19/alsaconf/alsaconf.in 2009-01-19 20:00:42.000000000 +0100
@@ -53,6 +53,8 @@
if [ -f /etc/SuSE-release ]; then
distribution="suse"
suse_version=$(grep 'VERSION = ' /etc/SuSE-release | sed -e s/'VERSION = '//)
+elif [ -f /etc/openmamba-release ]; then
+ distribution="openmamba"
elif [ -f /etc/UnitedLinux-release ]; then
distribution="suse"
elif [ -f /etc/gentoo-release ]; then
@@ -511,8 +513,10 @@
# MAIN
if [ -d $PROCFS/asound ]; then
- $rcalsasound stop >/dev/null 2>&1
- $rcalsasound unload >/dev/null 2>&1
+ if [ -x $rcalsasound ]; then
+ $rcalsasound stop >/dev/null 2>&1
+ $rcalsasound unload >/dev/null 2>&1
+ fi
/sbin/rmmod dmasound dmasound_awacs 2>/dev/null
fi

View File

@ -0,0 +1,14 @@
diff -Nru alsa-utils-1.0.19.orig/alsactl/init_sysdeps.c alsa-utils-1.0.19/alsactl/init_sysdeps.c
--- alsa-utils-1.0.19.orig/alsactl/init_sysdeps.c 2009-01-19 12:17:19.000000000 +0100
+++ alsa-utils-1.0.19/alsactl/init_sysdeps.c 2009-01-23 15:16:49.000000000 +0100
@@ -17,8 +17,8 @@
*
*/
-#if defined(__GLIBC__) && !(defined(__UCLIBC__) && defined(__USE_BSD))
-static size_t strlcpy(char *dst, const char *src, size_t size)
+#if defined(__GLIBC__) && !(defined(__USE_BSD))
+size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
char *q = dst;

View File

@ -0,0 +1,12 @@
diff -Nru alsa-utils-1.0.21.orig/alsactl/init_sysdeps.c alsa-utils-1.0.21/alsactl/init_sysdeps.c
--- alsa-utils-1.0.21.orig/alsactl/init_sysdeps.c 2009-10-02 16:47:19.000000000 +0200
+++ alsa-utils-1.0.21/alsactl/init_sysdeps.c 2009-10-02 16:53:01.000000000 +0200
@@ -17,7 +17,7 @@
*
*/
-#if defined(__GLIBC__) && !(defined(__USE_BSD))
+#if defined(__GLIBC__)
size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;

View File

@ -0,0 +1,11 @@
diff -Nru alsa-utils-1.0.27.orig/alsactl/alsa-restore.service.in alsa-utils-1.0.27/alsactl/alsa-restore.service.in
--- alsa-utils-1.0.27.orig/alsactl/alsa-restore.service.in 2013-04-11 13:43:06.000000000 +0200
+++ alsa-utils-1.0.27/alsactl/alsa-restore.service.in 2013-04-20 20:59:16.124867861 +0200
@@ -12,6 +12,6 @@
Conflicts=shutdown.target
[Service]
-Type=oneshop
+Type=oneshot
ExecStart=-@sbindir@/alsactl restore
StandardOutput=syslog

381
alsa-utils.spec Normal file
View File

@ -0,0 +1,381 @@
%define _distrib_milestone %(echo %_distrib_codename | cut -d- -f1)
%define majver %(echo %version | cut -d. -f1-3)
Name: alsa-utils
Version: 1.0.27.2
Release: 2mamba
Summary: Utilities for the Advanced Linux Sound Architecture (ALSA)
Group: System/Kernel and Hardware
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.alsa-project.org/
Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}%{?spl}.tar.bz2
Source1: alsa-initscript
Source2: alsa-asound.conf
Source3: alsa-asound.conf-usb
Source4: alsa-udev-asound.conf.rules
Patch0: %{name}-1.0.19-alsaconf.patch
Patch1: %{name}-1.0.18-glibc_use_bsd.patch
Patch2: %{name}-1.0.19-fix_bsd_check.patch
Patch3: %{name}-1.0.21-bsd_check.patch
Patch4: alsa-utils-1.0.27-systemd-fix-typo.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libalsa-devel
BuildRequires: libncurses-devel
BuildRequires: libsamplerate-devel
## AUTOBUILDREQ-END
BuildRequires: libalsa-devel >= %{majver}
BuildRequires: xmlto
BuildRequires: docbook-utils
BuildRequires: /usr/bin/xsltproc
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system.
ALSA has the following significant features:
- efficient support for all types of audio interfaces, from consumer soundcards to professional multichannel audio interfaces
- fully modularized sound drivers
- SMP and thread-safe design
- user space library (alsa-lib) to simplify application programming and provide higher level functionality
- support for the older OSS API, providing binary compatibility for most OSS programs
%package midi
Summary: Utilities for the Advanced Linux Sound Architecture (ALSA) MIDI Sequencer
Group: System/Kernel and Hardware
Requires: %{name} = %{version}-%{release}
%description midi
The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system.
ALSA has the following significant features:
- efficient support for all types of audio interfaces, from consumer soundcards to professional multichannel audio interfaces
- fully modularized sound drivers
- SMP and thread-safe design
- user space library (alsa-lib) to simplify application programming and provide higher level functionality
- support for the older OSS API, providing binary compatibility for most OSS programs
This package contains the utilities for the Advanced Linux Sound Architecture (ALSA) MIDI Sequencer.
%prep
%setup -q -n %{name}-%{version}%{?spl:%spl}
%patch0 -p1
#%patch1 -p1
%patch2 -p1
%patch3 -p1
#%patch4 -p1
%build
%configure
%make
%if "%{_distrib_milestone}" == "milestone2"
make -C alsactl 90-alsa-restore.rules
%endif
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%makeinstall
%if "%{_distrib_milestone}" == "milestone2"
## install ALSA configuration files and scripts
install -D -m755 %{SOURCE1} %{buildroot}%{_initrddir}/alsa
install -D -m0644 alsactl/90-alsa-restore.rules %{buildroot}/lib/udev/rules.d/90-alsa-restore.rules
%endif
install -D -m755 %{SOURCE2} %{buildroot}%{_sysconfdir}/asound.conf.alsa
install -D -m755 %{SOURCE3} %{buildroot}%{_sysconfdir}/asound.conf.alsa-usb
install -D -m644 %{SOURCE4} %{buildroot}/lib/udev/rules.d/59-alsa-usb-asoundconf.rules
cat > %{buildroot}%{_sysconfdir}/asound.conf.dummy << _EOF
# Dummy empty asound.conf
_EOF
# postplug one-shot update script for new gain controls
install -d %{buildroot}%{_sysconfdir}/postplug/updates.d
cat > %{buildroot}%{_sysconfdir}/postplug/updates.d/alsa-utils-set-gain-001.upd << _EOF
%{_sbindir}/alsactl restore
%{_bindir}/amixer sset 'Output Gain' 70%
%{_bindir}/amixer sset 'Capture Gain' 50%
%{_sbindir}/alsactl store
_EOF
install -d %{buildroot}%{_sysconfdir}/modules.d
cat >> %{buildroot}%{_sysconfdir}/modules.d/alsa-seq-midi.conf << _EOF
snd-seq-midi
_EOF
%find_lang %{name}
%find_lang alsaconf
cat alsaconf.lang >> %{name}.lang
%post
/usr/sbin/alternatives --install \
%{_sysconfdir}/asound.conf asound.conf %{_sysconfdir}/asound.conf.alsa 20
/usr/sbin/alternatives --install \
%{_sysconfdir}/asound.conf asound.conf %{_sysconfdir}/asound.conf.alsa-usb 10
/usr/sbin/alternatives --install \
%{_sysconfdir}/asound.conf asound.conf %{_sysconfdir}/asound.conf.dummy 5
exit 0
%preun
# erase
if [ $1 -eq 0 ]; then
/usr/sbin/update-alternatives --remove asound.conf %{_sysconfdir}/asound.conf.alsa
/usr/sbin/update-alternatives --remove asound.conf %{_sysconfdir}/asound.conf.alsa-usb
/usr/sbin/update-alternatives --remove asound.conf %{_sysconfdir}/asound.conf.dummy
fi
exit 0
%posttrans
/usr/sbin/alternatives --install \
%{_sysconfdir}/asound.conf asound.conf %{_sysconfdir}/asound.conf.alsa 20
/usr/sbin/alternatives --install \
%{_sysconfdir}/asound.conf asound.conf %{_sysconfdir}/asound.conf.alsa-usb 10
/usr/sbin/alternatives --install \
%{_sysconfdir}/asound.conf asound.conf %{_sysconfdir}/asound.conf.dummy 5
exit 0
%post midi
# new install
if [ $1 -eq 1 ]; then
modprobe snd-seq-midi || true
fi
exit 0
%files -f %{name}.lang
%defattr(-,root,root)
%config %{_sysconfdir}/asound.conf.alsa
%config %{_sysconfdir}/asound.conf.alsa-usb
%config %{_sysconfdir}/asound.conf.dummy
%{_sysconfdir}/postplug/updates.d/alsa-utils-set-gain-001.upd
%if "%{_distrib_milestone}" == "milestone2"
%{_initrddir}/alsa
%endif
%{_bindir}/aconnect
%{_bindir}/alsamixer
%{_bindir}/alsaloop
%{_bindir}/alsaucm
%{_bindir}/amixer
%{_bindir}/aplay
%{_bindir}/arecord
%{_bindir}/iecset
%{_bindir}/speaker-test
%{_sbindir}/alsaconf
%{_sbindir}/alsactl
/lib/udev/rules.d/59-alsa-usb-asoundconf.rules
/lib/udev/rules.d/90-alsa-restore.rules
%if "%{_distrib_milestone}" != "milestone2"
/lib/systemd/system/alsa-restore.service
/lib/systemd/system/alsa-state.service
/lib/systemd/system/alsa-store.service
/lib/systemd/system/basic.target.wants/alsa-restore.service
/lib/systemd/system/basic.target.wants/alsa-state.service
/lib/systemd/system/shutdown.target.wants/alsa-store.service
%endif
%{_datadir}/alsa/init/*
%{_datadir}/alsa/speaker-test/sample_map.csv
%{_datadir}/sounds/alsa/*.wav
%dir /var/lib/alsa
%{_mandir}/man1/aconnect.1*
%{_mandir}/man1/alsactl.1*
%{_mandir}/man1/alsaloop.1*
%{_mandir}/man1/alsamixer.1*
%{_mandir}/man1/amixer.1*
%{_mandir}/man1/aplay.1*
%{_mandir}/man1/arecord.1*
%{_mandir}/man1/iecset.1*
%{_mandir}/man1/speaker-test.1*
%{_mandir}/man7/alsactl_init.7*
%{_mandir}/man8/alsaconf.8*
%lang(fr) %{_mandir}/fr/man8/alsaconf.*
%files midi
%defattr(-,root,root)
%{_sysconfdir}/modules.d/alsa-seq-midi.conf
%{_bindir}/amidi
%{_bindir}/aplaymidi
%{_bindir}/arecordmidi
%{_bindir}/aseqdump
%{_bindir}/aseqnet
%{_mandir}/man1/amidi.1*
%{_mandir}/man1/aplaymidi.1*
%{_mandir}/man1/arecordmidi.1*
%{_mandir}/man1/aseqdump.1*
%{_mandir}/man1/aseqnet.1*
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%changelog
* Sat Dec 07 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.27.2-2mamba
- add hotplug support for external usb device by using udev to switch to use external device as default
* Tue Jul 30 2013 Automatic Build System <autodist@mambasoft.it> 1.0.27.2-1mamba
- automatic version update by autodist
* Sat Jul 13 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.27.1-4mamba
- asound.conf.alsa: integrate jack-alsa bridge kit (http://www.penguinproducer.com/Blog/2011/11/jack-alsa-bridge-kit/)
* Mon Jul 01 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.27.1-3mamba
- remove code referring to obsolete initscript in %post script
* Wed Jun 26 2013 Automatic Build System <autodist@mambasoft.it> 1.0.27.1-2mamba
- arm: rebuild to fix alsamixer: undefined symbol: __aeabi_uidiv after ncurses update
* Thu May 23 2013 Automatic Build System <autodist@mambasoft.it> 1.0.27.1-1mamba
- automatic version update by autodist
* Sat Apr 20 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.27-2mamba
- patch: fix a typo in systemd service file
* Mon Apr 15 2013 Automatic Build System <autodist@mambasoft.it> 1.0.27-1mamba
- automatic version update by autodist
* Sun Sep 23 2012 Automatic Build System <autodist@mambasoft.it> 1.0.26-1mamba
- automatic version update by autodist
* Sun Sep 02 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.25-2mamba
- add an alternative for a dummy (empty) asound.conf (Raspberry PI)
* Wed Jun 06 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.25-1mamba
- update to 1.0.25
* Sat Jun 02 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.24.2-6mamba
- initscript: run alsactl init if alsactl restore fails to prevent a kmix crash on first boot
* Sat Mar 17 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.24.2-5mamba
- initscript: again restore volumes on startup to fix an unexplained crash in kmix at first login (https://bugs.kde.org/show_bug.cgi?id=209975)
* Sat Nov 12 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.24.2-4mamba
- initscript: don't unload modules on shutdown
* Sun Nov 06 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.24.2-3mamba
- provide directory /var/lib/alsa which now contains ile asound.state
* Wed Mar 23 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.24.2-2mamba
- set asound.conf as an alternative
* Sat Mar 19 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.24.2-1mamba
- update to 1.0.24.2
* Thu Feb 17 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.23-6mamba
- added .conf extension to /etc/modules.d/ file
- added subpackage alsa-utils-midi
* Mon Jan 31 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.23-5mamba
- initscript: move to /etc/modules.d snd-seq-midi loading and load snd-seq-oss only if ENABLE_LEGACY_OSS is set
* Sun Jan 09 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.23-4mamba
- don't own /usr/share/alsa
* Sat Nov 06 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.23-3mamba
- added postplug one-shot update script for new gain controls
* Wed Sep 22 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.23-2mamba
- asound.conf: added softvol controls for controlling Capture (+50dB) and Output (+20dB) gain
* Sat Apr 17 2010 Automatic Build System <autodist@mambasoft.it> 1.0.23-1mamba
- automatic update to 1.0.23 by autodist
* Mon Apr 12 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.22-1mamba
- update to 1.0.22
* Thu Oct 22 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.21-3mamba
- asound.conf: added skype capture device with swapped mic channels (http://wiki.debian.org/DebianEeePC/HowTo/Sound)
* Thu Oct 15 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.21-2mamba
- asound.conf: use the asymed plug mixing both output and capture; add description for use with Phonon/KDE4
* Fri Oct 02 2009 Automatic Build System <autodist@mambasoft.it> 1.0.21-1mamba
- update to 1.0.21
* Thu May 07 2009 Automatic Build System <autodist@mambasoft.it> 1.0.20-1mamba
- automatic update to 1.0.20 by autodist
* Fri Jan 23 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.19-1mamba
- automatic update by autodist
* Fri Jan 02 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.18rc3-1mamba
- automatic update by autodist
* Mon Dec 22 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.18-2mamba
- initscript: don't load OSS legacy modules if jack/oss2jack are disabled
- asound.conf: added file with dmix configuration as default and oss plug for aoss
- added build requirement for xmlto
* Mon Nov 17 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.18-1mamba
- automatic update to 1.0.18 by autodist
* Thu Aug 21 2008 gil <puntogil@libero.it> 1.0.17-1mamba
- update to 1.0.17
* Sun Feb 17 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.16-1mamba
- update to 1.0.16
* Sat Aug 11 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.14-2mamba
- initscript moved here from libalsa
* Mon Jun 04 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.14-1mamba
- update to 1.0.14
* Sun Oct 01 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.13-1qilnx
- update to version 1.0.13 by autospec
* Wed Sep 27 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.12-1qilnx
- update to version 1.0.12 by autospec
* Wed Apr 26 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.11-1qilnx
- update to version 1.0.11 by autospec
* Mon Nov 21 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.10-1qilnx
- update to version 1.0.10 by autospec
- updated patch
- fixed package group
* Wed Oct 26 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.9a-1qilnx
- update to version 1.0.9a by autospec
* Mon Feb 14 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.8-3qilnx
- new patch for alsaconf
* Fri Feb 11 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.8-2qilnx
- modified the `alsaconf' script for the QiLinux distro
* Tue Feb 01 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.8-1qilnx
- update to version 1.0.8 by autospec
* Fri Nov 26 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.7-1qilnx
- update to version 1.0.7 by autospec
* Mon May 31 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.5-1qilnx
- rebuilt with alsa-utils-1.0.5
* Mon Apr 05 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.4-1qilnx
- rebuilt with alsa-utils-1.0.4
* Tue Mar 02 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.3-1qilnx
- rebuilt with alsa-utils-1.0.3
* Tue Jan 27 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.2-1qilnx
- rebuilt with version 1.0.2
* Fri Jan 09 2004 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.1-1qilnx
- rebuilt with version 1.0.1
* Wed Dec 10 2003 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.0rc2-1qilnx
- rebuilt with version 1.0.0rc2
* Mon Oct 22 2003 Davide Madrisan <davide.madrisan@qilinux.it> 0.9.8-1qilnx
- rebuilt with version 0.9.8
* Fri Sep 26 2003 Davide Madrisan <davide.madrisan@qilinux.it> 0.9.7-1qlnx
- rebuilt with version 0.9.7
* Tue Sep 02 2003 Davide Madrisan <davide.madrisan@qilinux.it> 0.9.6-1qlnx
- rebuilt with version 0.9.6
* Tue Jul 04 2003 Silvan Calarco <silvan.calarco@qinet.it> 0.9.4-1qilnx
- first build for alsa-utils