Accepting request 133504 from multimedia:libs

- Updated to version 1.0.26; including previous fixes (forwarded request 133503 from tiwai)

OBS-URL: https://build.opensuse.org/request/show/133504
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa-utils?expand=0&rev=68
This commit is contained in:
Stephan Kulow 2012-09-11 07:03:53 +00:00 committed by Git OBS Bridge
commit da87b97d26
19 changed files with 10 additions and 1380 deletions

View File

@ -1,34 +0,0 @@
From 5b91ee7f61d9d743bb30b3dc0d98422bb0cd3092 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 6 Feb 2012 14:58:03 +0100
Subject: [PATCH 01/13] Fix the examples in aplay.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
aplay/aplay.1 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.1 b/aplay/aplay.1
index 8ccf556..2acaed5 100644
--- a/aplay/aplay.1
+++ b/aplay/aplay.1
@@ -213,14 +213,14 @@ pcm.copy {
.fi
.TP
-\fBarecord \-t wav \-max-file_time 30 mon.wav\fP
+\fBarecord \-t wav \-\-max-file-time 30 mon.wav\fP
Record from the default audio source in monaural, 8,000 samples
per second, 8 bits per sample. Start a new file every
30 seconds. File names are mon-nn.wav, where nn increases
from 01. The file after mon-99.wav is mon-100.wav.
.TP
-\fBarecord \-f cd \-t wav \-max-file-time 3600 --use-strftime %Y/%m/%d/listen-%H-%M-%v.wav\fP
+\fBarecord \-f cd \-t wav \-\-max-file-time 3600 --use-strftime %Y/%m/%d/listen-%H-%M-%v.wav\fP
Record in stereo from the default audio source. Create a new file
every hour. The files are placed in directories based on their start dates
and have names which include their start times and file numbers.
--
1.7.9.2

View File

@ -1,43 +0,0 @@
From d5b6ecbbd63e39acdfd1404f0085ad16a1942f19 Mon Sep 17 00:00:00 2001
From: Vikram Narayanan <vikram186@gmail.com>
Date: Sat, 11 Feb 2012 13:47:48 +0530
Subject: [PATCH 02/13] Trivial fixes in INSTALL file
Changed from HG->git in the INSTALL file
Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
INSTALL | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/INSTALL b/INSTALL
index 202c491..544d5d2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -24,11 +24,11 @@ package. The configure script from alsa-utils package probably cannot find
header file asoundlib.h in $prefix/include/alsa directory (usually in
/usr/include/alsa directory).
-Compilation from HG sources
+Compilation from git sources
---------------------------
You need also GNU packages autoconf and automake installed in your system
-to compile HG (Mercurial) sources of alsa-utils package.
+to compile git sources of alsa-utils package.
For compilation you can use these commands:
@@ -40,7 +40,7 @@ For compilation you can use these commands:
./configure
make
-The included hgcompile script does this job for you.
+The included gitcompile script does this job for you.
Note: Some automake packages have missing aclocal program. Use newer version
in the case.
--
1.7.9.2

View File

@ -1,42 +0,0 @@
From 53107e1e3146e3687e571b2c31f9d271623c5411 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 20 Feb 2012 16:41:19 +0100
Subject: [PATCH 04/13] alsaloop: Improve xrun_sync - fill missing playback
samples
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/pcmjob.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
index bfac2d3..c9b120f 100644
--- a/alsaloop/pcmjob.c
+++ b/alsaloop/pcmjob.c
@@ -949,6 +949,23 @@ static int xrun_sync(struct loopback *loop)
logit(LOG_CRIT, "%s start failed: %s\n", play->id, snd_strerror(err));
return err;
}
+ } else if (delay1 < fill) {
+ diff = (fill - delay1) / play->pitch;
+ while (diff > 0) {
+ delay1 = play->buf_size - play->buf_pos;
+ if (verbose > 6)
+ snd_output_printf(loop->output,
+ "sync: playback short, silence filling %li / buf_count=%li\n", (long)delay1, play->buf_count);
+ if (delay1 > diff)
+ delay1 = diff;
+ if ((err = snd_pcm_format_set_silence(play->format, play->buf + play->buf_pos * play->channels, delay1)) < 0)
+ return err;
+ play->buf_pos += delay1;
+ play->buf_pos %= play->buf_size;
+ play->buf_count += delay1;
+ diff -= delay1;
+ }
+ writeit(play);
}
if (verbose > 5) {
snd_output_printf(loop->output, "%s: xrun sync ok\n", loop->id);
--
1.7.9.2

View File

@ -1,100 +0,0 @@
From 2d105e0f18a82783ea69e2dbe9da7aeb7d3c1346 Mon Sep 17 00:00:00 2001
From: Pavel Hofman <pavel.hofman@ivitera.com>
Date: Mon, 5 Mar 2012 21:27:00 +0000
Subject: [PATCH 05/13] aplay - option to dump HW parameters
Dumping HW parameters of the current device with snd_pcm_hw_params_dump,
a new option --dump-hw-params added.
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.1 | 7 +++++++
aplay/aplay.c | 18 ++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.1 b/aplay/aplay.1
index 2acaed5..0195322 100644
--- a/aplay/aplay.1
+++ b/aplay/aplay.1
@@ -184,6 +184,13 @@ the month, %H hour, %M minute and %S second. In addition, %v is
the file number, starting at 1. When this option is specified,
intermediate directories for the output file are created automatically.
This option has no effect if \-\-separate\-channels is specified.
+.TP
+\fI\-\-dump\-hw\-params\fP
+Dump hw_params of the device preconfigured status to stderr. The dump
+lists capabilities of the selected device such as supported formats,
+sampling rates, numbers of channels, period and buffer bytes/sizes/times.
+For raw device hw:X this option basically lists hardware capabilities of
+the soundcard.
.SH SIGNALS
When recording, SIGINT, SIGTERM and SIGABRT will close the output
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 73a9544..0633cbd 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -129,6 +129,7 @@ static int max_file_time = 0;
static int use_strftime = 0;
volatile static int recycle_capture_file = 0;
static long term_c_lflag = -1;
+static int dump_hw_params = 0;
static int fd = -1;
static off64_t pbrec_count = LLONG_MAX, fdcount;
@@ -223,7 +224,8 @@ _("Usage: %s [OPTION]... [FILE]...\n"
" --max-file-time=# start another output file when the old file has recorded\n"
" for this many seconds\n"
" --process-id-file write the process ID here\n"
-" --use-strftime apply the strftime facility to the output file name\n")
+" --use-strftime apply the strftime facility to the output file name\n"
+" --dump-hw-params dump hw_params of the device\n")
, command);
printf(_("Recognized sample formats are:"));
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
@@ -416,7 +418,8 @@ enum {
OPT_TEST_NOWAIT,
OPT_MAX_FILE_TIME,
OPT_PROCESS_ID_FILE,
- OPT_USE_STRFTIME
+ OPT_USE_STRFTIME,
+ OPT_DUMP_HWPARAMS
};
int main(int argc, char *argv[])
@@ -461,6 +464,7 @@ int main(int argc, char *argv[])
{"process-id-file", 1, 0, OPT_PROCESS_ID_FILE},
{"use-strftime", 0, 0, OPT_USE_STRFTIME},
{"interactive", 0, 0, 'i'},
+ {"dump-hw-params", 0, 0, OPT_DUMP_HWPARAMS},
{0, 0, 0, 0}
};
char *pcm_name = "default";
@@ -662,6 +666,9 @@ int main(int argc, char *argv[])
case OPT_USE_STRFTIME:
use_strftime = 1;
break;
+ case OPT_DUMP_HWPARAMS:
+ dump_hw_params = 1;
+ break;
default:
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
return 1;
@@ -1059,6 +1066,13 @@ static void set_params(void)
error(_("Broken configuration for this PCM: no configurations available"));
prg_exit(EXIT_FAILURE);
}
+ if (dump_hw_params) {
+ fprintf(stderr, _("HW Params of device \"%s\":\n"),
+ snd_pcm_name(handle));
+ fprintf(stderr, "--------------------\n");
+ snd_pcm_hw_params_dump(params, log);
+ fprintf(stderr, "--------------------\n");
+ }
if (mmap_flag) {
snd_pcm_access_mask_t *mask = alloca(snd_pcm_access_mask_sizeof());
snd_pcm_access_mask_none(mask);
--
1.7.9.2

View File

@ -1,456 +0,0 @@
From a2b66855e69b0f1dc27dab37f24057f717359884 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 12 Mar 2012 10:56:22 +0100
Subject: [PATCH 06/13] amixer: Add the support for mapped volumes like
alsamixer
When -M option is given, amixer handles the volumes in percent unit
with the mapping more intuitive to human ears just like in alsamixer.
The -R option is to take the raw value as the volume percentage.
This mode is still used as default.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
amixer/Makefile.am | 2 +-
amixer/amixer.c | 238 ++++++++++++++++++++++++++++++----------------------
2 files changed, 141 insertions(+), 99 deletions(-)
diff --git a/amixer/Makefile.am b/amixer/Makefile.am
index fcd0e81..ba67a57 100644
--- a/amixer/Makefile.am
+++ b/amixer/Makefile.am
@@ -4,7 +4,7 @@ LDADD = -lm
# CFLAGS += -g -Wall
bin_PROGRAMS = amixer
-amixer_SOURCES = amixer.c
+amixer_SOURCES = amixer.c ../alsamixer/volume_mapping.c
noinst_HEADERS = amixer.h
man_MANS = amixer.1
EXTRA_DIST = amixer.1
diff --git a/amixer/amixer.c b/amixer/amixer.c
index 9d2855d..a0a7387 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -29,7 +29,9 @@
#include <assert.h>
#include <alsa/asoundlib.h>
#include <sys/poll.h>
+#include <stdint.h>
#include "amixer.h"
+#include "../alsamixer/volume_mapping.h"
#define LEVEL_BASIC (1<<0)
#define LEVEL_INACTIVE (1<<1)
@@ -68,6 +70,8 @@ static int help(void)
printf(" -i,--inactive show also inactive controls\n");
printf(" -a,--abstract L select abstraction level (none or basic)\n");
printf(" -s,--stdin Read and execute commands from stdin sequentially\n");
+ printf(" -R,--raw-volume Use the raw value (default)\n");
+ printf(" -M,--mapped-volume Use the mapped volume\n");
printf("\nAvailable commands:\n");
printf(" scontrols show all mixer simple controls\n");
printf(" scontents show contents of all mixer simple controls (default command)\n");
@@ -187,9 +191,9 @@ static int convert_db_range(int val, int omin, int omax, int nmin, int nmax)
/* Fuction to convert from volume to percentage. val = volume */
-static int convert_prange(int val, int min, int max)
+static int convert_prange(long val, long min, long max)
{
- int range = max - min;
+ long range = max - min;
int tmp;
if (range == 0)
@@ -204,29 +208,6 @@ static int convert_prange(int val, int min, int max)
#define convert_prange1(val, min, max) \
ceil((val) * ((max) - (min)) * 0.01 + (min))
-static const char *get_percent(int val, int min, int max)
-{
- static char str[32];
- int p;
-
- p = convert_prange(val, min, max);
- sprintf(str, "%i [%i%%]", val, p);
- return str;
-}
-
-#if 0
-static const char *get_percent1(int val, int min, int max, int min_dB, int max_dB)
-{
- static char str[32];
- int p, db;
-
- p = convert_prange(val, min, max);
- db = convert_db_range(val, min, max, min_dB, max_dB);
- sprintf(str, "%i [%i%%] [%i.%02idB]", val, p, db / 100, abs(db % 100));
- return str;
-}
-#endif
-
static long get_integer(char **ptr, long min, long max)
{
long val = min;
@@ -288,26 +269,83 @@ struct volume_ops {
int (*get)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t c,
long *value);
int (*set)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t c,
- long value);
+ long value, int dir);
};
-enum { VOL_RAW, VOL_DB };
+enum { VOL_RAW, VOL_DB, VOL_MAP };
struct volume_ops_set {
int (*has_volume)(snd_mixer_elem_t *elem);
- struct volume_ops v[2];
+ struct volume_ops v[3];
};
static int set_playback_dB(snd_mixer_elem_t *elem,
- snd_mixer_selem_channel_id_t c, long value)
+ snd_mixer_selem_channel_id_t c, long value, int dir)
{
- return snd_mixer_selem_set_playback_dB(elem, c, value, 0);
+ return snd_mixer_selem_set_playback_dB(elem, c, value, dir);
}
static int set_capture_dB(snd_mixer_elem_t *elem,
- snd_mixer_selem_channel_id_t c, long value)
+ snd_mixer_selem_channel_id_t c, long value, int dir)
+{
+ return snd_mixer_selem_set_capture_dB(elem, c, value, dir);
+}
+
+static int set_playback_raw_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c,
+ long value, int dir)
+{
+ return snd_mixer_selem_set_playback_volume(elem, c, value);
+}
+
+static int set_capture_raw_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c,
+ long value, int dir)
+{
+ return snd_mixer_selem_set_capture_volume(elem, c, value);
+}
+
+/* FIXME: normalize to int32 space to be compatible with other types */
+#define MAP_VOL_RES (INT32_MAX / 100)
+
+static int get_mapped_volume_range(snd_mixer_elem_t *elem,
+ long *pmin, long *pmax)
+{
+ *pmin = 0;
+ *pmax = MAP_VOL_RES;
+ return 0;
+}
+
+static int get_playback_mapped_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c,
+ long *value)
+{
+ *value = (rint)(get_normalized_playback_volume(elem, c) * MAP_VOL_RES);
+ return 0;
+}
+
+static int set_playback_mapped_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c,
+ long value, int dir)
{
- return snd_mixer_selem_set_capture_dB(elem, c, value, 0);
+ return set_normalized_playback_volume(elem, c,
+ (double)value / MAP_VOL_RES, dir);
+}
+
+static int get_capture_mapped_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c,
+ long *value)
+{
+ *value = (rint)(get_normalized_capture_volume(elem, c) * MAP_VOL_RES);
+ return 0;
+}
+
+static int set_capture_mapped_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c,
+ long value, int dir)
+{
+ return set_normalized_capture_volume(elem, c,
+ (double)value / MAP_VOL_RES, dir);
}
static const struct volume_ops_set vol_ops[2] = {
@@ -315,29 +353,42 @@ static const struct volume_ops_set vol_ops[2] = {
.has_volume = snd_mixer_selem_has_playback_volume,
.v = {{ snd_mixer_selem_get_playback_volume_range,
snd_mixer_selem_get_playback_volume,
- snd_mixer_selem_set_playback_volume },
+ set_playback_raw_volume },
{ snd_mixer_selem_get_playback_dB_range,
snd_mixer_selem_get_playback_dB,
- set_playback_dB }},
+ set_playback_dB },
+ { get_mapped_volume_range,
+ get_playback_mapped_volume,
+ set_playback_mapped_volume },
+ },
},
{
.has_volume = snd_mixer_selem_has_capture_volume,
.v = {{ snd_mixer_selem_get_capture_volume_range,
snd_mixer_selem_get_capture_volume,
- snd_mixer_selem_set_capture_volume },
+ set_capture_raw_volume },
{ snd_mixer_selem_get_capture_dB_range,
snd_mixer_selem_get_capture_dB,
- set_capture_dB }},
+ set_capture_dB },
+ { get_mapped_volume_range,
+ get_capture_mapped_volume,
+ set_capture_mapped_volume },
+ },
},
};
+static int std_vol_type = VOL_RAW;
+
static int set_volume_simple(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t chn,
char **ptr, int dir)
{
long val, orig, pmin, pmax;
char *p = *ptr, *s;
- int invalid = 0, err = 0, vol_type = VOL_RAW;
+ int invalid = 0, percent = 0, err = 0;
+ int vol_type = std_vol_type;
+ double scale = 1.0;
+ int correct = 0;
if (! vol_ops[dir].has_volume(elem))
invalid = 1;
@@ -347,10 +398,6 @@ static int set_volume_simple(snd_mixer_elem_t *elem,
if (*p == '\0' || (!isdigit(*p) && *p != '-'))
goto skip;
- if (! invalid &&
- vol_ops[dir].v[VOL_RAW].get_range(elem, &pmin, &pmax) < 0)
- invalid = 1;
-
s = p;
val = strtol(s, &p, 10);
if (*p == '.') {
@@ -358,32 +405,37 @@ static int set_volume_simple(snd_mixer_elem_t *elem,
strtol(p, &p, 10);
}
if (*p == '%') {
- if (! invalid)
- val = (long)convert_prange1(strtod(s, NULL), pmin, pmax);
+ percent = 1;
p++;
} else if (p[0] == 'd' && p[1] == 'B') {
- if (! invalid) {
- val = (long)(strtod(s, NULL) * 100.0);
- vol_type = VOL_DB;
- if (vol_ops[dir].v[vol_type].get_range(elem, &pmin, &pmax) < 0)
- invalid = 1;
- }
+ vol_type = VOL_DB;
p += 2;
- }
+ scale = 100;
+ } else
+ vol_type = VOL_RAW;
+
+ val = (long)(strtod(s, NULL) * scale);
+ if (vol_ops[dir].v[vol_type].get_range(elem, &pmin, &pmax) < 0)
+ invalid = 1;
+ if (percent)
+ val = (long)convert_prange1(val, pmin, pmax);
if (*p == '+' || *p == '-') {
if (! invalid) {
if (vol_ops[dir].v[vol_type].get(elem, chn, &orig) < 0)
invalid = 1;
- if (*p == '+')
+ if (*p == '+') {
val = orig + val;
- else
+ correct = -1;
+ } else {
val = orig - val;
+ correct = 1;
+ }
}
p++;
}
if (! invalid) {
val = check_range(val, pmin, pmax);
- err = vol_ops[dir].v[vol_type].set(elem, chn, val);
+ err = vol_ops[dir].v[vol_type].set(elem, chn, val, correct);
}
skip:
if (*p == ',')
@@ -711,15 +763,33 @@ static int controls(int level)
return 0;
}
+static void show_selem_volume(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t chn, int dir,
+ long min, long max)
+{
+ long raw, val;
+ vol_ops[dir].v[VOL_RAW].get(elem, chn, &raw);
+ if (std_vol_type == VOL_RAW)
+ val = convert_prange(raw, min, max);
+ else {
+ vol_ops[dir].v[std_vol_type].get(elem, chn, &val);
+ val = convert_prange(val, 0, MAP_VOL_RES);
+ }
+ printf(" %li [%li%%]", raw, val);
+ if (!vol_ops[dir].v[VOL_DB].get(elem, chn, &val)) {
+ printf(" [");
+ print_dB(val);
+ printf("]");
+ }
+}
+
static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char *space, int level)
{
snd_mixer_selem_channel_id_t chn;
long pmin = 0, pmax = 0;
long cmin = 0, cmax = 0;
- long pvol, cvol;
int psw, csw;
int pmono, cmono, mono_ok = 0;
- long db;
snd_mixer_elem_t *elem;
elem = snd_mixer_find_selem(handle, id);
@@ -868,13 +938,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
mono_ok = 1;
}
if (snd_mixer_selem_has_common_volume(elem)) {
- snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &pvol);
- printf(" %s", get_percent(pvol, pmin, pmax));
- if (!snd_mixer_selem_get_playback_dB(elem, SND_MIXER_SCHN_MONO, &db)) {
- printf(" [");
- print_dB(db);
- printf("]");
- }
+ show_selem_volume(elem, SND_MIXER_SCHN_MONO, 0, pmin, pmax);
}
if (snd_mixer_selem_has_common_switch(elem)) {
snd_mixer_selem_get_playback_switch(elem, SND_MIXER_SCHN_MONO, &psw);
@@ -891,13 +955,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_has_playback_volume(elem)) {
printf(" Playback");
title = 1;
- snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &pvol);
- printf(" %s", get_percent(pvol, pmin, pmax));
- if (!snd_mixer_selem_get_playback_dB(elem, SND_MIXER_SCHN_MONO, &db)) {
- printf(" [");
- print_dB(db);
- printf("]");
- }
+ show_selem_volume(elem, SND_MIXER_SCHN_MONO, 0, pmin, pmax);
}
}
if (!snd_mixer_selem_has_common_switch(elem)) {
@@ -919,13 +977,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_has_capture_volume(elem)) {
printf(" Capture");
title = 1;
- snd_mixer_selem_get_capture_volume(elem, SND_MIXER_SCHN_MONO, &cvol);
- printf(" %s", get_percent(cvol, cmin, cmax));
- if (!snd_mixer_selem_get_capture_dB(elem, SND_MIXER_SCHN_MONO, &db)) {
- printf(" [");
- print_dB(db);
- printf("]");
- }
+ show_selem_volume(elem, SND_MIXER_SCHN_MONO, 1, cmin, cmax);
}
}
if (!snd_mixer_selem_has_common_switch(elem)) {
@@ -946,13 +998,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
continue;
printf("%s%s:", space, snd_mixer_selem_channel_name(chn));
if (!pmono && !cmono && snd_mixer_selem_has_common_volume(elem)) {
- snd_mixer_selem_get_playback_volume(elem, chn, &pvol);
- printf(" %s", get_percent(pvol, pmin, pmax));
- if (!snd_mixer_selem_get_playback_dB(elem, chn, &db)) {
- printf(" [");
- print_dB(db);
- printf("]");
- }
+ show_selem_volume(elem, chn, 0, pmin, pmax);
}
if (!pmono && !cmono && snd_mixer_selem_has_common_switch(elem)) {
snd_mixer_selem_get_playback_switch(elem, chn, &psw);
@@ -964,13 +1010,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_has_playback_volume(elem)) {
printf(" Playback");
title = 1;
- snd_mixer_selem_get_playback_volume(elem, chn, &pvol);
- printf(" %s", get_percent(pvol, pmin, pmax));
- if (!snd_mixer_selem_get_playback_dB(elem, chn, &db)) {
- printf(" [");
- print_dB(db);
- printf("]");
- }
+ show_selem_volume(elem, chn, 0, pmin, pmax);
}
}
if (!snd_mixer_selem_has_common_switch(elem)) {
@@ -988,13 +1028,7 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_has_capture_volume(elem)) {
printf(" Capture");
title = 1;
- snd_mixer_selem_get_capture_volume(elem, chn, &cvol);
- printf(" %s", get_percent(cvol, cmin, cmax));
- if (!snd_mixer_selem_get_capture_dB(elem, chn, &db)) {
- printf(" [");
- print_dB(db);
- printf("]");
- }
+ show_selem_volume(elem, chn, 1, cmin, cmax);
}
}
if (!snd_mixer_selem_has_common_switch(elem)) {
@@ -1927,6 +1961,8 @@ int main(int argc, char *argv[])
{"version", 0, NULL, 'v'},
{"abstract", 1, NULL, 'a'},
{"stdin", 0, NULL, 's'},
+ {"raw-volume", 0, NULL, 'R'},
+ {"mapped-volume", 0, NULL, 'M'},
{NULL, 0, NULL, 0},
};
@@ -1934,7 +1970,7 @@ int main(int argc, char *argv[])
while (1) {
int c;
- if ((c = getopt_long(argc, argv, "hc:D:qidnva:s", long_option, NULL)) < 0)
+ if ((c = getopt_long(argc, argv, "hc:D:qidnva:sRM", long_option, NULL)) < 0)
break;
switch (c) {
case 'h':
@@ -1987,6 +2023,12 @@ int main(int argc, char *argv[])
case 's':
read_stdin = 1;
break;
+ case 'R':
+ std_vol_type = VOL_RAW;
+ break;
+ case 'M':
+ std_vol_type = VOL_MAP;
+ break;
default:
fprintf(stderr, "Invalid switch or option needs an argument.\n");
morehelp++;
--
1.7.9.2

View File

@ -1,93 +0,0 @@
From 658c3cfd5726eb1efb44472909651402c6f8fa15 Mon Sep 17 00:00:00 2001
From: Ben Gardiner <bengardiner@nanometrics.ca>
Date: Thu, 15 Mar 2012 23:51:02 -0400
Subject: [PATCH 07/13] aplay/arecord: option to treat any xrun as fatal
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.1 | 4 ++++
aplay/aplay.c | 17 +++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.1 b/aplay/aplay.1
index 0195322..bf9b53e 100644
--- a/aplay/aplay.1
+++ b/aplay/aplay.1
@@ -191,6 +191,10 @@ lists capabilities of the selected device such as supported formats,
sampling rates, numbers of channels, period and buffer bytes/sizes/times.
For raw device hw:X this option basically lists hardware capabilities of
the soundcard.
+.TP
+\fI\-\-fatal\-errors\fP
+Disables recovery attempts when errors (e.g. xrun) are encountered; the
+aplay process instead aborts immediately.
.SH SIGNALS
When recording, SIGINT, SIGTERM and SIGABRT will close the output
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 0633cbd..1ce34c4 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -115,6 +115,7 @@ static int stop_delay = 0;
static int monotonic = 0;
static int interactive = 0;
static int can_pause = 0;
+static int fatal_errors = 0;
static int verbose = 0;
static int vumeter = VUMETER_NONE;
static int buffer_pos = 0;
@@ -225,7 +226,8 @@ _("Usage: %s [OPTION]... [FILE]...\n"
" for this many seconds\n"
" --process-id-file write the process ID here\n"
" --use-strftime apply the strftime facility to the output file name\n"
-" --dump-hw-params dump hw_params of the device\n")
+" --dump-hw-params dump hw_params of the device\n"
+" --fatal-errors treat all errors as fatal\n")
, command);
printf(_("Recognized sample formats are:"));
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
@@ -419,7 +421,8 @@ enum {
OPT_MAX_FILE_TIME,
OPT_PROCESS_ID_FILE,
OPT_USE_STRFTIME,
- OPT_DUMP_HWPARAMS
+ OPT_DUMP_HWPARAMS,
+ OPT_FATAL_ERRORS,
};
int main(int argc, char *argv[])
@@ -465,6 +468,7 @@ int main(int argc, char *argv[])
{"use-strftime", 0, 0, OPT_USE_STRFTIME},
{"interactive", 0, 0, 'i'},
{"dump-hw-params", 0, 0, OPT_DUMP_HWPARAMS},
+ {"fatal-errors", 0, 0, OPT_FATAL_ERRORS},
{0, 0, 0, 0}
};
char *pcm_name = "default";
@@ -669,6 +673,9 @@ int main(int argc, char *argv[])
case OPT_DUMP_HWPARAMS:
dump_hw_params = 1;
break;
+ case OPT_FATAL_ERRORS:
+ fatal_errors = 1;
+ break;
default:
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
return 1;
@@ -1350,6 +1357,12 @@ static void xrun(void)
prg_exit(EXIT_FAILURE);
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
+ if (fatal_errors) {
+ error(_("fatal %s: %s"),
+ stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
+ snd_strerror(res));
+ prg_exit(EXIT_FAILURE);
+ }
if (monotonic) {
#ifdef HAVE_CLOCK_GETTIME
struct timespec now, diff, tstamp;
--
1.7.9.2

View File

@ -1,79 +0,0 @@
From 8824d0824d780d0fa503f9c9fbae46e45bbb18e7 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 19 Mar 2012 16:03:33 +0100
Subject: [PATCH 08/13] amixer, alsamixer: Add description of volume-mapping
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsamixer/alsamixer.1 | 13 +++++++++++++
amixer/amixer.1 | 17 +++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/alsamixer/alsamixer.1 b/alsamixer/alsamixer.1
index cd88404..8d34680 100644
--- a/alsamixer/alsamixer.1
+++ b/alsamixer/alsamixer.1
@@ -157,6 +157,19 @@ Quit the program with \fIALT Q\fP, or by hitting \fIESC\fP.
Please note that you might need to hit \fIESC\fP twice on some terminals
since it's regarded as a prefix key.
+.SH VOLUME MAPPING
+In \fBalsamixer\fP, the volume is mapped to a value that is more natural
+for a human ear. The mapping is designed so that the position in the
+interval is proportional to the volume as a human ear would perceive
+it, i.e. the position is the cubic root of the linear sample
+multiplication factor. For controls with a small range (24 dB or
+less), the mapping is linear in the dB values so that each step has
+the same size visually.
+
+Only for controls without dB information, a linear mapping of the
+hardware volume register values is used (this is the same algorithm as
+used in the old \fBalsamixer\fP).
+
.SH SEE ALSO
\fB
amixer(1),
diff --git a/amixer/amixer.1 b/amixer/amixer.1
index b1ac323..3ed20a9 100644
--- a/amixer/amixer.1
+++ b/amixer/amixer.1
@@ -104,10 +104,21 @@ The commands to unmatched ids are ignored without errors too.
.TP
\fI\-h\fP
Help: show syntax.
+
.TP
\fI\-q\fP
Quiet mode. Do not show results of changes.
+.TP
+\fI\-R\fP
+Use the raw value for evaluating the percentage representation.
+This is the default mode.
+
+.TP
+\fI\-M\fP
+Use the mapped volume for evaluating the percentage representation
+like \fBalsamixer\fR, to be more natural for human ear.
+
.SH EXAMPLES
.TP
@@ -134,8 +145,14 @@ will set the third soundcard's second line playback volume(s) to 40%
\fBamixer \-c 2 cset numid=34 40%\fR
will set the 34th soundcard element to 40%
+.SH SEE ALSO
+\fB
+alsamixer(1)
+\fP
+
.SH BUGS
None known.
+
.SH AUTHOR
\fBamixer\fP is by Jaroslav Kysela <perex@perex.cz>.
This document is by Paul Winkler <zarmzarm@erols.com> and Jaroslav Kysela <perex@perex.cz>.
--
1.7.9.2

View File

@ -1,113 +0,0 @@
From 3a25a31285ffb1dff0151c717b114fefc0b89b70 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Wed, 18 Apr 2012 10:25:54 -0400
Subject: [PATCH 09/13] configure.in: look for ncurses pkg-config first
Newer ncurses installs pkg-config files, and these are much easier
to manage when cross-compiling, so default to searching for those.
If they can't be found, we fall back to the existing xxx-config.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
configure.in | 64 +++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 41 insertions(+), 23 deletions(-)
diff --git a/configure.in b/configure.in
index 2208a95..9404df0 100644
--- a/configure.in
+++ b/configure.in
@@ -29,6 +29,7 @@ AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_LN_S
AC_PROG_SED
+PKG_PROG_PKG_CONFIG
AM_PATH_ALSA(1.0.24)
AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
, [AC_ERROR([No user enum control support in alsa-lib])])
@@ -130,34 +131,52 @@ if test x$alsamixer = xtrue; then
NCURSESLIBSUFFIX=""
CURSES_NLS="no"
if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
- AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
- if test "$ncursesw5_config" = "yes"; then
- CURSESINC="<ncurses.h>"
- CURSESLIB=`ncursesw5-config --libs`
- CURSESLIBDIR=`ncursesw5-config --libdir`
- CURSES_CFLAGS=`ncursesw5-config --cflags`
- curseslib="ncursesw"
- else
- AC_CHECK_LIB(ncursesw, initscr,
- [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
- fi
+ dnl First try out pkg-config, then fall back to old config scripts.
+ PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
+ CURSESINC="<ncurses.h>"
+ CURSESLIB="${NCURSESW_LIBS}"
+ CURSESLIBDIR=
+ CURSES_CFLAGS="${NCURSESW_CFLAGS}"
+ curseslib="ncursesw"
+ ], [
+ AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
+ if test "$ncursesw5_config" = "yes"; then
+ CURSESINC="<ncurses.h>"
+ CURSESLIB=`ncursesw5-config --libs`
+ CURSESLIBDIR=`ncursesw5-config --libdir`
+ CURSES_CFLAGS=`ncursesw5-config --cflags`
+ curseslib="ncursesw"
+ else
+ AC_CHECK_LIB(ncursesw, initscr,
+ [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
+ fi
+ ])
if test -n "$CURSESINC"; then
NCURSESLIBSUFFIX="w"
CURSES_NLS="yes"
fi
fi
if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
- AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
- if test "$ncurses5_config" = "yes"; then
- CURSESINC="<ncurses.h>"
- CURSESLIB=`ncurses5-config --libs`
- CURSESLIBDIR=`ncurses5-config --libdir`
- CURSES_CFLAGS=`ncurses5-config --cflags`
- curseslib="ncurses"
- else
- AC_CHECK_LIB(ncurses, initscr,
- [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
- fi
+ dnl First try out pkg-config, then fall back to old config scripts.
+ PKG_CHECK_MODULES([NCURSES], [ncurses], [
+ CURSESINC="<ncurses.h>"
+ CURSESLIB="${NCURSES_LIBS}"
+ CURSESLIBDIR=
+ CURSES_CFLAGS="${NCURSES_CFLAGS}"
+ curseslib="ncurses"
+ ], [
+ AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
+ if test "$ncurses5_config" = "yes"; then
+ CURSESINC="<ncurses.h>"
+ CURSESLIB=`ncurses5-config --libs`
+ CURSESLIBDIR=`ncurses5-config --libdir`
+ CURSES_CFLAGS=`ncurses5-config --cflags`
+ curseslib="ncurses"
+ else
+ AC_CHECK_LIB(ncurses, initscr,
+ [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
+ fi
+ ])
fi
if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
AC_CHECK_LIB(curses, initscr,
@@ -287,7 +306,6 @@ SAVE_UTIL_VERSION
AC_SUBST(LIBRT)
dnl Check for systemd
-PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
--
1.7.9.2

View File

@ -1,65 +0,0 @@
From 05d3bed5cd2fc5ee494766af735f4edd0106167d Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Wed, 18 Apr 2012 10:29:18 -0400
Subject: [PATCH 10/13] configure.in: use AS_HELP_STRING everywhere
This macro takes care of spacing for us.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
configure.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/configure.in b/configure.in
index 9404df0..e7bb4ca 100644
--- a/configure.in
+++ b/configure.in
@@ -76,7 +76,7 @@ CURSES_CFLAGS=""
alsamixer=
if test "$have_mixer" = "yes"; then
AC_ARG_ENABLE(alsamixer,
- [ --disable-alsamixer Disable alsamixer compilation],
+ AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]),
[case "${enableval}" in
yes) alsamixer=true ;;
no) alsamixer=false ;;
@@ -87,7 +87,7 @@ AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
dnl Disable alsaconf
AC_ARG_ENABLE(alsaconf,
- [ --disable-alsaconf Disable alsaconf packaging],
+ AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]),
[case "${enableval}" in
yes) alsaconf=true ;;
no) alsaconf=false ;;
@@ -97,7 +97,7 @@ AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
dnl Disable alsaloop
AC_ARG_ENABLE(alsaloop,
- [ --disable-alsaloop Disable alsaloop packaging],
+ AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]),
[case "${enableval}" in
yes) alsaloop=true ;;
no) alsaloop=false ;;
@@ -124,7 +124,7 @@ dnl Checks for header files.
AC_HEADER_STDC
if test x$alsamixer = xtrue; then
AC_ARG_WITH(curses,
- [ --with-curses libname Specify the curses library to use (default=auto)],
+ AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]),
curseslib="$withval",
curseslib="auto")
CURSESLIBDIR=""
@@ -283,7 +283,7 @@ mydatadir="$dir/alsa"
AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
AC_ARG_WITH(testsound,
- [ --with-testsound=file give the path of test sound file for alsaconf],
+ AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]),
TESTSOUND="$withval",
TESTSOUND="$dir/test.wav")
AC_SUBST(TESTSOUND)
--
1.7.9.2

