forked from pool/alsa-utils
Accepting request 320430 from home:tiwai:branches:multimedia:libs
- Upstream patch to add -S option to speaker-test 0007-speaker-test-Add-option-to-specify-signal-scale.patch - Upstream patch to add alsatplg parser program 0008-topology-Add-command-line-topology-tool-to-build-top.patch - Reenable autoreconf call to regenerate after patching OBS-URL: https://build.opensuse.org/request/show/320430 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=121
This commit is contained in:
parent
b9117bca4b
commit
bf2d02fb21
164
0007-speaker-test-Add-option-to-specify-signal-scale.patch
Normal file
164
0007-speaker-test-Add-option-to-specify-signal-scale.patch
Normal file
@ -0,0 +1,164 @@
|
||||
From 791ae1c18016707ee046b430cf3cf0412276c744 Mon Sep 17 00:00:00 2001
|
||||
From: Julian Scheel <julian@jusst.de>
|
||||
Date: Tue, 30 Jun 2015 08:57:49 +0200
|
||||
Subject: [PATCH] speaker-test: Add option to specify signal scale
|
||||
|
||||
Allow generated signals (sine and noise) to have a specified signal scale
|
||||
instead of using hardcoded limits of 80%. This can be handy for debugging, ie
|
||||
when analysing clipping issues with audio drivers.
|
||||
|
||||
Signed-off-by: Julian Scheel <julian@jusst.de>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
speaker-test/speaker-test.c | 30 ++++++++++++++++++------------
|
||||
1 file changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
|
||||
index ccf2671725a3..25970af1c9bc 100644
|
||||
--- a/speaker-test/speaker-test.c
|
||||
+++ b/speaker-test/speaker-test.c
|
||||
@@ -100,6 +100,7 @@ static unsigned int period_time = 0; /* period time in us */
|
||||
static unsigned int nperiods = 4; /* number of periods */
|
||||
static double freq = 440.0; /* sinusoidal wave frequency in Hz */
|
||||
static int test_type = TEST_PINK_NOISE; /* Test type. 1 = noise, 2 = sine wave */
|
||||
+static float generator_scale = 0.8; /* Scale to use for sine volume */
|
||||
static pink_noise_t pink;
|
||||
static snd_pcm_uframes_t buffer_size;
|
||||
static snd_pcm_uframes_t period_size;
|
||||
@@ -306,7 +307,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
|
||||
switch (format) {
|
||||
case SND_PCM_FORMAT_S8:
|
||||
if (chn==channel) {
|
||||
- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff;
|
||||
ires = res;
|
||||
*samp8++ = ires >> 24;
|
||||
} else {
|
||||
@@ -315,7 +316,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
|
||||
break;
|
||||
case SND_PCM_FORMAT_S16_LE:
|
||||
if (chn==channel) {
|
||||
- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff;
|
||||
ires = res;
|
||||
*samp16++ = LE_SHORT(ires >> 16);
|
||||
} else {
|
||||
@@ -324,7 +325,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
|
||||
break;
|
||||
case SND_PCM_FORMAT_S16_BE:
|
||||
if (chn==channel) {
|
||||
- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff;
|
||||
ires = res;
|
||||
*samp16++ = BE_SHORT(ires >> 16);
|
||||
} else {
|
||||
@@ -333,7 +334,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
|
||||
break;
|
||||
case SND_PCM_FORMAT_FLOAT_LE:
|
||||
if (chn==channel) {
|
||||
- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0.75 ; /* Don't use MAX volume */
|
||||
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale;
|
||||
fres = res;
|
||||
*samp_f++ = fres;
|
||||
} else {
|
||||
@@ -342,7 +343,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
|
||||
break;
|
||||
case SND_PCM_FORMAT_S32_LE:
|
||||
if (chn==channel) {
|
||||
- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff;
|
||||
ires = res;
|
||||
*samp32++ = LE_INT(ires);
|
||||
} else {
|
||||
@@ -351,7 +352,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
|
||||
break;
|
||||
case SND_PCM_FORMAT_S32_BE:
|
||||
if (chn==channel) {
|
||||
- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff;
|
||||
ires = res;
|
||||
*samp32++ = BE_INT(ires);
|
||||
} else {
|
||||
@@ -389,7 +390,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) {
|
||||
switch (format) {
|
||||
case SND_PCM_FORMAT_S8:
|
||||
if (chn==channel) {
|
||||
- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff;
|
||||
ires = res;
|
||||
*samp8++ = ires >> 24;
|
||||
} else {
|
||||
@@ -398,7 +399,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) {
|
||||
break;
|
||||
case SND_PCM_FORMAT_S16_LE:
|
||||
if (chn==channel) {
|
||||
- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff;
|
||||
ires = res;
|
||||
*samp16++ = LE_SHORT(ires >> 16);
|
||||
} else {
|
||||
@@ -407,7 +408,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) {
|
||||
break;
|
||||
case SND_PCM_FORMAT_S16_BE:
|
||||
if (chn==channel) {
|
||||
- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff;
|
||||
ires = res;
|
||||
*samp16++ = BE_SHORT(ires >> 16);
|
||||
} else {
|
||||
@@ -416,7 +417,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) {
|
||||
break;
|
||||
case SND_PCM_FORMAT_S32_LE:
|
||||
if (chn==channel) {
|
||||
- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff;
|
||||
ires = res;
|
||||
*samp32++ = LE_INT(ires);
|
||||
} else {
|
||||
@@ -425,7 +426,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) {
|
||||
break;
|
||||
case SND_PCM_FORMAT_S32_BE:
|
||||
if (chn==channel) {
|
||||
- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
|
||||
+ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff;
|
||||
ires = res;
|
||||
*samp32++ = BE_INT(ires);
|
||||
} else {
|
||||
@@ -1017,6 +1018,7 @@ static void help(void)
|
||||
"-W,--wavdir Specify the directory containing WAV files\n"
|
||||
"-m,--chmap Specify the channel map to override\n"
|
||||
"-X,--force-frequency force frequencies outside the 30-8000hz range\n"
|
||||
+ "-S,--scale Scale of generated test tones in percent (default=80)\n"
|
||||
"\n"));
|
||||
printf(_("Recognized sample formats are:"));
|
||||
for (fmt = supported_formats; *fmt >= 0; fmt++) {
|
||||
@@ -1060,6 +1062,7 @@ int main(int argc, char *argv[]) {
|
||||
{"wavdir", 1, NULL, 'W'},
|
||||
{"debug", 0, NULL, 'd'},
|
||||
{"force-frequency", 0, NULL, 'X'},
|
||||
+ {"scale", 1, NULL, 'S'},
|
||||
#ifdef CONFIG_SUPPORT_CHMAP
|
||||
{"chmap", 1, NULL, 'm'},
|
||||
#endif
|
||||
@@ -1081,7 +1084,7 @@ int main(int argc, char *argv[]) {
|
||||
while (1) {
|
||||
int c;
|
||||
|
||||
- if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d:X"
|
||||
+ if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d:XS:"
|
||||
#ifdef CONFIG_SUPPORT_CHMAP
|
||||
"m:"
|
||||
#endif
|
||||
@@ -1182,6 +1185,9 @@ int main(int argc, char *argv[]) {
|
||||
chmap = optarg;
|
||||
break;
|
||||
#endif
|
||||
+ case 'S':
|
||||
+ generator_scale = atoi(optarg) / 100.0;
|
||||
+ break;
|
||||
default:
|
||||
fprintf(stderr, _("Unknown option '%c'\n"), c);
|
||||
exit(EXIT_FAILURE);
|
||||
--
|
||||
2.5.0
|
||||
|
206
0008-topology-Add-command-line-topology-tool-to-build-top.patch
Normal file
206
0008-topology-Add-command-line-topology-tool-to-build-top.patch
Normal file
@ -0,0 +1,206 @@
|
||||
From 665d980aa5b779575fbb9eac394ef5c2d03e091e Mon Sep 17 00:00:00 2001
|
||||
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
||||
Date: Tue, 4 Aug 2015 16:23:03 +0100
|
||||
Subject: [PATCH] topology: Add command line topology tool to build topology
|
||||
binaries
|
||||
|
||||
Add a command line tool that will parse topology text files and convert to the binary
|
||||
topology data as used by the kernel.
|
||||
|
||||
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
Makefile.am | 3 ++
|
||||
configure.ac | 5 ++-
|
||||
topology/Makefile.am | 10 +++++
|
||||
topology/topology.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 134 insertions(+), 1 deletion(-)
|
||||
create mode 100644 topology/Makefile.am
|
||||
create mode 100644 topology/topology.c
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 5bbe588a8d84..613f62dc359a 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -25,6 +25,9 @@ endif
|
||||
if HAVE_UCM
|
||||
SUBDIRS += alsaucm
|
||||
endif
|
||||
+if HAVE_TOPOLOGY
|
||||
+SUBDIRS += topology
|
||||
+endif
|
||||
|
||||
EXTRA_DIST= TODO gitcompile
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f09aa5484d1d..4c279a952eef 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -50,6 +50,8 @@ AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
|
||||
[#include <alsa/asoundlib.h>])
|
||||
AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"],
|
||||
[#include <alsa/asoundlib.h>])
|
||||
+AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"],
|
||||
+ [#include <alsa/asoundlib.h>])
|
||||
AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
|
||||
[#include <samplerate.h>])
|
||||
|
||||
@@ -58,6 +60,7 @@ AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
|
||||
AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
|
||||
AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
|
||||
AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes")
|
||||
+AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes")
|
||||
AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
|
||||
|
||||
dnl Check for librt
|
||||
@@ -358,7 +361,7 @@ AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
|
||||
m4/Makefile po/Makefile.in \
|
||||
alsaconf/alsaconf alsaconf/Makefile \
|
||||
alsaconf/po/Makefile \
|
||||
- alsaucm/Makefile \
|
||||
+ alsaucm/Makefile topology/Makefile \
|
||||
aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
|
||||
utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
|
||||
seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
|
||||
diff --git a/topology/Makefile.am b/topology/Makefile.am
|
||||
new file mode 100644
|
||||
index 000000000000..c370b149f632
|
||||
--- /dev/null
|
||||
+++ b/topology/Makefile.am
|
||||
@@ -0,0 +1,10 @@
|
||||
+bin_PROGRAMS = \
|
||||
+ alsatplg
|
||||
+
|
||||
+alsatplg_SOURCES = topology.c
|
||||
+
|
||||
+AM_CPPFLAGS = \
|
||||
+ -Wall -I$(top_srcdir)/include
|
||||
+
|
||||
+alsatplg_LDADD = -lasound
|
||||
+
|
||||
diff --git a/topology/topology.c b/topology/topology.c
|
||||
new file mode 100644
|
||||
index 000000000000..33c327662166
|
||||
--- /dev/null
|
||||
+++ b/topology/topology.c
|
||||
@@ -0,0 +1,117 @@
|
||||
+/*
|
||||
+ Copyright(c) 2014-2015 Intel Corporation
|
||||
+ Copyright(c) 2010-2011 Texas Instruments Incorporated,
|
||||
+ All rights reserved.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of version 2 of the GNU General Public License as
|
||||
+ published by the Free Software Foundation.
|
||||
+
|
||||
+ 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., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ The full GNU General Public License is included in this distribution
|
||||
+ in the file called LICENSE.GPL.
|
||||
+*/
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdint.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include <getopt.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#include <alsa/asoundlib.h>
|
||||
+#include <alsa/topology.h>
|
||||
+#include "gettext.h"
|
||||
+
|
||||
+static snd_output_t *log;
|
||||
+
|
||||
+static void usage(char *name)
|
||||
+{
|
||||
+ printf(
|
||||
+_("Usage: %s [OPTIONS]...\n"
|
||||
+"\n"
|
||||
+"-h, --help help\n"
|
||||
+"-c, --compile=FILE compile file\n"
|
||||
+"-v, --verbose=LEVEL set verbosity level (0...1)\n"
|
||||
+"-o, --output=FILE set output file\n"
|
||||
+), name);
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ snd_tplg_t *snd_tplg;
|
||||
+ static const char short_options[] = "hc:v:o:";
|
||||
+ static const struct option long_options[] = {
|
||||
+ {"help", 0, 0, 'h'},
|
||||
+ {"verbose", 0, 0, 'v'},
|
||||
+ {"compile", 0, 0, 'c'},
|
||||
+ {"output", 0, 0, 'o'},
|
||||
+ {0, 0, 0, 0},
|
||||
+ };
|
||||
+ char *source_file = NULL, *output_file = NULL;
|
||||
+ int c, err, verbose = 0, option_index;
|
||||
+
|
||||
+#ifdef ENABLE_NLS
|
||||
+ setlocale(LC_ALL, "");
|
||||
+ textdomain(PACKAGE);
|
||||
+#endif
|
||||
+
|
||||
+ err = snd_output_stdio_attach(&log, stderr, 0);
|
||||
+ assert(err >= 0);
|
||||
+
|
||||
+ while ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) {
|
||||
+ switch (c) {
|
||||
+ case 'h':
|
||||
+ usage(argv[0]);
|
||||
+ return 0;
|
||||
+ case 'v':
|
||||
+ verbose = atoi(optarg);
|
||||
+ break;
|
||||
+ case 'c':
|
||||
+ source_file = optarg;
|
||||
+ break;
|
||||
+ case 'o':
|
||||
+ output_file = optarg;
|
||||
+ break;
|
||||
+ default:
|
||||
+ fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (source_file == NULL || output_file == NULL) {
|
||||
+ usage(argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ snd_tplg = snd_tplg_new();
|
||||
+ if (snd_tplg == NULL) {
|
||||
+ fprintf(stderr, _("failed to create new topology context\n"));
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ snd_tplg_verbose(snd_tplg, verbose);
|
||||
+
|
||||
+ err = snd_tplg_build_file(snd_tplg, source_file, output_file);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, _("failed to compile context %s\n"), source_file);
|
||||
+ snd_tplg_free(snd_tplg);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ snd_tplg_free(snd_tplg);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 4 17:48:44 CEST 2015 - tiwai@suse.de
|
||||
|
||||
- Upstream patch to add -S option to speaker-test
|
||||
0007-speaker-test-Add-option-to-specify-signal-scale.patch
|
||||
- Upstream patch to add alsatplg parser program
|
||||
0008-topology-Add-command-line-topology-tool-to-build-top.patch
|
||||
- Reenable autoreconf call to regenerate after patching
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 31 07:40:12 UTC 2015 - dimstar@opensuse.org
|
||||
|
||||
|
@ -51,6 +51,8 @@ Patch3: 0003-alsa-info-Don-t-try-update-when-wget-isn-t-available.patch
|
||||
Patch4: 0004-aplay-Fix-type-for-signal-flag.patch
|
||||
Patch5: 0005-aplay-Fix-uninterruptible-aplay.patch
|
||||
Patch6: 0006-alsactl-terminate-readlink-result-string.patch
|
||||
Patch7: 0007-speaker-test-Add-option-to-specify-signal-scale.patch
|
||||
Patch8: 0008-topology-Add-command-line-topology-tool-to-build-top.patch
|
||||
#
|
||||
Patch99: alsa-utils-gettext-version-removal.diff
|
||||
BuildRequires: alsa-devel
|
||||
@ -84,6 +86,8 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
#
|
||||
%if 0%{?suse_version} < 1020
|
||||
%patch99 -p1
|
||||
@ -94,7 +98,7 @@ export AUTOMAKE_JOBS="%{?_smp_mflags}"
|
||||
%if 0%{?suse_version} < 1020
|
||||
# gettextize -f
|
||||
%endif
|
||||
# autoreconf -fi
|
||||
autoreconf -fi
|
||||
opts=""
|
||||
%if %{use_systemd}
|
||||
opts="$opts --with-systemdsystemunitdir=%{_unitdir}"
|
||||
|
Loading…
Reference in New Issue
Block a user