Sync from SUSE:ALP:Source:Standard:1.0 alsa revision 8db964784a41f88cf0b21b04efb07066

This commit is contained in:
Adrian Schröter 2023-12-22 10:19:48 +01:00
commit 4b402d6ebd
30 changed files with 7955 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,40 @@
From fcce13a6726c52882bd8b7131c61c4eba308792c Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 4 Sep 2023 09:38:26 +0200
Subject: [PATCH] control.h: Fix ump header file detection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Apparently, the control.h is used from apps separately (outside
asoundlib.h). Avoid errors like:
/usr/include/alsa/control.h:417:47: error: snd_ump_endpoint_info_t has not been declared
417 | int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info);
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/alsa/control.h:418:44: error: snd_ump_block_info_t has not been declared
418 | int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info);
| ^~~~~~~~~~~~~~~~~~~~
Fixes: https://github.com/alsa-project/alsa-lib/issues/348
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
include/control.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/control.h b/include/control.h
index ab482ba448c0..e7541d56d636 100644
--- a/include/control.h
+++ b/include/control.h
@@ -413,6 +413,8 @@ int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
+#endif
+#ifdef __ALSA_UMP_H
int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device);
int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info);
int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info);
--
2.35.3

View File

@ -0,0 +1,49 @@
From 10bd599970acc71c92f85eb08943eb8d3d702a9c Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 6 Sep 2023 15:16:44 +0200
Subject: [PATCH] global.h: move __STRING() macro outside !PIC ifdef block
It solves the musl libc compilation issue.
control.c: In function 'snd_ctl_open_conf':
../../include/global.h:98:36: warning: implicit declaration of function '__STRING' [-Wimplicit-function-declaratio]
98 | #define SND_DLSYM_VERSION(version) __STRING(version)
| ^~~~~~~~
Fixes: https://github.com/alsa-project/alsa-lib/issues/350
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
include/global.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/global.h b/include/global.h
index dfe9bc2b54bf..3ecaeee898c5 100644
--- a/include/global.h
+++ b/include/global.h
@@ -51,6 +51,11 @@ const char *snd_asoundlib_version(void);
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
+#ifndef __STRING
+/** \brief Return 'x' argument as string */
+#define __STRING(x) #x
+#endif
+
#ifdef PIC /* dynamic build */
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
@@ -71,11 +76,6 @@ struct snd_dlsym_link {
extern struct snd_dlsym_link *snd_dlsym_start;
-#ifndef __STRING
-/** \brief Return 'x' argument as string */
-#define __STRING(x) #x
-#endif
-
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
/**
--
2.35.3

View File

@ -0,0 +1,113 @@
From 0e3dfb9f705ca78be34cd70fd59d67c431e29cc7 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Sat, 9 Sep 2023 17:42:03 +0200
Subject: [PATCH] pcm: Fix segfault with 32bit libs
The recent rearrangement of header inclusion order caused a regression
showing segfaults on 32bit Arm. The primary reason is the
inconsistent compile condition depending on the inclusion of config.h;
while most of other code include pcm_local.h (that implicitly includes
config.h) at first, pcm_direct.c doesn't do it, hence the access with
direct plugins crashes.
For fixing it, we need to include config.h at the beginning. But,
it's better to include pcm_local.h for all relevant code for
consistency. The patch does it, and also it adds the guard in
pcm_local.h for double inclusions.
Fixes: ad3a8b8b314e ("reshuffle included files to include config.h as first")
Link: https://github.com/alsa-project/alsa-lib/issues/352
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_direct.c | 1 +
src/pcm/pcm_dmix.c | 2 +-
src/pcm/pcm_dshare.c | 1 +
src/pcm/pcm_dsnoop.c | 1 +
src/pcm/pcm_local.h | 5 +++++
src/pcm/pcm_shm.c | 1 +
6 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
index 040fc1605388..e53e59238119 100644
--- a/src/pcm/pcm_direct.c
+++ b/src/pcm/pcm_direct.c
@@ -19,6 +19,7 @@
*
*/
+#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
index 7cd3c50841ae..55cae3e79a06 100644
--- a/src/pcm/pcm_dmix.c
+++ b/src/pcm/pcm_dmix.c
@@ -26,7 +26,7 @@
*
*/
-#include "config.h"
+#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
index 454b39a91429..c03290985457 100644
--- a/src/pcm/pcm_dshare.c
+++ b/src/pcm/pcm_dshare.c
@@ -26,6 +26,7 @@
*
*/
+#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c
index d3ce300ce3b8..bf67c68a0dfa 100644
--- a/src/pcm/pcm_dsnoop.c
+++ b/src/pcm/pcm_dsnoop.c
@@ -26,6 +26,7 @@
*
*/
+#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
index 6a0e71e711ea..152c92c300e1 100644
--- a/src/pcm/pcm_local.h
+++ b/src/pcm/pcm_local.h
@@ -20,6 +20,9 @@
*
*/
+#ifndef __PCM_LOCAL_H
+#define __PCM_LOCAL_H
+
#include "config.h"
#include <stdio.h>
@@ -1223,3 +1226,5 @@ static inline void snd_pcm_unlock(snd_pcm_t *pcm)
#define snd_pcm_lock(pcm) do {} while (0)
#define snd_pcm_unlock(pcm) do {} while (0)
#endif /* THREAD_SAFE_API */
+
+#endif /* __PCM_LOCAL_H */
diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c
index f0bfd934d335..d9596547741c 100644
--- a/src/pcm/pcm_shm.c
+++ b/src/pcm/pcm_shm.c
@@ -26,6 +26,7 @@
*
*/
+#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
--
2.35.3

View File

@ -0,0 +1,210 @@
From 81a7a93636d9472fcb0c2ff32d9bfdf6ed10763d Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 13 Sep 2023 12:27:21 +0200
Subject: [PATCH] reshuffle included files to include config.h as first - v2
config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).
Fixes: ad3a8b8b ("reshuffle included files to include config.h as first")
Related: https://github.com/alsa-project/alsa-lib/pull/333
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/control/setup.c | 2 +-
src/rawmidi/rawmidi.c | 2 +-
src/rawmidi/rawmidi_local.h | 2 +-
src/rawmidi/rawmidi_virt.c | 4 +---
src/rawmidi/ump.c | 4 ----
src/seq/seq.c | 2 +-
src/seq/seq_hw.c | 2 +-
src/seq/seq_local.h | 2 +-
src/seq/seq_midi_event.c | 2 +-
src/seq/seqmid.c | 4 +---
src/userfile.c | 2 +-
11 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/control/setup.c b/src/control/setup.c
index 88635e42e446..fb09611764cf 100644
--- a/src/control/setup.c
+++ b/src/control/setup.c
@@ -29,13 +29,13 @@
*
*/
+#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
-#include "local.h"
#ifndef DOC_HIDDEN
typedef struct {
diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c
index 316f524b85ad..c4b45fa227f1 100644
--- a/src/rawmidi/rawmidi.c
+++ b/src/rawmidi/rawmidi.c
@@ -144,12 +144,12 @@ This example shows open and read/write rawmidi operations.
* Shows open and read/write rawmidi operations.
*/
+#include "rawmidi_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
-#include "rawmidi_local.h"
/**
* \brief setup the default parameters
diff --git a/src/rawmidi/rawmidi_local.h b/src/rawmidi/rawmidi_local.h
index 19dbf72584fa..f0bb06a7d824 100644
--- a/src/rawmidi/rawmidi_local.h
+++ b/src/rawmidi/rawmidi_local.h
@@ -19,10 +19,10 @@
*
*/
+#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
-#include "local.h"
typedef struct {
int (*close)(snd_rawmidi_t *rawmidi);
diff --git a/src/rawmidi/rawmidi_virt.c b/src/rawmidi/rawmidi_virt.c
index 884b8ff8deee..04c485d3eabf 100644
--- a/src/rawmidi/rawmidi_virt.c
+++ b/src/rawmidi/rawmidi_virt.c
@@ -19,13 +19,11 @@
*
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include "rawmidi_local.h"
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "rawmidi_local.h"
#include "seq.h"
#include "seq_midi_event.h"
diff --git a/src/rawmidi/ump.c b/src/rawmidi/ump.c
index 25fbaff23c9d..39c1c4a91928 100644
--- a/src/rawmidi/ump.c
+++ b/src/rawmidi/ump.c
@@ -4,10 +4,6 @@
* \brief Universal MIDI Protocol (UMP) Interface
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include "local.h"
#include "rawmidi_local.h"
#include "ump_local.h"
diff --git a/src/seq/seq.c b/src/seq/seq.c
index 899dfe9f96ba..fd8ca30e2472 100644
--- a/src/seq/seq.c
+++ b/src/seq/seq.c
@@ -777,8 +777,8 @@ void event_filter(snd_seq_t *seq, snd_seq_event_t *ev)
*/
-#include <poll.h>
#include "seq_local.h"
+#include <poll.h>
/****************************************************************************
* *
diff --git a/src/seq/seq_hw.c b/src/seq/seq_hw.c
index a51ebfb68ebd..b74948c81c9e 100644
--- a/src/seq/seq_hw.c
+++ b/src/seq/seq_hw.c
@@ -20,9 +20,9 @@
*
*/
+#include "seq_local.h"
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "seq_local.h"
#ifndef PIC
/* entry for static linking */
diff --git a/src/seq/seq_local.h b/src/seq/seq_local.h
index 9b4a65459d3d..468248062638 100644
--- a/src/seq/seq_local.h
+++ b/src/seq/seq_local.h
@@ -23,10 +23,10 @@
#ifndef __SEQ_LOCAL_H
#define __SEQ_LOCAL_H
+#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
-#include "local.h"
#define SND_SEQ_OBUF_SIZE (16*1024) /* default size */
#define SND_SEQ_IBUF_SIZE 500 /* in event_size aligned */
diff --git a/src/seq/seq_midi_event.c b/src/seq/seq_midi_event.c
index df09bde30eea..95a44e9bc323 100644
--- a/src/seq/seq_midi_event.c
+++ b/src/seq/seq_midi_event.c
@@ -28,10 +28,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "local.h"
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
-#include "local.h"
#ifndef DOC_HIDDEN
diff --git a/src/seq/seqmid.c b/src/seq/seqmid.c
index 55651f3896f3..9ec93ee8ade1 100644
--- a/src/seq/seqmid.c
+++ b/src/seq/seqmid.c
@@ -20,14 +20,12 @@
*
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include "seq_local.h"
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/ioctl.h>
-#include "seq_local.h"
/**
* \brief queue controls - start/stop/continue
diff --git a/src/userfile.c b/src/userfile.c
index 4a740834313c..492ea9cbc238 100644
--- a/src/userfile.c
+++ b/src/userfile.c
@@ -18,7 +18,7 @@
*
*/
-#include <config.h>
+#include "config.h"
#include <string.h>
#include <errno.h>
#include <assert.h>
--
2.35.3

View File

@ -0,0 +1,40 @@
From 96f60d829f2c9dc9ad9eda46410adaa41b4b0da0 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 10 Oct 2023 08:20:15 +0200
Subject: [PATCH] seq: Fix typos in symbol version definitions
There were obvious typos in src/Versions.in that resulted in the
undefined symbols. Correct those entries.
Fixes: 2aefb5c41cc0 ("seq: Add UMP support")
Closes: https://github.com/alsa-project/alsa-lib/issues/356
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/Versions.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Versions.in b/src/Versions.in
index c8ac1c8277a3..c53a99fa7ab0 100644
--- a/src/Versions.in
+++ b/src/Versions.in
@@ -158,13 +158,13 @@ ALSA_1.2.10 {
@SYMBOL_PREFIX@snd_ctl_ump_block_info;
@SYMBOL_PREFIX@snd_seq_ump_*;
@SYMBOL_PREFIX@snd_seq_client_info_get_midi_version;
- @SYMBOL_PREFIX@snd_seq_seq_client_info_get_ump_group_enabled;
+ @SYMBOL_PREFIX@snd_seq_client_info_get_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_groupless_enabled;
- @SYMBOL_PREFIX@snd_seq_seq_client_get_ump_conversion;
+ @SYMBOL_PREFIX@snd_seq_client_info_get_ump_conversion;
@SYMBOL_PREFIX@snd_seq_client_info_set_midi_version;
- @SYMBOL_PREFIX@snd_seq_seq_client_info_set_ump_group_enabled;
+ @SYMBOL_PREFIX@snd_seq_client_info_set_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_groupless_enabled;
- @SYMBOL_PREFIX@snd_seq_seq_client_set_ump_conversion;
+ @SYMBOL_PREFIX@snd_seq_client_info_set_ump_conversion;
@SYMBOL_PREFIX@snd_seq_get_ump_endpoint_info;
@SYMBOL_PREFIX@snd_seq_get_ump_block_info;
@SYMBOL_PREFIX@snd_seq_set_ump_endpoint_info;
--
2.35.3

View File

@ -0,0 +1,34 @@
From 915a71a2cdf6361f0fc77fa367a67910dc0288db Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Sat, 4 Nov 2023 10:05:39 +0100
Subject: [PATCH] seq: Fix invalid sanity-check in
snd_seq_set_input_buffer_size()
snd_seq_set_input_buffer_size() has an assert() call with packet_size,
but it's still uninitialized at that point. Fix it with the real
packet size.
Fixes: 2aefb5c41cc0 ("seq: Add UMP support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/seq/seq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/seq/seq.c b/src/seq/seq.c
index fd8ca30e2472..5ec737a7004f 100644
--- a/src/seq/seq.c
+++ b/src/seq/seq.c
@@ -1269,9 +1269,9 @@ int snd_seq_set_input_buffer_size(snd_seq_t *seq, size_t size)
size_t packet_size;
assert(seq && seq->ibuf);
+ packet_size = get_packet_size(seq);
assert(size >= packet_size);
snd_seq_drop_input(seq);
- packet_size = get_packet_size(seq);
size = (size + packet_size - 1) / packet_size;
if (size != seq->ibufsize) {
char *newbuf;
--
2.35.3

View File

@ -0,0 +1,42 @@
From f202ec3c23abf16a2382acc0de35900173e32160 Mon Sep 17 00:00:00 2001
From: Hector Martin <marcan@marcan.st>
Date: Sat, 28 Oct 2023 21:33:29 +0900
Subject: [PATCH] mixer: simple: Support dB TLVs for CTL_SINGLE controls
dB mappings do not work for controls not named "* Volume", since we do not
fall back to CTL_SINGLE in get_selem_ctl. Add that branch to make it
work.
Fixes dB ranges for e.g. controls named "* Gain".
Closes: https://github.com/alsa-project/alsa-lib/pull/358
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/mixer/simple_none.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/mixer/simple_none.c b/src/mixer/simple_none.c
index 846b0ca92467..dd03fcf13d01 100644
--- a/src/mixer/simple_none.c
+++ b/src/mixer/simple_none.c
@@ -1155,11 +1155,12 @@ static selem_ctl_t *get_selem_ctl(selem_none_t *s, int dir)
c = &s->ctls[CTL_CAPTURE_VOLUME];
else
return NULL;
- if (! c->elem) {
+ if (! c->elem)
c = &s->ctls[CTL_GLOBAL_VOLUME];
- if (! c->elem)
- return NULL;
- }
+ if (! c->elem)
+ c = &s->ctls[CTL_SINGLE];
+ if (! c->elem)
+ return NULL;
if (c->type != SND_CTL_ELEM_TYPE_INTEGER)
return NULL;
return c;
--
2.35.3

View File

@ -0,0 +1,66 @@
From 2fca03e792ef1b740e8a7370fdd360d0b627c84c Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 6 Nov 2023 16:27:11 +0100
Subject: [PATCH] seq: Clear UMP event flag for legacy apps
It seems that some applications (at least Chrome WebMIDI) set random
bits to the flags of event packet, and this confuses as if they were
UMP-events, which are eventually filtered out.
Although it's a bug of applications, it's better to avoid the
regressions. So this patch forcibly clears the UMP flag of the
incoming and outgoing events when the application is running in the
legacy mode (i.e. midi_version = 0).
Fixes: 2aefb5c41cc0 ("seq: Add UMP support")
Closes: https://github.com/alsa-project/alsa-lib/issues/360
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/seq/seq.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/seq/seq.c b/src/seq/seq.c
index 5ec737a7004f..643cf159f3ef 100644
--- a/src/seq/seq.c
+++ b/src/seq/seq.c
@@ -4161,6 +4161,13 @@ int snd_seq_event_output(snd_seq_t *seq, snd_seq_event_t *ev)
return result;
}
+/* workaround for broken legacy apps that set UMP event bit unexpectedly */
+static void clear_ump_for_legacy_apps(snd_seq_t *seq, snd_seq_event_t *ev)
+{
+ if (!seq->midi_version && snd_seq_ev_is_ump(ev))
+ ev->flags &= ~SNDRV_SEQ_EVENT_UMP;
+}
+
/**
* \brief output an event onto the lib buffer without draining buffer
* \param seq sequencer handle
@@ -4178,6 +4185,7 @@ int snd_seq_event_output_buffer(snd_seq_t *seq, snd_seq_event_t *ev)
{
int len;
assert(seq && ev);
+ clear_ump_for_legacy_apps(seq, ev);
len = snd_seq_event_length(ev);
if (len < 0)
return -EINVAL;
@@ -4238,6 +4246,7 @@ int snd_seq_event_output_direct(snd_seq_t *seq, snd_seq_event_t *ev)
ssize_t len;
void *buf;
+ clear_ump_for_legacy_apps(seq, ev);
len = snd_seq_event_length(ev);
if (len < 0)
return len;
@@ -4374,6 +4383,7 @@ static int snd_seq_event_retrieve_buffer(snd_seq_t *seq, snd_seq_event_t **retp)
snd_seq_event_t *ev;
*retp = ev = (snd_seq_event_t *)(seq->ibuf + seq->ibufptr * packet_size);
+ clear_ump_for_legacy_apps(seq, ev);
seq->ibufptr++;
seq->ibuflen--;
if (! snd_seq_ev_is_variable(ev))
--
2.35.3

View File

@ -0,0 +1,99 @@
From 94a5ddff9d5d85104755ee17b301c289a060cebf Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 6 Nov 2023 16:33:59 +0100
Subject: [PATCH] seq: Simplify snd_seq_extract_output()
Now that we never put UMP events on the output buffer in the legacy
mode, the check and skip of UMP events are no longer necessary.
It means that ump_allowed argument is meaningless in extract_output(),
too.
Let's drop the unnecessary check and move the code extract_output()
into snd_seq_extract_output() again, and call this directly from
snd_seq_ump_extract_output() for simplification.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/seq/seq.c | 52 ++++++++++++++++++++-------------------------------
1 file changed, 20 insertions(+), 32 deletions(-)
diff --git a/src/seq/seq.c b/src/seq/seq.c
index 643cf159f3ef..5eac4848b9c7 100644
--- a/src/seq/seq.c
+++ b/src/seq/seq.c
@@ -4308,36 +4308,6 @@ int snd_seq_drain_output(snd_seq_t *seq)
return 0;
}
-static int extract_output(snd_seq_t *seq, snd_seq_event_t **ev_res, int ump_allowed)
-{
- size_t len, olen;
- assert(seq);
- if (ev_res)
- *ev_res = NULL;
- repeat:
- if ((olen = seq->obufused) < sizeof(snd_seq_event_t))
- return -ENOENT;
- len = snd_seq_event_length((snd_seq_event_t *)seq->obuf);
- if (olen < len)
- return -ENOENT;
- /* skip invalid UMP events */
- if (snd_seq_ev_is_ump((snd_seq_event_t *)seq->obuf) && !ump_allowed) {
- seq->obufused -= len;
- memmove(seq->obuf, seq->obuf + len, seq->obufused);
- goto repeat;
- }
- if (ev_res) {
- /* extract the event */
- if (alloc_tmpbuf(seq, len) < 0)
- return -ENOMEM;
- memcpy(seq->tmpbuf, seq->obuf, len);
- *ev_res = (snd_seq_event_t *)seq->tmpbuf;
- }
- seq->obufused = olen - len;
- memmove(seq->obuf, seq->obuf + len, seq->obufused);
- return 0;
-}
-
/**
* \brief extract the first event in output buffer
* \param seq sequencer handle
@@ -4351,7 +4321,25 @@ static int extract_output(snd_seq_t *seq, snd_seq_event_t **ev_res, int ump_allo
*/
int snd_seq_extract_output(snd_seq_t *seq, snd_seq_event_t **ev_res)
{
- return extract_output(seq, ev_res, 0);
+ size_t len, olen;
+ assert(seq);
+ if (ev_res)
+ *ev_res = NULL;
+ if ((olen = seq->obufused) < sizeof(snd_seq_event_t))
+ return -ENOENT;
+ len = snd_seq_event_length((snd_seq_event_t *)seq->obuf);
+ if (olen < len)
+ return -ENOENT;
+ if (ev_res) {
+ /* extract the event */
+ if (alloc_tmpbuf(seq, len) < 0)
+ return -ENOMEM;
+ memcpy(seq->tmpbuf, seq->obuf, len);
+ *ev_res = (snd_seq_event_t *)seq->tmpbuf;
+ }
+ seq->obufused = olen - len;
+ memmove(seq->obuf, seq->obuf + len, seq->obufused);
+ return 0;
}
/*----------------------------------------------------------------*/
@@ -4547,7 +4535,7 @@ int snd_seq_ump_extract_output(snd_seq_t *seq, snd_seq_ump_event_t **ev_res)
{
if (!seq->midi_version)
return -EBADFD;
- return extract_output(seq, (snd_seq_event_t **)ev_res, 1);
+ return snd_seq_extract_output(seq, (snd_seq_event_t **)ev_res);
}
/**
--
2.35.3

View File

@ -0,0 +1,37 @@
From ed6b07084bfea4155bbc98bcf38508ab81bdd008 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 6 Nov 2023 16:36:55 +0100
Subject: [PATCH] seq: Check protocol compatibility with the current version
There is no need for checking the protocol compatibility with another
version, but we just need to check for the current version.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/seq/seq_hw.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/seq/seq_hw.c b/src/seq/seq_hw.c
index b74948c81c9e..eeaf26e16d1c 100644
--- a/src/seq/seq_hw.c
+++ b/src/seq/seq_hw.c
@@ -32,7 +32,6 @@ const char *_snd_module_seq_hw = "";
#ifndef DOC_HIDDEN
#define SNDRV_FILE_SEQ ALSA_DEVICE_DIRECTORY "seq"
#define SNDRV_FILE_ALOADSEQ ALOAD_DEVICE_DIRECTORY "aloadSEQ"
-#define SNDRV_SEQ_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 2)
typedef struct {
int fd;
@@ -535,7 +534,7 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
close(fd);
return ret;
}
- if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_SEQ_VERSION_MAX)) {
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_SEQ_VERSION)) {
close(fd);
return -SND_ERROR_INCOMPATIBLE_VERSION;
}
--
2.35.3

9
40-alsa.rules Normal file
View File

@ -0,0 +1,9 @@
SUBSYSTEM=="sound", GROUP="audio"
SUBSYSTEM=="snd", GROUP="audio"
KERNEL=="controlC[0-9]*", NAME="snd/%k"
KERNEL=="hwC[D0-9]*", NAME="snd/%k"
KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k"
KERNEL=="midiC[D0-9]*", NAME="snd/%k"
KERNEL=="timer", NAME="snd/%k"
KERNEL=="seq", NAME="snd/%k"
SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsa-init %n"

4
README.testwav Normal file
View File

@ -0,0 +1,4 @@
test.wav is copyright (c) 2001 by Matthias Nagorni <mana@suse.de>
The file can be distributed under GPL.
The tune ist based on BWV 29 by J.S. Bach.

23
all_notes_off Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# Send an "all notes off" event to all channels of all
# MIDI-Devices configured in the System
#
# Written by Matthias Nagorni, (c) 2001 SuSE GmbH Nuremberg
# (c) 2014 SUSE Linux Products GmbH
#
for d in /dev/snd/midiC?D?; do
echo Sending "all notes off" to MIDI device $d
cat /usr/lib/all_notes_off.bin > $d
done
if [ -x /usr/bin/pmidi ]; then
echo Can execute pmidi. Fine.
plist=$(pmidi -l)
for p in $plist; do
p1=${p%:0}
if [ "$p1" != "$p" ] && [ $p1 -gt 16 ]; then
echo Sending "all notes off" to MIDI port $p
pmidi -p $p -d 0 /usr/lib/all_notes_off.mid
fi
done
fi

BIN
all_notes_off.bin Normal file

Binary file not shown.

BIN
all_notes_off.mid Normal file

Binary file not shown.

12
alsa-init.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# alsa-init card#
/usr/bin/set_default_volume -f $1 >/dev/null 2>&1
test -s /var/lib/alsa/asound.state && /usr/sbin/alsactl -F restore $1 >/dev/null 2>&1
# increase buffer-preallocation size (for PA)
if [ -f /proc/asound/card$1/pcm0p/sub0/prealloc_max ]; then
[ $(cat /proc/asound/card$1/pcm0p/sub0/prealloc_max) -le 1024 ] ||
echo 1024 > /proc/asound/card$1/pcm0p/sub0/prealloc
fi
exit 0

BIN
alsa-lib-1.2.10.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE8E31BzesGohMSz1xg4BZbablnJEFAmTyDKoACgkQg4BZbabl
nJHkUQ/9FBYbT0I6HvjfJmkYBfpRDRbSxPimqho6CYdHPS4gEBksGha1obBoFEnn
HAmv8pFWn4tYOPGJ6RD+mGHBntc9W7Mzg6J7NTcoaGK3u4szPwZ4iPhn5QSMOGzH
wRFJFb1jt1Ryj8eKJQSELsy2VMJzSj3cObu8nILJlKAeV9AJfAFyXRQPUjJZOkDr
27oItHV2vtEaIndHTNHYOnkDrPPp0DplM+gfUhLP0ghu0hknQI7PuOJzN9AWqkVD
UiMsVGdXvPTmJd0+nzzUSY5lmStWcp7kujH5er/0YpB1/SWS9GgN4YN5q5nUFgVA
b5xBb3/8xW0EZ9j53X+PgCE57iMe5/5UCto70ITO4o44k0rev/9ixdzBc5J5dyls
cRLtXJwnxNS82pG429uOkEBAe309JCMKpDlOksKbPpqbtvcRN3yXlE92GEuUIrHT
VCPzNQd5XXYXX4E06/ScbpYvFqEyoT+Ph6cyunwoL9ocioj+tsB4fHi1exbwoy6+
/rx/70NjtFEVCdRpuflNmQZGyTtDd+sfaxsanH8MK7jdZCIXHyLBKqSRIrSoc8v/
sU7fzSPQ2zh1dnmjzm69l1z/YmPHf+gbGwC4Tb6Wq37o49APQYh2csz6z4E0pMP3
WgSPuWyXfgsQg9vu1/D+DnQAQFHFK8q2JKmpf7QoXpFGMN3G2nI=
=qe38
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,12 @@
--- a/src/conf.c
+++ b/src/conf.c
@@ -3904,6 +3904,9 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
configs = cfgs;
if (!configs) {
configs = getenv(ALSA_CONFIG_PATH_VAR);
+ /* ignore the non-accessible override */
+ if (configs && access(configs, R_OK) < 0)
+ configs = NULL;
if (!configs || !*configs) {
const char *topdir = snd_config_topdir();
char *s = alloca(strlen(topdir) +

6253
alsa.changes Normal file

File diff suppressed because it is too large Load Diff

29
alsa.keyring Normal file
View File

@ -0,0 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF+PBUIBEACQ0eLhY6zJkZCztI3Zj7GiEkGyDYXFr10wMn2BmAxXEOhvGs5C
XtZYokNnYnojU2ehb14pdQiIYVm7YwjNjPhFmc6DnSJ74tlDtzI0ZfZYgU8B3/AU
hHCIe7NeH+uqaS4hQ4gQF3HB19GNQ21keQPtm/cZzNvkAwWQ6wxiIas/odQGt6sg
TULub4gXQw42iCW0jNeliNgeOc/4/2qtznN+Ss5G+Hs+EBh0kFCG4+5RcpgtKmYO
LEy+8qI/UmlgOeT+47eTXm4LjxHfRuKcbvSExfICUB5XLD2ZmeZbFyP48jkDvB7w
A4jNfImtlRfTvoviNlOl08Pk3aJoPR8IZIGw+EQCf3ChXTziadqOg37SAy4yGJ14
BjirKgBNO4zB+lkLOAknsVKJOKRt3w54MevCuj0GGbfSyErZAeHvliXrfBa1ACLu
c2ynRDR/5j0FA3vPzRsHyOGFC4F34W5BhkXCuJBG2o2VDv/zANzjg/hw+0IbmH3G
kYn73EDIaz5giKJolE32WaWkz39DwuuoUaLLyfxyiN+c0p2/XQFCrOSqHNUMfI5z
Ll62nL1XruF6u9ApLKRv/uDJN7tLgds83rteYJP7/5/JSYCPB8PcUkmhB8OoVdpr
tYI8C/6Y6KREm3Jk4AdkySIFnPXZQCkiOR2qOmAuaQPeesjsrSkUtJYZcwARAQAB
tEVBTFNBIFJlbGVhc2UgVGVhbSAoUGFja2FnZSBTaWduaW5nIEtleSB2MSkgPHJl
bGVhc2VAYWxzYS1wcm9qZWN0Lm9yZz6JAk4EEwEIADgWIQTwTfUHN6waiExLPXGD
gFltpuWckQUCX48FQgIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRCDgFlt
puWckRhVD/45DNoD79lHBJEu0Wv93OSlPZDUKR+BnkkdEDgDEhTvk+Bin/EWdb3g
Unc+rEczgAqjqblLH7ndBtFZPNGiQ2nu8eAdN0TrOFQx7bFg4Do7KXNUUqdPUETC
AgkozF3ucsgOcBbv6LwwDfdQDFjkg7CuNGy8CRcLSO5dLK7domq3RxF5mKl1dkOv
4brfw6ssn+pja/jkgM9BKt80ycIDiJtVRuXMBJD19ZB8EzQO9OQBdAPERSG8BwLX
LemTLAZqNd0mixVbn50qCQil64UOkOd5DHVBBokxgtlJEcDujqWaCUYSygSiP2ke
44ArDr7hRwG5KhhbFOigXo3nBYnKyiuWs0jpnrTQD9+uTxcetyBpJ6BW/i/Fy2a9
NBFNhbDI07rCMXM25cLP8qbI5i6nTSDlkpLP40At9yUVYt8gIO6ZpGpO04/lAhT1
NxtbZkKMo1nphMHU/MDSusoHyLxUXpppdbXTdMgsuFrXae3gcFDowQbLZqb6ZAJ5
opX4sDBIdoHDBsI6wCGTV7AAWB8RXWW0RTYMkyIxqixiiB2N2jaau4yHfqv9QWOY
oPcx6ySKqGN0HV50PeRis5eeq7kHIdRrVIOBd0tPIqCKIvyJZk1QXReKvvE84Km2
dYPusBlhhF7/4WVovlE6HFwyLSOyb32m4qf5dV35op07ew8i4DHpkQ==
=n4lM
-----END PGP PUBLIC KEY BLOCK-----

330
alsa.spec Normal file
View File

@ -0,0 +1,330 @@
#
# spec file for package alsa
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%if 0%{?suse_version} < 1200
%define _udevrulesdir /lib/udev/rules.d/
%endif
%ifarch %ix86 x86_64 %arm aarch64 ppc64le riscv64
%define enable_topology 1
%else
%define enable_topology 0
%endif
Name: alsa
Version: 1.2.10
Release: 0
Summary: Advanced Linux Sound Architecture
License: LGPL-2.1-or-later
Group: System/Libraries
URL: https://www.alsa-project.org
Source: https://www.alsa-project.org/files/pub/lib/alsa-lib-%{version}.tar.bz2
Source1: https://www.alsa-project.org/files/pub/lib/alsa-lib-%{version}.tar.bz2.sig
Source2: baselibs.conf
Source8: 40-alsa.rules
Source11: alsasound
Source12: sysconfig.sound
Source13: joystick
Source14: sysconfig.joystick
Source16: set_default_volume
Source17: test.wav
Source21: README.testwav
Source30: all_notes_off
Source31: all_notes_off.bin
Source32: all_notes_off.mid
Source34: alsa-init.sh
# from https://www.alsa-project.org/files/pub/gpg-release-key-v1.txt
Source35: alsa.keyring
# upstream fixes
Patch1: 0001-control.h-Fix-ump-header-file-detection.patch
Patch2: 0002-global.h-move-__STRING-macro-outside-PIC-ifdef-block.patch
Patch3: 0003-pcm-Fix-segfault-with-32bit-libs.patch
Patch4: 0004-reshuffle-included-files-to-include-config.h-as-firs.patch
Patch5: 0005-seq-Fix-typos-in-symbol-version-definitions.patch
Patch6: 0006-seq-Fix-invalid-sanity-check-in-snd_seq_set_input_bu.patch
Patch7: 0007-mixer-simple-Support-dB-TLVs-for-CTL_SINGLE-controls.patch
Patch8: 0008-seq-Clear-UMP-event-flag-for-legacy-apps.patch
Patch9: 0009-seq-Simplify-snd_seq_extract_output.patch
Patch10: 0010-seq-Check-protocol-compatibility-with-the-current-ve.patch
# rest suse fixes
Patch101: alsa-lib-ignore-non-accessible-ALSA_CONFIG_PATH.patch
BuildRequires: doxygen
BuildRequires: libtool
BuildRequires: pkgconfig
Requires: alsa-ucm-conf
Requires: alsa-utils
Requires(post): %fillup_prereq
Recommends: alsa-oss
Recommends: alsa-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} <= 1310
Requires(post): %insserv_prereq
%endif
%if 0%{?suse_version} > 1200
BuildRequires: pkgconfig(udev)
%else
BuildRequires: udev
%endif
%description
ALSA stands for Advanced Linux Sound Architecture. It supports many
PCI, ISA PnP and USB sound cards.
This package contains the ALSA init scripts to start the sound system
on your Linux box. To set it up, run yast2 or alsaconf.
%package devel
Summary: Header files for ALSA development
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libasound2 = %{version}
Obsoletes: alsadev < %{version}
Provides: alsa-lib-devel = %{version}
Provides: alsadev = %{version}
%description devel
This package contains all necessary include files and libraries needed
to develop applications that require ALSA.
%if %enable_topology
%package topology-devel
Summary: Header files for ALSA topology development
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: alsa-devel = %{version}
Requires: libatopology2 = %{version}
%description topology-devel
This package contains all necessary include files and libraries needed
to develop applications that require ALSA topology.
%endif
%package docs
Summary: Additional Package Documentation for ALSA
License: GPL-2.0-or-later
Group: Documentation/Other
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
%description docs
This package contains optional documentation provided in addition to
this package's base documentation.
%package -n libasound2
Summary: Advanced Linux Sound Architecture Library
License: LGPL-2.1-or-later
Group: System/Libraries
Provides: alsa-lib
%description -n libasound2
This package contains the library for ALSA, Advanced Linux Sound
Architecture.
%if %enable_topology
%package -n libatopology2
Summary: ALSA Topology Library
License: LGPL-2.1-or-later
Group: System/Libraries
%description -n libatopology2
This package contains the library for ALSA topology support.
%endif
%prep
%autosetup -p1 -n alsa-lib-%{version}
%build
# disable LTO; otherwise some apps confused with versioned symbols (boo#1149461)
%define _lto_cflags %{nil}
export AUTOMAKE_JOBS="%{?_smp_mflags}"
# build alsa-lib
autoreconf -fi
%configure \
--disable-static \
--enable-symbolic-functions \
--disable-aload \
--disable-alisp \
%if !%enable_topology
--disable-topology \
%endif
--disable-python
make V=1 %{?_smp_mflags}
# run doxygen
make -C doc doc %{?_smp_mflags}
%install
# install shared library
%make_install
# clean up unneeded files
rm -f %{buildroot}%{_libdir}/*.*a
# rm -f %%{buildroot}%%{_libdir}/alsa-lib/smixer/*.*a
rm -f %{buildroot}%{_bindir}/aserver
%if !%enable_topology
rm -f %{buildroot}%{_libdir}/pkgconfig/alsa-topology.pc
%endif
#
# install helper scripts
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
install -c -m 0755 %{SOURCE16} %{buildroot}%{_bindir}
install -c -m 0755 %{SOURCE34} %{buildroot}%{_sbindir}/alsa-init
%if 0%{?suse_version} < 1140
sed -i -e 's@%{_localstatedir}/lib/alsa/asound.state@%{_sysconfdir}/asound.state@g' %{buildroot}%{_bindir}/set_default_volume
sed -i -e 's@%{_localstatedir}/lib/alsa/asound.state@%{_sysconfdir}/asound.state@g' %{buildroot}%{_sbindir}/alsa-init
%endif
# install test wave file
mkdir -p %{buildroot}%{_datadir}/sounds/alsa
install -c -m 0644 %{SOURCE17} %{buildroot}%{_datadir}/sounds/alsa/test.wav
# install all_notes_off stuff
install -c -m 0755 %{SOURCE30} %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_prefix}/lib
install -c -m 0644 %{SOURCE31} %{buildroot}%{_prefix}/lib
install -c -m 0644 %{SOURCE32} %{buildroot}%{_prefix}/lib
%if 0%{?suse_version} <= 1310
#
# install init scripts
#
mkdir -p %{buildroot}%{_sysconfdir}/init.d
install -c -m 0755 %{SOURCE11} %{buildroot}%{_sysconfdir}/init.d
install -c -m 0755 %{SOURCE13} %{buildroot}%{_sysconfdir}/init.d
%if 0%{?suse_version} < 1140
sed -i -e 's@%{_localstatedir}/lib/alsa/asound.state@%{_sysconfdir}/asound.state@g' %{buildroot}%{_initddir}/alsasound
%endif
rm -f %{buildroot}%{_sbindir}/rcalsasound
ln -s ../..%{_initddir}/alsasound %{buildroot}%{_sbindir}/rcalsasound
rm -f %{buildroot}%{_sbindir}/rcjoystick
ln -s ../..%{_initddir}/joystick %{buildroot}%{_sbindir}/rcjoystick
%endif
#
# udev rules
#
%if 0%{?suse_version} < 1140
mkdir -p %{buildroot}%{_udevrulesdir}
install -c -m 0644 %{SOURCE8} %{buildroot}%{_udevrulesdir}
%endif
#
# install template to update rc.config and sysconfig files:
# (updating the actual files is done in the %% post-script)
#
mkdir -p -m 755 %{buildroot}%{_fillupdir}
mkdir -p -m 755 %{buildroot}%{_sysconfdir}/sysconfig
install -m 644 %{_sourcedir}/sysconfig.sound %{buildroot}%{_fillupdir}
%if 0%{?suse_version} <= 1310
install -m 644 %{_sourcedir}/sysconfig.joystick %{buildroot}%{_fillupdir}
%endif
#
# documents
#
mkdir -p %{buildroot}%{_docdir}/%{name}
cp %{_sourcedir}/README* %{buildroot}%{_docdir}/%{name}
%if 0%{?suse_version} < 1200
cp COPYING %{buildroot}%{_docdir}/%{name}
%endif
mkdir -p %{buildroot}%{_docdir}/%{name}/alsa-lib
cp ChangeLog TODO MEMORY-LEAK NOTES %{buildroot}%{_docdir}/%{name}/alsa-lib
cp doc/asoundrc.txt %{buildroot}%{_docdir}/%{name}/alsa-lib
%post
%if 0%{?suse_version} > 1310
%{fillup_only -n sound}
%else
%{fillup_and_insserv -ny sound alsasound}
%{fillup_and_insserv -n joystick joystick}
%endif
exit 0
%if 0%{?suse_version} <= 1310
%preun
%stop_on_removal alsasound joystick
exit 0
%postun
%restart_on_update alsasound joystick
%insserv_cleanup
exit 0
%endif
%post -n libasound2 -p /sbin/ldconfig
%postun -n libasound2 -p /sbin/ldconfig
%if %enable_topology
%post -n libatopology2 -p /sbin/ldconfig
%postun -n libatopology2 -p /sbin/ldconfig
%endif
%files
%defattr(-, root, root)
%doc %{_docdir}/%{name}
%if 0%{?suse_version} >= 1200
%license COPYING
%endif
%if 0%{?suse_version} <= 1310
%{_initddir}/*
%endif
%{_sbindir}/*
%{_bindir}/*
%{_prefix}/lib/all_notes_off.*
%{_datadir}/sounds/alsa
%{_fillupdir}/*
%if 0%{?suse_version} < 1140
%{_udevrulesdir}*
%endif
%files devel
%defattr(-, root, root)
%{_libdir}/libasound.so
%{_includedir}/sys/*
%{_includedir}/alsa
%if %enable_topology
%exclude %{_includedir}/alsa/topology.h
%endif
%{_includedir}/asoundlib.h
%{_datadir}/aclocal/*.m4
%{_libdir}/pkgconfig/alsa.pc
%if %enable_topology
%files topology-devel
%defattr(-, root, root)
%{_libdir}/libatopology.so
%{_includedir}/alsa/topology.h
%{_libdir}/pkgconfig/alsa-topology.pc
%endif
%files docs
%defattr(-, root, root)
%doc doc/doxygen/html/*
%files -n libasound2
%defattr(-, root, root)
%{_libdir}/libasound.so.*
%{_datadir}/alsa
%if %enable_topology
%files -n libatopology2
%defattr(-, root, root)
%{_libdir}/libatopology.so.*
%endif
%changelog

214
alsasound Normal file
View File

@ -0,0 +1,214 @@
#!/bin/sh
#
# alsasound This shell script takes care of starting and stopping
# the ALSA sound driver.
#
# This script requires /usr/sbin/alsactl program from 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# For RedHat 5.0+:
# chkconfig: 2345 87 14
# description: ALSA driver
#
# modified to visually fit into SuSE 6.0+ by Philipp Thomas <pthomas@suse.de>
# further improvements by Bernd Kaindl, Olaf Hering and Takashi Iwai.
#
### BEGIN INIT INFO
# Provides: alsasound
# Required-Start: $local_fs
# Should-Start: $remote_fs resmgr
# Required-Stop: $local_fs
# Should-Stop: $remote_fs resmgr
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: Set up ALSA sound system
# Description: Loading ALSA drivers and store/restore the current setting
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/sound
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
rc_reset
alsactl=/usr/sbin/alsactl
asoundcfg=/var/lib/alsa/asound.state
aconnect=/usr/bin/aconnect
get_drivers() {
/sbin/modprobe -c | \
grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | sort -u | \
while read a b card; do
echo $card
done
}
#
# insert all sound modules
#
load_modules() {
module_loaded=0
c=""
drivers=`get_drivers`
for i in $drivers; do
if [ $i != off ]; then
if [ x$c = x ]; then
echo -n ": "
c=1
fi
echo -n " ${i##snd-}"
/sbin/modprobe $i && module_loaded=1
fi
done
rc_status -v -r
test $module_loaded -eq 0 && return 1
return 0
}
#
# rest of start action
#
# manual load and force to store the status
start_all() {
echo -n "Starting sound driver"
load_modules
rc_status -r
}
do_kill() {
fuser $* /dev/admmidi* /dev/adsp* /dev/amidi* /dev/audio* /dev/dmfm* \
/dev/dmmidi* /dev/dsp* /dev/dspW* /dev/midi* /dev/mixer* /dev/music \
/dev/patmgr* /dev/sequencer* /dev/sndstat >/dev/null 2>&1
if [ -d /dev/snd ]; then
fuser $* /dev/snd/* >/dev/null 2>&1
fi
}
terminate() {
#
# Kill processes holding open sound devices
#
do_kill -TERM -k
sleep 1
do_kill -k
#
# remove all sequencer connections if any
#
if [ -f /proc/asound/seq/clients -a -x $aconnect ]; then
$aconnect --removeall
fi
}
# mute master to avoid clicks at unload/shutdown
mute_system() {
/usr/bin/amixer set Master mute >/dev/null 2>&1
}
#
# remove all sound modules
#
unload_modules() {
mute_system
mod=$(grep -m1 -E '^(snd[^ ]*|ac97_bus) [0-9]+ 0' /proc/modules)
while [ -n "$mod" ]; do
mod=${mod%% *}
/sbin/modprobe -r $mod
mod=$(grep -m1 -E '^(snd[^ ]*|ac97_bus) [0-9]+ 0' /proc/modules)
done
rc_failed 0
}
unload_all() {
echo -n "Shutting down sound driver"
terminate
unload_modules
rc_status -v
}
stop_all() {
if [ -d /proc/asound ]; then
$alsactl -g -f $asoundcfg store
unload_all
fi
}
# See how we were called.
case "$1" in
start)
if test "$PREVLEVEL" = "N" -a -d /proc/asound ; then
# re-run alsactl when /var is a seprate partition (bnc#700781)
case $asoundcfg in
/var/*)
grep -q " /var " /proc/mounts && \
$alsactl -F -f $asoundcfg restore >/dev/null 2>&1
;;
esac
else
start_all
fi
;;
stop)
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" ]; then
if [ -d /proc/asound ]; then
$alsactl -f $asoundcfg store
# kill pulseaudio before muting the system (bnc#499445)
if killall -q -TERM pulseaudio; then
usleep 200
fi
mute_system
fi
else
stop_all
fi
;;
unload)
test -d /proc/asound && unload_all
;;
reload|restart)
stop_all
start_all
;;
status)
if [ -d /proc/asound ]; then
echo -n "ALSA sound driver loaded."
rc_status -v
else
echo -n "ALSA sound driver not loaded."
rc_status -u
fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|unload|status}"
exit 1
;;
esac
rc_exit

10
baselibs.conf Normal file
View File

@ -0,0 +1,10 @@
libasound2
obsoletes "alsa-<targettype>"
provides "alsa-<targettype>"
recommends "alsa-oss-<targettype>"
alsa-devel
requires -alsa-<targettype>
requires "libasound2-<targettype> = <version>"
libatopology2
alsa-topology-devel
requires "libatopology2-<targettype> = <version>"

113
joystick Normal file
View File

@ -0,0 +1,113 @@
#! /bin/bash
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany.
# (c) 2014 SUSE Linux Products GmbH
#
# Author: Takashi Iwai <tiwai@suse.de>, 2001
#
# /etc/init.d/joystick
#
### BEGIN INIT INFO
# Provides: joystick
# Required-Start: alsasound
# Required-Stop: alsasound
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: Set up analog joysticks
# Description: Loading joystick drivers
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/joystick
alsactl=/usr/sbin/alsactl
if [ -x /sbin/lsmod ]; then
lsmod=/sbin/lsmod
else
lsmod=/bin/lsmod
fi
# load joystick drivers
function start () {
# first load joydev module
if [ -z "${JOYSTICK_MODULE_0}${JOYSTICK_MODULE_1}${JOYSTICK_MODULE_2}${JOYSTICK_MODULE_3}" ]; then
rc_failed 5
return
fi
/sbin/modprobe joydev
for js in 0 1 2 3; do
# load gameport module
eval jsmod=\$GAMEPORT_MODULE_$js
if [ -n "$jsmod" -a "$jsmod" != off ]; then
/sbin/modprobe $jsmod >/dev/null 2>&1
fi
# load joystick module
eval jsdev=\$JOYSTICK_MODULE_$js
eval jsdev_opts=\$JOYSTICK_MODULE_OPTION_$js
if [ -n "$jsdev" -a "$jsdev" != off ]; then
/sbin/modprobe $jsdev $jsdev_opts >/dev/null 2>&1
fi
done
}
function stop () {
for js in 0 1 2 3; do
# remove gameport module
eval jsmod=\$GAMEPORT_MODULE_$js
if [ -n "$jsmod" -a "$jsmod" != off ]; then
/sbin/modprobe -r $jsmod
fi
# remove joystick module
eval jsdev=\$JOYSTICK_MODULE_$js
if [ -n "$jsdev" -a "$jsdev" != off ]; then
/sbin/modprobe -r $jsdev
fi
done
}
# See how we were called.
case "$1" in
start)
echo -n "Starting joystick driver"
start
rc_status -v
;;
stop)
# Stop daemons.
echo -n "Stopping joystick driver"
stop
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
$0 stop && $0 start
rc_status
;;
reload)
rc_failed 3
rc_status -v
;;
status)
if $lsmod | grep -q joydev; then
echo -n "Joystick driver loaded."
rc_status -v
else
echo -n "Joystick driver not loaded."
rc_status -u
fi
;;
*)
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
exit 1
;;
esac
rc_exit

99
set_default_volume Normal file
View File

@ -0,0 +1,99 @@
#!/bin/sh
#
# set default volumes for playback on ALSA
#
# set_default_mixer [-f] [card#]
#
# written by Takashi Iwai <tiwai@suse.de>
#
forced=
if [ x$1 = x-f ]; then
forced=yes
shift
fi
if [ -f /var/lib/alsa/asound.state -a -z "$forced" ]; then
/usr/sbin/alsactl restore >/dev/null 2>&1
exit 0
fi
if [ -n "$1" ]; then
case "$1" in
[0-9]*)
card="-D hw:$1";;
*)
card="-D $1";;
esac
fi
if amixer $card | grep -q "'Master"; then
slavevolp="100%"
slavevoldb="0dB"
else
slavevolp="75%"
slavevoldb="-12dB"
fi
amixer -q -s $card <<EOF
set Master 75% unmute
set Master -12dB
set 'Master Mono' 75% unmute
set 'Master Mono' -12dB
set Front $slavevolp unmute
set Front $slavevoldb
set PCM $slavevolp unmute
set PCM $slavevoldb
set Synth $slavevolp unmute
set Synth $slavevoldb
set Speaker $slavevolp unmute
set Speaker $slavevoldb
set CD $slavevolp unmute
set CD $slavevoldb
# mute mic
set Mic 0% mute
# ESS 1969 chipset has 2 PCM channels
set PCM,1 90% unmute
set PCM,1 0dB
# Trident/YMFPCI/emu10k1
set Wave 100% unmute
set Music 100% unmute
set AC97 100% unmute
# CS4237B chipset:
set 'Master Digital' 75% unmute
# Envy24 chips with analog outs
set DAC 90% unmute
set DAC -12dB
set DAC,0 90% unmute
set DAC,0 -12dB
set DAC,1 90% unmute
set DAC,1 -12dB
# some notebooks use headphone instead of master
set Headphone $slavevolp unmute
set Headphone $slavevoldb
set Playback 100% unmute
# turn off digital switches
set "SB Live Analog/Digital Output Jack" off
set "Audigy Analog/Digital Output Jack" off
# VIA82xx
set "VIX DXS" 100%
set "VIX DXS",1 100%
set "VIX DXS",2 100%
set "VIX DXS",3 100%
# capture
set Capture 12dB cap
EOF
# run platform-defined scripts (if any)
for i in /etc/alsa.d/volume/*; do
if [ -x "$i" ]; then
case "$i" in
*~|*.bak|*.rpm*)
;;
/etc/alsa.d/volume/[0-9]*)
"$i" "$@"
esac
fi
done
exit 0

35
sysconfig.joystick Normal file
View File

@ -0,0 +1,35 @@
## Path: Hardware/Joystick
## Description: Joystick cofigurations
## Type: string
## Default: ""
## ServiceRestart: joystick
#
# Gameport module names
# (typically "ns558" for legacy gameport support)
#
GAMEPORT_MODULE_0=""
GAMEPORT_MODULE_1=""
GAMEPORT_MODULE_2=""
GAMEPORT_MODULE_3=""
## Type: string
## Default: ""
#
# Joystick module names
# (typically "analog")
#
JOYSTICK_MODULE_0=""
JOYSTICK_MODULE_1=""
JOYSTICK_MODULE_2=""
JOYSTICK_MODULE_3=""
## Type: string
## Default: ""
#
# Joystick module options
# (e.g. "js=gameport" for analog)
#
JOYSTICK_MODULE_OPTION_0=""
JOYSTICK_MODULE_OPTION_1=""
JOYSTICK_MODULE_OPTION_2=""
JOYSTICK_MODULE_OPTION_3=""

40
sysconfig.sound Normal file
View File

@ -0,0 +1,40 @@
## Path: Hardware/Soundcard
## Description: Additional options for the sound system.
## Type: yesno
## Default: no
## ServiceReload: alsasound
#
# Load ALSA sequencer modules at boot-up? (yes/no)
# Sequencer modules are necessary only for handling MIDI devices.
# If you don't need MIDI, leave here no.
#
LOAD_SEQUENCER="no"
## Type: string
## Default: ""
#
# The file name of SoundFont file to be loaded at boot
# If you need to load a specific SoundFont file for SB AWE32, SB Live!
# and Audigy series, set the file name (or path) of the file here.
#
SOUNDFONT_FILES=""
## Type: yesno
## Default: no
#
# Load OSS-emulation modules at boot-up? (yes/no)
# OSS-emulation modules are needed if you use OSS applications
# with ALSA drivers. This option specifies whether these modules are
# loaded at boot-time.
#
LOAD_OSS_EMUL_MODULES="no"
## Type: yesno
## Default: no
#
# Load OSS-sequencer emulation module at boot-up? (yes/no)
# OSS-sequencer emulation module is needed If you use old /dev/sequencer
# or /dev/music. The default is "no" since there are little
# applications using these interfaces.
#
LOAD_OSS_SEQ_MODULE="no"

BIN
test.wav Normal file

Binary file not shown.