View File

@ -1,49 +0,0 @@
From f7eb87ddc7787e981e6055c9e6f770fc0cd2359a Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 9 May 2012 08:45:47 +0200
Subject: [PATCH 11/13] alsactl: Do not access other cards than specified for
init
When the global state does not exist, alsactl tries to
initialize all soundcards. It is not good when alsactl
is called multiple times from udev. Also, selinux can deny
access to non-existent devices.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsactl/state.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/alsactl/state.c b/alsactl/state.c
index a8b5bd3..fec000d 100644
--- a/alsactl/state.c
+++ b/alsactl/state.c
@@ -1646,13 +1646,23 @@ int load_state(const char *file, const char *initfile, const char *cardname,
error("Cannot open %s for reading: %s", file, snd_strerror(err));
finalerr = err;
- card = -1;
+ if (cardname) {
+ card = snd_card_get_index(cardname);
+ if (card < 0) {
+ error("Cannot find soundcard '%s'...", cardname);
+ return -ENODEV;
+ }
+ goto single;
+ } else {
+ card = -1;
+ }
/* find each installed soundcards */
- while (1) {
+ while (!cardname) {
if (snd_card_next(&card) < 0)
break;
if (card < 0)
break;
+single:
first = 0;
if (!do_init)
break;
--
1.7.9.2

View File

@ -1,66 +0,0 @@
From 6bbeb78dba60ffae7d6ef7e6c24de03104420d29 Mon Sep 17 00:00:00 2001
From: Jerome Carretero <cJ@zougloub.eu>
Date: Sat, 5 May 2012 23:10:01 -0400
Subject: [PATCH 12/13] aplay: print vu-meter to stderr, not stdout
It allows showing the vu-meter while recording to stdout, eg:
aplay -C -V stereo | oggenc - > out.ogg
Signed-off-by: Jerome Carretero <cJ@zougloub.eu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 1ce34c4..8462484 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1453,9 +1453,9 @@ static void print_vu_meter_mono(int perc, int maxperc)
sprintf(line + val, "| MAX");
else
sprintf(line + val, "| %02i%%", maxperc);
- fputs(line, stdout);
+ fputs(line, stderr);
if (perc > 100)
- printf(_(" !clip "));
+ fprintf(stderr, _(" !clip "));
}
static void print_vu_meter_stereo(int *perc, int *maxperc)
@@ -1493,7 +1493,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc)
memcpy(line + bar_length, tmp, 3);
}
line[bar_length * 2 + 6 + 2] = 0;
- fputs(line, stdout);
+ fputs(line, stderr);
}
static void print_vu_meter(signed int *perc, signed int *maxperc)
@@ -1631,9 +1631,9 @@ static void compute_max_peak(u_char *data, size_t count)
if (perc[c] > maxperc[c])
maxperc[c] = perc[c];
- putchar('\r');
+ putc('\r', stderr);
print_vu_meter(perc, maxperc);
- fflush(stdout);
+ fflush(stderr);
}
else if(verbose==3) {
printf(_("Max peak (%li samples): 0x%08x "), (long)ocount, max_peak[0]);
@@ -1642,8 +1642,8 @@ static void compute_max_peak(u_char *data, size_t count)
putchar('#');
else
putchar(' ');
- printf(" %i%%\n", perc[0]);
- fflush(stdout);
+ fprintf(stderr, " %i%%\n", perc[0]);
+ fflush(stderr);
}
}
--
1.7.9.2

