forked from pool/alsa-utils
This commit is contained in:
parent
4bf5fa344e
commit
f8af080f33
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1f4924f5ae7857ce64a3d6ecbeb98133c74ff1ead2b0f48187623d6e4b838cad
|
||||
size 1040697
|
3
alsa-utils-1.0.20.tar.bz2
Normal file
3
alsa-utils-1.0.20.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:07f08286b3860f60d1794cc0de4407a53adcd4b6f065531d6dcef02b0c56a0cf
|
||||
size 1044483
|
@ -1,692 +0,0 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 554617d..5296977 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -1,16 +1,25 @@
|
||||
INCLUDES=-I$(top_srcdir)/include
|
||||
+
|
||||
+SUBDIRS = include alsactl utils m4 po
|
||||
if ALSAMIXER
|
||||
-ALSAMIXER_DIR=alsamixer
|
||||
-else
|
||||
-ALSAMIXER_DIR=
|
||||
+SUBDIRS += alsamixer
|
||||
+endif
|
||||
+if HAVE_MIXER
|
||||
+SUBDIRS += amixer
|
||||
+endif
|
||||
+if HAVE_RAWMIDI
|
||||
+SUBDIRS += amidi
|
||||
endif
|
||||
if ALSACONF
|
||||
-ALSACONF_DIR=alsaconf
|
||||
-else
|
||||
-ALSACONF_DIR=
|
||||
+SUBDIRS += alsaconf
|
||||
endif
|
||||
-SUBDIRS= include alsactl $(ALSACONF_DIR) $(ALSAMIXER_DIR) amidi amixer \
|
||||
- aplay iecset seq speaker-test utils m4 po
|
||||
+if HAVE_PCM
|
||||
+SUBDIRS += aplay iecset speaker-test
|
||||
+endif
|
||||
+if HAVE_SEQ
|
||||
+SUBDIRS += seq
|
||||
+endif
|
||||
+
|
||||
EXTRA_DIST= TODO gitcompile
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
diff --git a/alsaconf/alsaconf.in b/alsaconf/alsaconf.in
|
||||
index 6e9ff75..ccc1b37 100644
|
||||
--- a/alsaconf/alsaconf.in
|
||||
+++ b/alsaconf/alsaconf.in
|
||||
@@ -291,6 +291,8 @@ esac
|
||||
|
||||
# cfgfile = base config file to remove/update the sound setting
|
||||
# cfgout = new config file to write the sound setting (if different from $cfgfile)
|
||||
+cfgout=""
|
||||
+cfgoldout=""
|
||||
if [ -n "$cfgfile" ]; then
|
||||
if [ ! -r "$cfgfile" ]; then
|
||||
xecho "ERROR: The config file doesn't exist: "
|
||||
@@ -301,10 +303,22 @@ else
|
||||
if [ "$distribution" = "gentoo" ]; then
|
||||
cfgfile="/etc/modules.d/alsa"
|
||||
elif [ "$kernel" = "new" ]; then
|
||||
+ cfgfile="/etc/modprobe.conf"
|
||||
if [ -d /etc/modprobe.d ]; then
|
||||
- cfgout="/etc/modprobe.d/sound"
|
||||
+ cfgout="/etc/modprobe.d/50-sound.conf"
|
||||
+ cfgoldout="/etc/modprobe.d/sound"
|
||||
+ if [ ! -f $cfgout ]; then
|
||||
+ modver=$(modprobe -V | sed -e's/^module-init-tools version //')
|
||||
+ case "$modver" in
|
||||
+ 3.[789]*)
|
||||
+ ;;
|
||||
+ *)
|
||||
+ cfgout="/etc/modprobe.d/sound"
|
||||
+ cfgoldout=""
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
fi
|
||||
- cfgfile="/etc/modprobe.conf"
|
||||
elif [ "$distribution" = "debian" ]; then
|
||||
cfgfile="/etc/modutils/sound"
|
||||
elif [ -e /etc/modules.conf ]; then
|
||||
@@ -818,7 +832,7 @@ ac_config_card () {
|
||||
msg=$(xmsg "
|
||||
Configuring %s
|
||||
Do you want to modify %s (and %s if present)?" $CARD_DRIVER $cfgout $cfgfile)
|
||||
- $DIALOG --yesno "$msg" 8 50 || acex 0
|
||||
+ $DIALOG --yesno "$msg" 10 50 || acex 0
|
||||
else
|
||||
msg=$(xmsg "
|
||||
Configuring %s
|
||||
@@ -875,6 +889,7 @@ alias sound-slot-0 $CARD_DRIVER" >> $addcfg
|
||||
if [ -n "$cfgout" ]; then
|
||||
[ ! -r "$cfgfile" ] || cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile"
|
||||
cmp -s "$addcfg" "$cfgout" || cat "$addcfg" > "$cfgout"
|
||||
+ test -n "$cfgoldout" && rm -f "$cfgoldout"
|
||||
else
|
||||
echo "$ACB
|
||||
# --- ALSACONF version $version ---" >> $TMP
|
||||
diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c
|
||||
index e0bc276..02e082f 100644
|
||||
--- a/alsactl/alsactl.c
|
||||
+++ b/alsactl/alsactl.c
|
||||
@@ -97,7 +97,8 @@ int main(int argc, char *argv[])
|
||||
};
|
||||
char *cfgfile = SYS_ASOUNDRC;
|
||||
char *initfile = DATADIR "/init/00main";
|
||||
- char *cardname, **tmp, ncardname[16];
|
||||
+ char *cardname, ncardname[16];
|
||||
+ const char *const *tmp;
|
||||
int removestate = 0;
|
||||
int init_fallback = 1; /* new default behavior */
|
||||
int res;
|
||||
@@ -106,7 +107,7 @@ int main(int argc, char *argv[])
|
||||
while (1) {
|
||||
int c;
|
||||
|
||||
- if ((c = getopt_long(argc, argv, "hdvf:FgE:i:Pr:R", long_option, NULL)) < 0)
|
||||
+ if ((c = getopt_long(argc, argv, "hdvf:FgE:i:IPr:R", long_option, NULL)) < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'h':
|
||||
diff --git a/alsactl/init/default b/alsactl/init/default
|
||||
index 66692b3..e2dcfd6 100644
|
||||
--- a/alsactl/init/default
|
||||
+++ b/alsactl/init/default
|
||||
@@ -11,6 +11,7 @@
|
||||
# **************************************************************************
|
||||
|
||||
ENV{volume}:="-20dB"
|
||||
+ENV{cvolume}:="12dB"
|
||||
|
||||
CTL{reset}="mixer"
|
||||
CTL{name}="Playback Volume",PROGRAM=="__ctl_search", \
|
||||
@@ -55,14 +56,21 @@ CTL{name}="PC Speaker Playback Switch",PROGRAM=="__ctl_search", \
|
||||
CTL{values}="on"
|
||||
|
||||
CTL{reset}="mixer"
|
||||
-CTL{name}="PCM Playback Volume",PROGRAM=="__ctl_search", \
|
||||
- CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+CTL{name}="PCM Playback Volume",PROGRAM!="__ctl_search",GOTO="pcm0_end"
|
||||
+# exception - some HDA codecs have shifted dB range
|
||||
+CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{values}="0dB",GOTO="pcm0_end"
|
||||
+CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+LABEL="pcm0_end"
|
||||
CTL{name}="PCM Playback Switch",PROGRAM=="__ctl_search", \
|
||||
CTL{values}="on"
|
||||
|
||||
CTL{reset}="mixer"
|
||||
-CTL{name}="PCM Playback Volume",CTL{index}="1",PROGRAM=="__ctl_search", \
|
||||
- CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+CTL{name}="PCM Playback Volume",CTL{index}="1",PROGRAM!="__ctl_search", \
|
||||
+ GOTO="pcm1_end"
|
||||
+# exception - some HDA codecs have shifted dB range
|
||||
+CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{values}="0dB",GOTO="pcm1_end"
|
||||
+CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+LABEL="pcm1_end"
|
||||
CTL{name}="PCM Playback Switch",CTL{index}="1",PROGRAM=="__ctl_search", \
|
||||
CTL{values}="on"
|
||||
|
||||
@@ -91,8 +99,11 @@ CTL{name}="Music Playback Switch",PROGRAM=="__ctl_search", \
|
||||
CTL{values}="on"
|
||||
|
||||
CTL{reset}="mixer"
|
||||
-CTL{name}="CD Playback Volume",PROGRAM=="__ctl_search", \
|
||||
- CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+CTL{name}="CD Playback Volume",PROGRAM!="__ctl_search", GOTO="cd0_end"
|
||||
+# exception - some HDA codecs have shifted dB range
|
||||
+CTL{dBmin}=="-34.50dB",CTL{dBmax}=="12.00dB",CTL{values}="0dB",GOTO="cd0_end"
|
||||
+CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+LABEL="cd0_end"
|
||||
CTL{name}="CD Playback Switch",PROGRAM=="__ctl_search", \
|
||||
CTL{values}="on"
|
||||
|
||||
@@ -130,15 +141,14 @@ ENV{volume}:="20dB"
|
||||
|
||||
CTL{reset}="mixer"
|
||||
CTL{name}="Capture Volume",PROGRAM=="__ctl_search", \
|
||||
- CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
|
||||
+ CTL{values}="$env{cvolume}",RESULT!="0",CTL{values}="75%"
|
||||
CTL{name}="Capture Switch",PROGRAM=="__ctl_search", \
|
||||
CTL{values}="on"
|
||||
|
||||
-CTL{name}="Input Source",PROGRAM=="__ctl_search", \
|
||||
- CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", \
|
||||
+CTL{name}="Input Source",PROGRAM!="__ctl_search", GOTO="end_input_source"
|
||||
+CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", \
|
||||
GOTO="end_input_source"
|
||||
-CTL{name}="Input Source",PROGRAM=="__ctl_search", \
|
||||
- CTL{enums}=="*|Mic|*",CTL{values}="Mic"
|
||||
+CTL{enums}=="*|Mic|*",CTL{values}="Mic"
|
||||
LABEL="end_input_source"
|
||||
|
||||
CTL{name}="Internal Mic Boost",PROGRAM=="__ctl_search", \
|
||||
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
|
||||
index 31ed56e..335cb06 100644
|
||||
--- a/alsactl/init_parse.c
|
||||
+++ b/alsactl/init_parse.c
|
||||
@@ -381,7 +381,7 @@ static int set_ctl_value(struct space *space, const char *value, int all)
|
||||
snd_ctl_elem_value_set_integer(space->ctl_value, idx, val);
|
||||
} else if (items > 2 && value[items-2] == 'd' && value[items-1] == 'B') {
|
||||
val = strtol(value, NULL, 0) * 100;
|
||||
- if ((pos2 = index(value, '.')) != NULL) {
|
||||
+ if ((pos2 = strchr(value, '.')) != NULL) {
|
||||
if (isdigit(*(pos2-1)) && isdigit(*(pos2-2))) {
|
||||
if (val < 0)
|
||||
val -= strtol(pos2 + 1, NULL, 0);
|
||||
@@ -396,7 +396,7 @@ static int set_ctl_value(struct space *space, const char *value, int all)
|
||||
}
|
||||
val = snd_ctl_convert_from_dB(snd_hctl_ctl(space->ctl_handle), space->ctl_id, val, &lval, -1);
|
||||
if (val < 0) {
|
||||
- Perror(space, "unable to convert dB value '%s' to internal integer range", value);
|
||||
+ dbg("unable to convert dB value '%s' to internal integer range", value);
|
||||
return val;
|
||||
}
|
||||
snd_ctl_elem_value_set_integer(space->ctl_value, idx, lval);
|
||||
@@ -1253,7 +1253,7 @@ static char *new_root_dir(const char *filename)
|
||||
|
||||
res = strdup(filename);
|
||||
if (res) {
|
||||
- tmp = rindex(res, '/');
|
||||
+ tmp = strrchr(res, '/');
|
||||
if (tmp)
|
||||
*tmp = '\0';
|
||||
}
|
||||
@@ -1313,10 +1313,9 @@ static int parse_line(struct space *space, char *line, size_t linesize)
|
||||
}
|
||||
snprintf(string, sizeof(string), "%i", err);
|
||||
space->program_result = strdup(string);
|
||||
- if (err < 0 || space->program_result == NULL) {
|
||||
- err = 0;
|
||||
+ err = 0;
|
||||
+ if (space->program_result == NULL)
|
||||
break;
|
||||
- }
|
||||
} else if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
|
||||
dbg("ctl match: '%s' '%s'", value, attr);
|
||||
temp = (char *)elemid_get(space, attr);
|
||||
diff --git a/alsactl/init_utils_string.c b/alsactl/init_utils_string.c
|
||||
index 2598e9f..01ea800 100644
|
||||
--- a/alsactl/init_utils_string.c
|
||||
+++ b/alsactl/init_utils_string.c
|
||||
@@ -17,17 +17,6 @@
|
||||
*/
|
||||
|
||||
|
||||
-static int string_is_true(const char *str)
|
||||
-{
|
||||
- if (strcasecmp(str, "true") == 0)
|
||||
- return 1;
|
||||
- if (strcasecmp(str, "yes") == 0)
|
||||
- return 1;
|
||||
- if (strcasecmp(str, "1") == 0)
|
||||
- return 1;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static void remove_trailing_chars(char *path, char c)
|
||||
{
|
||||
size_t len;
|
||||
diff --git a/alsamixer/alsamixer.c b/alsamixer/alsamixer.c
|
||||
index 414033e..c65c22d 100644
|
||||
--- a/alsamixer/alsamixer.c
|
||||
+++ b/alsamixer/alsamixer.c
|
||||
@@ -2113,11 +2113,13 @@ mixer_iteration (void)
|
||||
mixer_hscroll_delta -= 1;
|
||||
break;
|
||||
case KEY_UP:
|
||||
+ case 'k':
|
||||
case 'w':
|
||||
case 'W':
|
||||
mixer_vscroll_delta -= 1;
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
+ case 'j':
|
||||
case 'x':
|
||||
case 'X':
|
||||
mixer_vscroll_delta += 1;
|
||||
@@ -2179,12 +2181,14 @@ mixer_iteration (void)
|
||||
break;
|
||||
case 'w':
|
||||
case KEY_UP:
|
||||
+ case 'k':
|
||||
mixer_set_delta(1);
|
||||
case 'W':
|
||||
mixer_add_delta(1);
|
||||
break;
|
||||
case 'x':
|
||||
case KEY_DOWN:
|
||||
+ case 'j':
|
||||
mixer_set_delta(-1);
|
||||
case 'X':
|
||||
mixer_add_delta(-1);
|
||||
diff --git a/aplay/Makefile.am b/aplay/Makefile.am
|
||||
index 60811de..92323d1 100644
|
||||
--- a/aplay/Makefile.am
|
||||
+++ b/aplay/Makefile.am
|
||||
@@ -1,5 +1,7 @@
|
||||
+LIBRT = @LIBRT@
|
||||
+
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
-LDADD = $(LIBINTL)
|
||||
+LDADD = $(LIBINTL) $(LIBRT)
|
||||
|
||||
# debug flags
|
||||
#LDFLAGS = -static
|
||||
diff --git a/aplay/aplay.c b/aplay/aplay.c
|
||||
index 837e46a..c7c82a1 100644
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -101,12 +101,15 @@ static snd_pcm_uframes_t buffer_frames = 0;
|
||||
static int avail_min = -1;
|
||||
static int start_delay = 0;
|
||||
static int stop_delay = 0;
|
||||
+static int monotonic = 0;
|
||||
static int verbose = 0;
|
||||
static int vumeter = VUMETER_NONE;
|
||||
static int buffer_pos = 0;
|
||||
static size_t bits_per_sample, bits_per_frame;
|
||||
static size_t chunk_bytes;
|
||||
static int test_position = 0;
|
||||
+static int test_coef = 8;
|
||||
+static int test_nowait = 0;
|
||||
static snd_output_t *log;
|
||||
|
||||
static int fd = -1;
|
||||
@@ -188,7 +191,10 @@ _("Usage: %s [OPTION]... [FILE]...\n"
|
||||
" --disable-channels disable automatic channel conversions\n"
|
||||
" --disable-format disable automatic format conversions\n"
|
||||
" --disable-softvol disable software volume control (softvol)\n"
|
||||
-" --test-position test ring buffer position\n")
|
||||
+" --test-position test ring buffer position\n"
|
||||
+" --test-coef=# test coeficient for ring buffer position (default 8)\n"
|
||||
+" expression for validation is: coef * (buffer_size / 2)\n"
|
||||
+" --test-nowait do not wait for ring buffer - eats whole CPU\n")
|
||||
, command);
|
||||
printf(_("Recognized sample formats are:"));
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
|
||||
@@ -350,7 +356,9 @@ enum {
|
||||
OPT_DISABLE_CHANNELS,
|
||||
OPT_DISABLE_FORMAT,
|
||||
OPT_DISABLE_SOFTVOL,
|
||||
- OPT_TEST_POSITION
|
||||
+ OPT_TEST_POSITION,
|
||||
+ OPT_TEST_COEF,
|
||||
+ OPT_TEST_NOWAIT
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -389,6 +397,8 @@ int main(int argc, char *argv[])
|
||||
{"disable-format", 0, 0, OPT_DISABLE_FORMAT},
|
||||
{"disable-softvol", 0, 0, OPT_DISABLE_SOFTVOL},
|
||||
{"test-position", 0, 0, OPT_TEST_POSITION},
|
||||
+ {"test-coef", 1, 0, OPT_TEST_COEF},
|
||||
+ {"test-nowait", 0, 0, OPT_TEST_NOWAIT},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
char *pcm_name = "default";
|
||||
@@ -570,6 +580,14 @@ int main(int argc, char *argv[])
|
||||
case OPT_TEST_POSITION:
|
||||
test_position = 1;
|
||||
break;
|
||||
+ case OPT_TEST_COEF:
|
||||
+ test_coef = strtol(optarg, NULL, 0);
|
||||
+ if (test_coef < 1)
|
||||
+ test_coef = 1;
|
||||
+ break;
|
||||
+ case OPT_TEST_NOWAIT:
|
||||
+ test_nowait = 1;
|
||||
+ break;
|
||||
default:
|
||||
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
|
||||
return 1;
|
||||
@@ -1017,6 +1035,7 @@ static void set_params(void)
|
||||
&buffer_frames);
|
||||
}
|
||||
assert(err >= 0);
|
||||
+ monotonic = snd_pcm_hw_params_is_monotonic(params);
|
||||
err = snd_pcm_hw_params(handle, params);
|
||||
if (err < 0) {
|
||||
error(_("Unable to install hw params:"));
|
||||
@@ -1112,6 +1131,18 @@ do { \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
+#ifndef timermsub
|
||||
+#define timermsub(a, b, result) \
|
||||
+do { \
|
||||
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
||||
+ (result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec; \
|
||||
+ if ((result)->tv_nsec < 0) { \
|
||||
+ --(result)->tv_sec; \
|
||||
+ (result)->tv_nsec += 1000000000L; \
|
||||
+ } \
|
||||
+} while (0)
|
||||
+#endif
|
||||
+
|
||||
/* I/O error handler */
|
||||
static void xrun(void)
|
||||
{
|
||||
@@ -1124,13 +1155,27 @@ static void xrun(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
|
||||
- struct timeval now, diff, tstamp;
|
||||
- gettimeofday(&now, 0);
|
||||
- snd_pcm_status_get_trigger_tstamp(status, &tstamp);
|
||||
- timersub(&now, &tstamp, &diff);
|
||||
- fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"),
|
||||
- stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
|
||||
- diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
|
||||
+ if (monotonic) {
|
||||
+#ifdef HAVE_CLOCK_GETTIME
|
||||
+ struct timespec now, diff, tstamp;
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
+ snd_pcm_status_get_trigger_htstamp(status, &tstamp);
|
||||
+ timermsub(&now, &tstamp, &diff);
|
||||
+ fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"),
|
||||
+ stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
|
||||
+ diff.tv_sec * 1000 + diff.tv_nsec / 10000000.0);
|
||||
+#else
|
||||
+ fprintf(stderr, "%s !!!\n", _("underrun"));
|
||||
+#endif
|
||||
+ } else {
|
||||
+ struct timeval now, diff, tstamp;
|
||||
+ gettimeofday(&now, 0);
|
||||
+ snd_pcm_status_get_trigger_tstamp(status, &tstamp);
|
||||
+ timersub(&now, &tstamp, &diff);
|
||||
+ fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"),
|
||||
+ stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
|
||||
+ diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
|
||||
+ }
|
||||
if (verbose) {
|
||||
fprintf(stderr, _("Status:\n"));
|
||||
snd_pcm_status_dump(status, log);
|
||||
@@ -1396,20 +1441,60 @@ static void compute_max_peak(u_char *data, size_t count)
|
||||
|
||||
static void do_test_position(void)
|
||||
{
|
||||
- static int counter = 0;
|
||||
+ static long counter = 0;
|
||||
+ static time_t tmr = -1;
|
||||
+ time_t now;
|
||||
+ static float availsum, delaysum, samples;
|
||||
+ static snd_pcm_sframes_t maxavail, maxdelay;
|
||||
+ static snd_pcm_sframes_t minavail, mindelay;
|
||||
+ static snd_pcm_sframes_t badavail = 0, baddelay = 0;
|
||||
+ snd_pcm_sframes_t outofrange;
|
||||
snd_pcm_sframes_t avail, delay;
|
||||
int err;
|
||||
|
||||
err = snd_pcm_avail_delay(handle, &avail, &delay);
|
||||
if (err < 0)
|
||||
return;
|
||||
- if (avail > 4 * (snd_pcm_sframes_t)buffer_frames ||
|
||||
- avail < -4 * (snd_pcm_sframes_t)buffer_frames ||
|
||||
- delay > 4 * (snd_pcm_sframes_t)buffer_frames ||
|
||||
- delay < -4 * (snd_pcm_sframes_t)buffer_frames) {
|
||||
- fprintf(stderr, "Suspicious buffer position (%i total): avail = %li, delay = %li, buffer = %li\n", ++counter, (long)avail, (long)delay, (long)buffer_frames);
|
||||
+ outofrange = (test_coef * (snd_pcm_sframes_t)buffer_frames) / 2;
|
||||
+ if (avail > outofrange || avail < -outofrange ||
|
||||
+ delay > outofrange || delay < -outofrange) {
|
||||
+ badavail = avail; baddelay = delay;
|
||||
+ availsum = delaysum = samples = 0;
|
||||
+ maxavail = maxdelay = 0;
|
||||
+ minavail = mindelay = buffer_frames * 16;
|
||||
+ fprintf(stderr, _("Suspicious buffer position (%li total): "
|
||||
+ "avail = %li, delay = %li, buffer = %li\n"),
|
||||
+ ++counter, (long)avail, (long)delay, (long)buffer_frames);
|
||||
} else if (verbose) {
|
||||
- fprintf(stderr, "Buffer position: %li/%li (%li)\n", (long)avail, (long)delay, (long)buffer_frames);
|
||||
+ time(&now);
|
||||
+ if (tmr == (time_t) -1) {
|
||||
+ tmr = now;
|
||||
+ availsum = delaysum = samples = 0;
|
||||
+ maxavail = maxdelay = 0;
|
||||
+ minavail = mindelay = buffer_frames * 16;
|
||||
+ }
|
||||
+ if (avail > maxavail)
|
||||
+ maxavail = avail;
|
||||
+ if (delay > maxdelay)
|
||||
+ maxdelay = delay;
|
||||
+ if (avail < minavail)
|
||||
+ minavail = avail;
|
||||
+ if (delay < mindelay)
|
||||
+ mindelay = delay;
|
||||
+ availsum += avail;
|
||||
+ delaysum += delay;
|
||||
+ samples++;
|
||||
+ if (avail != 0 && now != tmr) {
|
||||
+ fprintf(stderr, "BUFPOS: avg%li/%li "
|
||||
+ "min%li/%li max%li/%li (%li) (%li:%li/%li)\n",
|
||||
+ (long)(availsum / samples),
|
||||
+ (long)(delaysum / samples),
|
||||
+ (long)minavail, (long)mindelay,
|
||||
+ (long)maxavail, (long)maxdelay,
|
||||
+ (long)buffer_frames,
|
||||
+ counter, badavail, baddelay);
|
||||
+ tmr = now;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1433,7 +1518,8 @@ static ssize_t pcm_write(u_char *data, size_t count)
|
||||
if (test_position)
|
||||
do_test_position();
|
||||
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
|
||||
- snd_pcm_wait(handle, 1000);
|
||||
+ if (!test_nowait)
|
||||
+ snd_pcm_wait(handle, 1000);
|
||||
} else if (r == -EPIPE) {
|
||||
xrun();
|
||||
} else if (r == -ESTRPIPE) {
|
||||
@@ -1478,7 +1564,8 @@ static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count)
|
||||
if (test_position)
|
||||
do_test_position();
|
||||
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
|
||||
- snd_pcm_wait(handle, 1000);
|
||||
+ if (!test_nowait)
|
||||
+ snd_pcm_wait(handle, 1000);
|
||||
} else if (r == -EPIPE) {
|
||||
xrun();
|
||||
} else if (r == -ESTRPIPE) {
|
||||
@@ -1520,7 +1607,8 @@ static ssize_t pcm_read(u_char *data, size_t rcount)
|
||||
if (test_position)
|
||||
do_test_position();
|
||||
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
|
||||
- snd_pcm_wait(handle, 1000);
|
||||
+ if (!test_nowait)
|
||||
+ snd_pcm_wait(handle, 1000);
|
||||
} else if (r == -EPIPE) {
|
||||
xrun();
|
||||
} else if (r == -ESTRPIPE) {
|
||||
@@ -1562,7 +1650,8 @@ static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount)
|
||||
if (test_position)
|
||||
do_test_position();
|
||||
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
|
||||
- snd_pcm_wait(handle, 1000);
|
||||
+ if (!test_nowait)
|
||||
+ snd_pcm_wait(handle, 1000);
|
||||
} else if (r == -EPIPE) {
|
||||
xrun();
|
||||
} else if (r == -ESTRPIPE) {
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 59247ed..d26ae65 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -29,10 +29,44 @@ AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AM_PATH_ALSA(1.0.16)
|
||||
|
||||
+dnl Check components
|
||||
+AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
|
||||
+ [#include <alsa/asoundlib.h>])
|
||||
+AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"],
|
||||
+ [#include <alsa/asoundlib.h>])
|
||||
+AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"],
|
||||
+ [#include <alsa/asoundlib.h>])
|
||||
+AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
|
||||
+ [#include <alsa/asoundlib.h>])
|
||||
+
|
||||
+AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes")
|
||||
+AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
|
||||
+AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
|
||||
+AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
|
||||
+
|
||||
+dnl Check for librt
|
||||
+LIBRT=""
|
||||
+AC_MSG_CHECKING(for librt)
|
||||
+AC_ARG_WITH(librt,
|
||||
+ AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
|
||||
+ [ have_librt="$withval" ], [ have_librt="yes" ])
|
||||
+if test "$have_librt" = "yes"; then
|
||||
+ AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
|
||||
+ if test "$HAVE_LIBRT" = "yes" ; then
|
||||
+ LIBRT="-lrt"
|
||||
+ AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
|
||||
+ AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
|
||||
+ fi
|
||||
+else
|
||||
+ AC_MSG_RESULT(no)
|
||||
+fi
|
||||
+
|
||||
dnl Disable alsamixer
|
||||
CURSESINC=""
|
||||
CURSESLIB=""
|
||||
CURSES_CFLAGS=""
|
||||
+alsamixer=
|
||||
+if test "$have_mixer" = "yes"; then
|
||||
AC_ARG_ENABLE(alsamixer,
|
||||
[ --disable-alsamixer Disable alsamixer compilation],
|
||||
[case "${enableval}" in
|
||||
@@ -40,6 +74,7 @@ AC_ARG_ENABLE(alsamixer,
|
||||
no) alsamixer=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
|
||||
esac],[alsamixer=true])
|
||||
+fi
|
||||
AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
|
||||
|
||||
dnl Disable alsaconf
|
||||
@@ -142,6 +177,8 @@ AC_SYS_LARGEFILE
|
||||
|
||||
SAVE_UTIL_VERSION
|
||||
|
||||
+AC_SUBST(LIBRT)
|
||||
+
|
||||
AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
|
||||
alsamixer/Makefile amidi/Makefile amixer/Makefile \
|
||||
m4/Makefile po/Makefile.in \
|
||||
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
|
||||
index 75a4bed..63a7151 100644
|
||||
--- a/speaker-test/speaker-test.c
|
||||
+++ b/speaker-test/speaker-test.c
|
||||
@@ -85,48 +85,48 @@ static const char *given_test_wav_file = NULL;
|
||||
static char *wav_file_dir = SOUNDSDIR;
|
||||
|
||||
static const char *const channel_name[MAX_CHANNELS] = {
|
||||
- N_("Front Left"),
|
||||
- N_("Front Right"),
|
||||
- N_("Rear Left"),
|
||||
- N_("Rear Right"),
|
||||
- N_("Center"),
|
||||
- N_("LFE"),
|
||||
- N_("Side Left"),
|
||||
- N_("Side Right"),
|
||||
- N_("Channel 9"),
|
||||
- N_("Channel 10"),
|
||||
- N_("Channel 11"),
|
||||
- N_("Channel 12"),
|
||||
- N_("Channel 13"),
|
||||
- N_("Channel 14"),
|
||||
- N_("Channel 15"),
|
||||
- N_("Channel 16")
|
||||
+ /* 0 */ N_("Front Left"),
|
||||
+ /* 1 */ N_("Front Right"),
|
||||
+ /* 2 */ N_("Rear Left"),
|
||||
+ /* 3 */ N_("Rear Right"),
|
||||
+ /* 4 */ N_("Center"),
|
||||
+ /* 5 */ N_("LFE"),
|
||||
+ /* 6 */ N_("Side Left"),
|
||||
+ /* 7 */ N_("Side Right"),
|
||||
+ /* 8 */ N_("Channel 9"),
|
||||
+ /* 9 */ N_("Channel 10"),
|
||||
+ /* 10 */ N_("Channel 11"),
|
||||
+ /* 11 */ N_("Channel 12"),
|
||||
+ /* 12 */ N_("Channel 13"),
|
||||
+ /* 13 */ N_("Channel 14"),
|
||||
+ /* 14 */ N_("Channel 15"),
|
||||
+ /* 15 */ N_("Channel 16")
|
||||
};
|
||||
|
||||
static const int channels4[] = {
|
||||
- 0,
|
||||
- 1,
|
||||
- 3,
|
||||
- 2
|
||||
+ 0, /* Front Left */
|
||||
+ 1, /* Front Right */
|
||||
+ 3, /* Rear Right */
|
||||
+ 2, /* Rear Left */
|
||||
};
|
||||
static const int channels6[] = {
|
||||
- 0,
|
||||
- 4,
|
||||
- 1,
|
||||
- 3,
|
||||
- 2,
|
||||
- 5
|
||||
-};
|
||||
+ 0, /* Front Left */
|
||||
+ 4, /* Center */
|
||||
+ 1, /* Front Right */
|
||||
+ 3, /* Rear Right */
|
||||
+ 2, /* Rear Left */
|
||||
+ 5, /* LFE */
|
||||
+};
|
||||
static const int channels8[] = {
|
||||
- 0,
|
||||
- 4,
|
||||
- 1,
|
||||
- 7,
|
||||
- 3,
|
||||
- 2,
|
||||
- 6,
|
||||
- 5
|
||||
-};
|
||||
+ 0, /* Front Left */
|
||||
+ 4, /* Center */
|
||||
+ 1, /* Front Right */
|
||||
+ 7, /* Side Right */
|
||||
+ 3, /* Rear Right */
|
||||
+ 2, /* Rear Left */
|
||||
+ 6, /* Side Left */
|
||||
+ 5, /* LFE */
|
||||
+};
|
||||
|
||||
static void generate_sine(uint8_t *frames, int channel, int count, double *_phase) {
|
||||
double phase = *_phase;
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed May 6 18:07:23 CEST 2009 - tiwai@suse.de
|
||||
|
||||
- updated to version 1.0.20:
|
||||
* including previous patches
|
||||
* a few more fixes about alsactl init command
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 23 15:11:25 CEST 2009 - tiwai@suse.de
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package alsa-utils (Version 1.0.19)
|
||||
# spec file for package alsa-utils (Version 1.0.20)
|
||||
#
|
||||
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
@ -20,17 +20,17 @@
|
||||
|
||||
Name: alsa-utils
|
||||
BuildRequires: alsa-devel ncurses-devel xmlto
|
||||
%define package_version 1.0.19
|
||||
%define package_version 1.0.20
|
||||
License: GPL v2 or later
|
||||
Group: Productivity/Multimedia/Sound/Players
|
||||
Provides: alsa-conf
|
||||
Requires: dialog pciutils
|
||||
AutoReqProv: on
|
||||
Summary: Advanced Linux Sound Architecture Utilities
|
||||
Version: 1.0.19
|
||||
Release: 4
|
||||
Version: 1.0.20
|
||||
Release: 1
|
||||
Source: ftp://ftp.alsa-project.org/pub/util/alsa-utils-%{package_version}.tar.bz2
|
||||
Patch: alsa-utils-git-fixes.diff
|
||||
# Patch: alsa-utils-git-fixes.diff
|
||||
Url: http://www.alsa-project.org/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -48,8 +48,8 @@ Authors:
|
||||
%prep
|
||||
%setup -q -n %{name}-%{package_version}
|
||||
# fix stupid automake's automatic action
|
||||
sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
|
||||
%patch -p1
|
||||
# sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
|
||||
# %patch -p1
|
||||
mv alsamixer/README alsamixer/README-alsamixer
|
||||
|
||||
%build
|
||||
@ -78,6 +78,10 @@ make %{?jobs:-j %jobs}
|
||||
%{_datadir}/alsa
|
||||
|
||||
%changelog
|
||||
* Wed May 06 2009 tiwai@suse.de
|
||||
- updated to version 1.0.20:
|
||||
* including previous patches
|
||||
* a few more fixes about alsactl init command
|
||||
* Thu Apr 23 2009 tiwai@suse.de
|
||||
- updated as of 2009.04.23:
|
||||
* Added vi-like key bindings to alsamixer
|
||||
|
Loading…
Reference in New Issue
Block a user