View File

@ -1,37 +0,0 @@
From b72e221aab77229f5195c15b1675de8e52db3cb0 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sun, 13 May 2012 13:24:01 +0200
Subject: [PATCH 13/13] alsaloop: fix the avail_min setup
The previous code does not work as expected for some period_size
configurations. We do not rely on the period size value, so do not
correlate the avail_min parameter with this value.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/pcmjob.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
index c9b120f..139b6fd 100644
--- a/alsaloop/pcmjob.c
+++ b/alsaloop/pcmjob.c
@@ -246,15 +246,11 @@ static int setparams_set(struct loopback_handle *lhandle,
} else {
if (lhandle == lhandle->loopback->play) {
val = bufsize + bufsize / 2;
- if (val < (period_size * 3) / 4)
- val = (period_size * 3) / 4;
if (val > (buffer_size * 3) / 4)
val = (buffer_size * 3) / 4;
val = buffer_size - val;
} else {
val = bufsize / 2;
- if (val < period_size / 2)
- val = period_size / 2;
if (val > buffer_size / 4)
val = buffer_size / 4;
}
--
1.7.9.2

View File

@ -1,117 +0,0 @@
From c68a3d02d161ccb6358620fb6442bc5c194f20f1 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 14 Jun 2012 13:14:48 +0200
Subject: [PATCH 14/15] alsactl: Read only *.conf files when a directory is
passed via INCLUDE
When alsactl init is invoked and a directory path is passed to INCLUDE
command in the config file, read only *.conf files in that directory.
This will avoid reading backup files or invalid files that have been
created accidentally.
Also by using scandir() with alphasort(), alsactl reads the files in
alphabetical order. Thus it's highly recommended to use some number
prefix to the file name for assuring the order.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsactl/alsactl_init.xml | 10 +++++++++-
alsactl/init_parse.c | 35 +++++++++++++++++++++++++----------
2 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/alsactl/alsactl_init.xml b/alsactl/alsactl_init.xml
index eefe9ef..bce26f5 100644
--- a/alsactl/alsactl_init.xml
+++ b/alsactl/alsactl_init.xml
@@ -474,7 +474,15 @@
<varlistentry>
<term><option>INCLUDE</option></term>
<listitem>
- <para>Include specified filename or all files in specified directory</para>
+ <para>Include the specified filename or files in specified directory.
+ </para>
+ <para>
+ When a directory is specified, only the files with the
+ extension ".conf" are read.
+ Also they are read in the alphabetical order.
+ Thus it's highly recommended to use some number prefix
+ (e.g. "01-something.conf") to assure the order of execucions.
+ </para>
</listitem>
</varlistentry>
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
index 51b515c..8a7173b 100644
--- a/alsactl/init_parse.c
+++ b/alsactl/init_parse.c
@@ -1278,6 +1278,13 @@ static char *new_root_dir(const char *filename)
return res;
}
+/* return non-zero if the file name has the extension ".conf" */
+static int conf_name_filter(const struct dirent *d)
+{
+ char *ext = strrchr(d->d_name, '.');
+ return ext && !strcmp(ext, ".conf");
+}
+
static int parse_line(struct space *space, char *line, size_t linesize)
{
char *linepos;
@@ -1480,8 +1487,7 @@ static int parse_line(struct space *space, char *line, size_t linesize)
if (strcasecmp(key, "INCLUDE") == 0) {
char *rootdir, *go_to;
const char *filename;
- struct dirent *dirent;
- DIR *dir;
+ struct stat st;
int linenum;
if (op != KEY_OP_ASSIGN) {
Perror(space, "invalid INCLUDE operation");
@@ -1498,18 +1504,27 @@ static int parse_line(struct space *space, char *line, size_t linesize)
go_to = space->go_to;
filename = space->filename;
linenum = space->linenum;
- dir = opendir(string);
- if (dir) {
+ if (stat(string, &st)) {
+ Perror(space, "invalid filename '%s'", string);
+ continue;
+ }
+ if (S_ISDIR(st.st_mode)) {
+ struct dirent **list;
+ int i, num;
+ num = scandir(string, &list, conf_name_filter,
+ alphasort);
+ if (num < 0) {
+ Perror(space, "invalid directory '%s'", string);
+ continue;
+ }
count = strlen(string);
- while ((dirent = readdir(dir)) != NULL) {
- if (strcmp(dirent->d_name, ".") == 0 ||
- strcmp(dirent->d_name, "..") == 0)
- continue;
+ for (i = 0; i < num; i++) {
string[count] = '\0';
strlcat(string, "/", sizeof(string));
- strlcat(string, dirent->d_name, sizeof(string));
+ strlcat(string, list[i]->d_name, sizeof(string));
space->go_to = NULL;
space->rootdir = new_root_dir(string);
+ free(list[i]);
if (space->rootdir) {
err = parse(space, string);
free(space->rootdir);
@@ -1522,7 +1537,7 @@ static int parse_line(struct space *space, char *line, size_t linesize)
if (err)
break;
}
- closedir(dir);
+ free(list);
} else {
space->go_to = NULL;
space->rootdir = new_root_dir(string);
--
1.7.10.4

View File

@ -1,28 +0,0 @@
From c3111571dc6a45e20c79a2c4fa590101d35db822 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 14 Jun 2012 16:14:29 +0200
Subject: [PATCH 15/15] alsactl: Add reference to alsactl_init(7) in alsactl
man page
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsactl/alsactl.1 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1
index eb5968c..054f511 100644
--- a/alsactl/alsactl.1
+++ b/alsactl/alsactl.1
@@ -107,7 +107,8 @@ routing options, etc).
\fB
amixer(1),
alsamixer(1),
-aplay(1)
+aplay(1),
+alsactl_init(7)
\fP
.SH BUGS
--
1.7.10.4

View File

@ -1,23 +0,0 @@
From 2b31992c799488c5a93bfe0b17d64b5196b122b4 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 15 Jun 2012 16:34:55 +0200
Subject: [PATCH] aseqnet: Remove obsoleted .LO entry from man page
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
seq/aseqnet/aseqnet.1 | 1 -
1 file changed, 1 deletion(-)
diff --git a/seq/aseqnet/aseqnet.1 b/seq/aseqnet/aseqnet.1
index a1dc1d3..2cb6eb7 100644
--- a/seq/aseqnet/aseqnet.1
+++ b/seq/aseqnet/aseqnet.1
@@ -1,5 +1,4 @@
.TH aseqnet 1 "January 1, 2000"
-.LO 1
.SH NAME
aseqnet \- ALSA sequencer connectors over network
--
1.7.10.4

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e676a2f634bbfe279b260e10a96f617cb72ee63c5bbf6c5f96bb615705b302c
size 1132780

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f85f2a3aa6e78475bbe35b0cad3a8cabb99f45ebc5f37962f2137b8df8b081e7
size 1134474

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Sep 10 15:24:42 CEST 2012 - tiwai@suse.de
- Updated to version 1.0.26; including previous fixes
-------------------------------------------------------------------
Wed Jun 20 18:19:21 CEST 2012 - tiwai@suse.de

View File

@ -31,7 +31,7 @@ BuildRequires: automake
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: xmlto
%define package_version 1.0.25
%define package_version 1.0.26
Provides: alsa-conf
Requires: alsa
Requires: dialog
@ -39,26 +39,11 @@ Requires: pciutils
Summary: Advanced Linux Sound Architecture Utilities
License: GPL-2.0+
Group: Productivity/Multimedia/Sound/Players
Version: 1.0.25
Version: 1.0.26
Release: 0
Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{package_version}.tar.bz2
Source1: 01beep.conf
# Patch: alsa-utils-git-fixes.diff
Patch1: 0001-Fix-the-examples-in-aplay.1.patch
Patch2: 0002-Trivial-fixes-in-INSTALL-file.patch
Patch4: 0004-alsaloop-Improve-xrun_sync-fill-missing-playback-sam.patch
Patch5: 0005-aplay-option-to-dump-HW-parameters.patch
Patch6: 0006-amixer-Add-the-support-for-mapped-volumes-like-alsam.patch
Patch7: 0007-aplay-arecord-option-to-treat-any-xrun-as-fatal.patch
Patch8: 0008-amixer-alsamixer-Add-description-of-volume-mapping.patch
Patch9: 0009-configure.in-look-for-ncurses-pkg-config-first.patch
Patch10: 0010-configure.in-use-AS_HELP_STRING-everywhere.patch
Patch11: 0011-alsactl-Do-not-access-other-cards-than-specified-for.patch
Patch12: 0012-aplay-print-vu-meter-to-stderr-not-stdout.patch
Patch13: 0013-alsaloop-fix-the-avail_min-setup.patch
Patch14: 0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch
Patch15: 0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch
Patch16: 0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch
Patch99: alsa-utils-gettext-version-removal.diff
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -73,21 +58,6 @@ Sound Architecture.
sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
# rm -f po/Makefile* po/*.gmo po/*.pot po/*.header po/stamp-*
# patch -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%if %suse_version < 1020
%patch99 -p1
%endif