]> git.alsa-project.org Git - alsa-utils.git/log
alsa-utils.git
2 years agotopology: pre-process-object: Expand definitions within strings
Jyri Sarha [Mon, 16 Jan 2023 21:17:23 +0000 (23:17 +0200)]
topology: pre-process-object: Expand definitions within strings

Expand the pre-processor to allow for expanding the definitions,
object attribute references and arithmetic expressions within strings.

With this extension its possible to embedded definitions or attribute
references into topology string objects. For example:

Define {
       PCM_NUMBER 1
}

Object.Pipeline {
pcm-playback.0 {

Object.Widget {
copier.1 {
copier_type "host"
}
gain.1 {
Object.Control.mixer.1 {
name 'hw:$[$PCM_NUMBER - 1] Playback Volume'
}
}

Object.Base {
route.1 {
source copier.host.$index.1
sink gain.$index.1
}
}
}

In the example the $[$PCM_NUMBER - 1] would be replaced with the
result of arithmetic expression '1 - 1' in other words '0' , and
$index in all occurrences with index attribute found from pipeline
object. Any non alpha numeric or '_' character are treated as
delimiters for variable names if $[]-notation is not used.

Fixes: https://github.com/alsa-project/alsa-utils/pull/189
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: pre-process-object: Remove all trailing white space
Jyri Sarha [Wed, 18 Jan 2023 19:41:47 +0000 (21:41 +0200)]
topology: pre-process-object: Remove all trailing white space

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoAdd OpenBSD support
SASANO Takayoshi [Sat, 31 Dec 2022 07:03:34 +0000 (16:03 +0900)]
Add OpenBSD support

- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib

- EPIPE and ESTRPIPE are different usage, but currently
  EPIPE is used when ESTRPIPE is not defined.

  To fix this problem, assign ESPIPE instead.

Fixes: https://github.com/alsa-project/alsa-utils/pull/186
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: pre-processor: support to include conf block with IncludeByKey
Chao Song [Tue, 17 Jan 2023 12:52:18 +0000 (20:52 +0800)]
topology: pre-processor: support to include conf block with IncludeByKey

Currently, The IncludeByKey mechanism only supports conditionally
including a topology conf file. Even if we only
want to conditionally include a small conf block, we have
to use a conf file and in the end we will have a lot of
trivial conf files that only contain a single conf blocks.

This patch extends the use of IncludeByKey ito support including conf
blocks conditionally. For example, the block below will include the route
conditionally based on the variable definition COPIER_ROUTE.

Define {
COPIER_ROUTE 1
}

IncludeByKey.COPIER_ROUTE {
        "1" {
Object.Base.route.11 {
source copier.module.8.2
sink copier.module.17.2
}
    }
}

Fixes: https://github.com/alsa-project/alsa-utils/pull/187
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Co-authored-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: nhlt: intel: add support for ssp blob ver 1.5
Jaska Uimonen [Fri, 16 Dec 2022 16:25:35 +0000 (18:25 +0200)]
topology: nhlt: intel: add support for ssp blob ver 1.5

Ssp plugin had already a definition for newer nhlt blob version 1.5.
Add support to generate that instead of legacy blob. Never blob can be
generated by adding "version" field in SSP dai topology2 definition and
setting it to lower 16 bits of SSP_BLOB_VER_1_5 (0xee000105) -> 0x105
i.e 8 bits for major and 8 bits for minor version.

SSP."0" {
id              0
dai_index       0
direction       "duplex"
name            NoCodec-0
version         0x105
}

Fixes: https://github.com/alsa-project/alsa-utils/pull/184
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: plugins: nhlt: add ssp aux controls
Jaska Uimonen [Wed, 12 Oct 2022 10:44:55 +0000 (13:44 +0300)]
topology: plugins: nhlt: add ssp aux controls

Intel ssp blob can have auxiliary controls catenated as tlv array at the
end of its "normal" data blob. These are needed in some platforms for
example to enable hardware clocks earlier than streaming starts.

In topology the auxiliary data classes are embedded into hw_config and
can be instantiated like:

Object.Base.hw_config."SSP0_0" {
id              0
mclk_freq       38400000
bclk_freq       256000
tdm_slot_width  16
format          "DSP_A"
bclk            "codec_provider"
fsync           "codec_provider"
fsync_freq      16000

Object.Base.mn_config."MN_0" {
m_div   100
n_div   200
}

Object.Base.clk_config."CLK_0" {
clock_warm_up          1
mclk                   2
warm_up_ovr            3
clock_stop_delay       4
keep_running           5
clock_stop_ovr         6
}
}

Fixes: https://github.com/alsa-project/alsa-utils/pull/184
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoaplay,axfer: Replace off64_t with off_t
Khem Raj [Thu, 15 Dec 2022 22:04:10 +0000 (14:04 -0800)]
aplay,axfer: Replace off64_t with off_t

Also replace lseek64 with lseek.

_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses
AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is
same as lseek64.

Additionally this fixes buils with latest musl where these lfs64
functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE
macro alone. This makes the builds fail on 32-bit platforms even though
default off_t on musl is 64-bit always.

Fixes: https://github.com/alsa-project/alsa-utils/pull/183
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: propagate nhlt plugin error to main program
Chao Song [Thu, 8 Dec 2022 06:40:04 +0000 (14:40 +0800)]
topology: propagate nhlt plugin error to main program

Let's propagate nhlt plugin error to main program,
so that we don't generate a wrong nhlt blob silently.

Fixes: https://github.com/alsa-project/alsa-utils/pull/181
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: plugins: nhlt: fix ssp debug
Jaska Uimonen [Wed, 7 Dec 2022 13:32:10 +0000 (15:32 +0200)]
topology: plugins: nhlt: fix ssp debug

Nhlt ssp plugin debug feature was broken due to recent change in ssp
indexing, thus fix it.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoaplay: Fix parsing of format with WAV_FMT_EXTENSIBLE header
Amadeusz Sławiński [Thu, 10 Nov 2022 23:45:01 +0000 (00:45 +0100)]
aplay: Fix parsing of format with WAV_FMT_EXTENSIBLE header

WAV_FMT_EXTENSIBLE header contains valid bits per sample, which can be
different than bits per sample. Make sure it is taken into account when
parsing headers and choosing playback format.

BugLink: https://github.com/alsa-project/alsa-utils/pull/178
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: nhlt: intel: ssp: fix obvious typo for 'codec_provider'
Pierre-Louis Bossart [Mon, 10 Oct 2022 20:18:39 +0000 (15:18 -0500)]
topology: nhlt: intel: ssp: fix obvious typo for 'codec_provider'

Looks like a bad search and replace?

Fixes: https://github.com/alsa-project/alsa-utils/pull/174
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoAdd Georgian translation
NorwayFun [Fri, 9 Sep 2022 08:29:41 +0000 (10:29 +0200)]
Add Georgian translation

Fixes: https://github.com/alsa-project/alsa-utils/pull/169
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agobat: Add 'readcapture' option to support analyzing external audio
Tim Bird [Tue, 17 May 2022 15:50:49 +0000 (09:50 -0600)]
bat: Add 'readcapture' option to support analyzing external audio

If audio data is captured on another device (ie we are NOT using
loopback mode), then allow alsabat to analyze that data, by passing
a filename reference on the command line.

Add the '--readcapture' option to the argument parser. When
this option is specified, avoid doing a local capture, and instead
just read the audio data from the indicated file, and analyze that.

Fixes: https://github.com/alsa-project/alsa-utils/pull/166
Signed-off-by: Tim Bird <tim.bird@sony.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoconfigure.ac: fix build without dlfcn.h
Fabrice Fontaine [Sun, 14 Aug 2022 18:31:30 +0000 (20:31 +0200)]
configure.ac: fix build without dlfcn.h

Fix the following static build failure (i.e. without dlfcn.h) raised
since version 1.2.7 and
https://github.com/alsa-project/alsa-utils/commit/44d3e8aa44fc12f95bfeef0e3a1051e8f77047b5:

pre-processor.c:28:10: fatal error: dlfcn.h: No such file or directory
   28 | #include <dlfcn.h>
      |          ^~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/1173a1ee28a58ce565a3274f35e868c35bb2e04e

Fixes: https://github.com/alsa-project/alsa-utils/pull/165
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: plugins: nhlt: fix ssp dai index
Jaska Uimonen [Fri, 5 Aug 2022 07:26:16 +0000 (10:26 +0300)]
topology: plugins: nhlt: fix ssp dai index

There was a conceptual error in handling the separate ssp dais, so fix
it.

Fixes: https://github.com/alsa-project/alsa-utils/pull/164
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: plugins: nhlt: add dmic dai index
Jaska Uimonen [Fri, 5 Aug 2022 07:19:53 +0000 (10:19 +0300)]
topology: plugins: nhlt: add dmic dai index

Dmic might have multiple configurations for the same hw, so add them to
nhlt blob. The configurations are separated by dai_index.

Fixes: https://github.com/alsa-project/alsa-utils/pull/164
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agotopology: plugins: fix off by 1 mem allocation error
Yong Zhi [Sat, 30 Jul 2022 01:05:56 +0000 (20:05 -0500)]
topology: plugins: fix off by 1 mem allocation error

Fix valgrind memcheck error:

==1337389== Invalid write of size 1
==1337389==    at 0x4A4AFAB: __vsnprintf_internal (vsnprintf.c:117)
==1337389==    by 0x4AECF40: __snprintf_chk (snprintf_chk.c:38)
==1337389==    by 0x484B870: snprintf (stdio2.h:67)
==1337389==    by 0x484B870: print_as_hex_bytes (nhlt-processor.c:112)
==1337389==    by 0x484B870: merge_manifest_data (nhlt-processor.c:154)
==1337389==    by 0x484B870: do_nhlt (nhlt-processor.c:420)
==1337389==    by 0x484B870: _snd_topology_nhlt_process (nhlt-processor.c:484)

The consecutive snprintf overwrites always the previous terminator until
it hits the very last call of:

snprintf(dst, ALSA_BYTE_CHARS + 1, "0x%02x,", *nhlt_buffer);

when the size n given to snprintf is 1 more than allocated.

Fixes: https://github.com/alsa-project/alsa-utils/pull/162
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agochore: Add link to master branch on GitHub Actions
Tomohiro IKEDA [Thu, 28 Jul 2022 12:52:28 +0000 (21:52 +0900)]
chore: Add link to master branch on GitHub Actions

Fixes: https://github.com/alsa-project/alsa-utils/pull/161
Singed-off-by: Tomohiro IKEDA <tomohiro.ikeda@justincase-tech.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agochore: Delete .travis.yml because of using not Travis CI but GitHub Actions
Tomohiro IKEDA [Sat, 23 Jul 2022 11:25:06 +0000 (20:25 +0900)]
chore: Delete .travis.yml because of using not Travis CI but GitHub Actions

Fixes: https://github.com/alsa-project/alsa-utils/pull/160
Signed-off-by: Tomohiro IKEDA <tomohiro.ikeda@justincase-tech.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoamidi: restore space between bytes
John Keeping [Wed, 13 Jul 2022 15:04:09 +0000 (16:04 +0100)]
amidi: restore space between bytes

Commit 9a8fcec ("amidi: add timestamp option for dump") removed the
space between bytes when dumping MIDI, changing the output from:

90 45 40
80 45 00

to:

904540
804500

It seems that this was an unintentional side effect of refactoring the
code to add the new timestamp output but the result is less readable
than it was before.

Restore the space between bytes in the same message.

Fixes: 9a8fcec ("amidi: add timestamp option for dump")
Fixes: https://github.com/alsa-project/alsa-utils/pull/158/
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoaxfer: fix typo in manual
Takashi Sakamoto [Tue, 12 Jul 2022 00:51:57 +0000 (09:51 +0900)]
axfer: fix typo in manual

The spelling of 'aborted' was 'aboeted' in the manual. This commit fixes
it.

Fixes: a37703614a90 ("axfer: fulfill manual section for libffado backend")
Fixes: https://github.com/alsa-project/alsa-utils/pull/156
Reported-by: Chao Song chao.song@linux.intel.com
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoRelease v1.2.8 v1.2.8
Jaroslav Kysela [Mon, 24 Oct 2022 08:17:28 +0000 (10:17 +0200)]
Release v1.2.8

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2 years agoalsactl: Print driver name in info
Jaroslav Kysela [Tue, 27 Sep 2022 17:06:04 +0000 (19:06 +0200)]
alsactl: Print driver name in info

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoamixer: fix the help for 'events' command
Jaroslav Kysela [Thu, 25 Aug 2022 07:33:58 +0000 (09:33 +0200)]
amixer: fix the help for 'events' command

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoaplay: remove wrongly merged UCM code
Jaroslav Kysela [Wed, 3 Aug 2022 20:46:47 +0000 (22:46 +0200)]
aplay: remove wrongly merged UCM code

The code origin comes from me. Unfortunately, it was merged
by mistake to another commit. Remove it for now.

Fixes: https://github.com/alsa-project/alsa-utils/issues/153
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoaplay: fix the capture file length regression
Jaroslav Kysela [Wed, 3 Aug 2022 20:09:45 +0000 (22:09 +0200)]
aplay: fix the capture file length regression

The commit 4b959a4 ("aplay: Fix for arecord recording ghost data")
intruduced a regression (file may contain more samples than
expected). Correct this.

Fixes: https://github.com/alsa-project/alsa-utils/issues/163
Fixes: 4b959a4 ("aplay: Fix for arecord recording ghost data")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconfigure: automake - use subdir-objects option
Jaroslav Kysela [Thu, 2 Jun 2022 06:31:33 +0000 (08:31 +0200)]
configure: automake - use subdir-objects option

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoconfigure: use AC_DISABLE_STATIC (for topology modules)
Jaroslav Kysela [Thu, 2 Jun 2022 06:25:49 +0000 (08:25 +0200)]
configure: use AC_DISABLE_STATIC (for topology modules)

Fixes: https://github.com/alsa-project/alsa-utils/issues/152
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoRelease v1.2.7 v1.2.7
Jaroslav Kysela [Tue, 31 May 2022 16:24:24 +0000 (18:24 +0200)]
Release v1.2.7

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: nhlt plugin: second attempt to fix the .so linking
Jaroslav Kysela [Tue, 31 May 2022 16:23:47 +0000 (18:23 +0200)]
topology: nhlt plugin: second attempt to fix the .so linking

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: nhlt plugin: fix the .so linking
Jaroslav Kysela [Tue, 31 May 2022 16:11:50 +0000 (18:11 +0200)]
topology: nhlt plugin: fix the .so linking

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsamixer: add alsamixer.rc.example file
Jaroslav Kysela [Tue, 31 May 2022 12:16:28 +0000 (14:16 +0200)]
alsamixer: add alsamixer.rc.example file

Fixes: https://github.com/alsa-project/alsa-utils/issues/112
From: Bertram Felgenhauer / int-e / github
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: plugins: nhlt: fix intel dmic mode calculation
Jaska Uimonen [Fri, 20 May 2022 04:51:37 +0000 (07:51 +0300)]
topology: plugins: nhlt: fix intel dmic mode calculation

Dmic find_modes function was used with same sampling rate for both fifo
a and b parameter calculations. This bug was found in testing two
simultaneous dmic dais in topology. Fix this by introducing a sampling
rate argument for find_modes.

Fixes: https://github.com/alsa-project/alsa-utils/pull/148
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoaplay: Fix for arecord recording ghost data
Amadeusz Sławiński [Thu, 5 May 2022 11:08:33 +0000 (13:08 +0200)]
aplay: Fix for arecord recording ghost data

When recording we should only write the amount of data read to output
file instead of copying whole buffer. This fixes glitches appearing at
the end of recorded file, when stopping recording.

Fixes: https://github.com/alsa-project/alsa-utils/pull/150
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: implement 'info' command
Jaroslav Kysela [Mon, 9 May 2022 07:34:22 +0000 (09:34 +0200)]
alsactl: implement 'info' command

It may be useful to collect the basic sound card information.
The output is in the YAML structured syntax (human and machine readable).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: add missing nhlt headers to Makefile.am
Jaroslav Kysela [Tue, 3 May 2022 12:16:43 +0000 (14:16 +0200)]
topology: add missing nhlt headers to Makefile.am

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: add missing pre-process-external.h to Makefile.am
Jaroslav Kysela [Tue, 3 May 2022 12:06:13 +0000 (14:06 +0200)]
topology: add missing pre-process-external.h to Makefile.am

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agogithub workflow: add libtoolize call for alsa-utils
Jaroslav Kysela [Tue, 3 May 2022 11:33:14 +0000 (13:33 +0200)]
github workflow: add libtoolize call for alsa-utils

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoaplay: fix a typo in warning (inaudiable -> inaudible)
Matthias Braun [Wed, 27 Apr 2022 17:21:32 +0000 (19:21 +0200)]
aplay: fix a typo in warning (inaudiable -> inaudible)

From: Matthias Braun (https://github.com/mb720)
Fixes: https://github.com/alsa-project/alsa-utils/pull/143
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: do not pass pre_processor_defs to pre_process_plugins()
Jaroslav Kysela [Tue, 3 May 2022 11:20:24 +0000 (13:20 +0200)]
topology: do not pass pre_processor_defs to pre_process_plugins()

This parameter is not used.

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: plugins - add Intel nhlt encoder plugin
Jaska Uimonen [Tue, 14 Dec 2021 15:20:50 +0000 (17:20 +0200)]
topology: plugins - add Intel nhlt encoder plugin

Add Intel nhlt acpi table encoder plugin into topology2.0 processing.
Nhlt internal structure is defined in:
https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf
Nhlt acpi table contain vendor specific binary data blobs that are used
in some Intel dsp platforms for configuring the dmic and ssp hardware.

The function of this code is mainly to generate the vendor specific
binary blobs, but as there is existing nhlt parser code and header in
kernel there's no point of re-inventing the container: just use the
existing nhlt acpi table format. Basically this code is creating similar
nhlt acpi table that you would get from: cat
/sys/firmware/acpi/tables/NHLT

This code will have implementation for dmic and ssp endpoints. Thus the
code will translate the topology dai tokens into vendor specific binary
blobs and pack them into nhlt acpi table. Ssp and dmic code is lifted
from Sound Open Firmware (sof) code base, thus it will have BSD-3
license.

This plugin can be enabled from command line with:

alsatplg -DPREPROCESS_PLUGINS="nhlt" -c foo.conf -p -o bar.tplg

You can also dump the nhlt binary into a file with additional define:

-DNHLT_BIN="nhlt.bin"

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: add simple topology plugin mechanism
Jaska Uimonen [Tue, 14 Dec 2021 15:11:51 +0000 (17:11 +0200)]
topology: add simple topology plugin mechanism

Add a simple plugin interface for processing the topology tree. There
can be cases where parts of the topology need to be translated from the
original format into something else. For example one could calculate
some kind of filter coefficients from filter parameters or some other
binary interface parameters from plain text topology tokens.

Mechanism is similar as in alsa-plugins and in the plugin there should
be only 1 function exported of the form:

int _snd_topology_##pluginname##_process (snd_config_t *input, snd_config_t *output)

Input and output parameters are snd_config tree before and after topology2
pre-processing. So the plugin can modify both if needed. There are cases
where the plugin may need to get information from input tree, but make
modifications to the output.

The plugins to be used can be defined in command line with:

alsatplg -DPREPROCESS_PLUGINS="foobar" -c topology.conf -p -o topology.tplg

Multiple plugins should be separated by ":".

Plugins to be used can also be defined with "Define" clause inside the
topology file (but command line takes precedence):

Define {
       PREPROCESS_PLUGINS "foobar"
}

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: add locking for per-card initialization
Jaroslav Kysela [Wed, 2 Feb 2022 14:31:33 +0000 (15:31 +0100)]
alsactl: add locking for per-card initialization

Introduce the -K,--lock-dir parameter to specify the locking
directory. If the locking is active, files card<NUM>.lock
are used to serialize the multiple initialization requests
(udev, service).

Allow the relative -O,--lock-file argument (it's default now).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: lock - use alarm signal and F_SETLKW rather polling
Jaroslav Kysela [Tue, 1 Feb 2022 19:45:27 +0000 (20:45 +0100)]
alsactl: lock - use alarm signal and F_SETLKW rather polling

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: remove unused argument for state_lock_()
Jaroslav Kysela [Tue, 1 Feb 2022 19:01:08 +0000 (20:01 +0100)]
alsactl: remove unused argument for state_lock_()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: add dbg() prints to init_ucm()
Jaroslav Kysela [Tue, 1 Feb 2022 18:47:53 +0000 (19:47 +0100)]
alsactl: add dbg() prints to init_ucm()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: pre-processor: fix seg fault when there no command line defines
Ranjani Sridharan [Fri, 28 Jan 2022 21:36:03 +0000 (13:36 -0800)]
topology: pre-processor: fix seg fault when there no command line defines

In case there are not command line definitions, there is nothing to
merge or delete.

Fixes: https://github.com/alsa-project/alsa-utils/pull/141
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: use a copy of the command line defines
Jaroslav Kysela [Fri, 28 Jan 2022 17:53:39 +0000 (18:53 +0100)]
topology: use a copy of the command line defines

Fixes: a9b3525 ("topology: don't fail when Define section is missing in the included file")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: don't fail when Define section is missing in the included file
Jaroslav Kysela [Fri, 28 Jan 2022 17:07:46 +0000 (18:07 +0100)]
topology: don't fail when Define section is missing in the included file

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: create Define subtree for command line defines only
Jaroslav Kysela [Fri, 28 Jan 2022 17:01:03 +0000 (18:01 +0100)]
topology: create Define subtree for command line defines only

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: the includes should be deleted not removed
Jaroslav Kysela [Fri, 28 Jan 2022 16:50:33 +0000 (17:50 +0100)]
topology: the includes should be deleted not removed

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsamixer: Revert has_mouse() check
Takashi Iwai [Fri, 28 Jan 2022 16:46:45 +0000 (17:46 +0100)]
alsamixer: Revert has_mouse() check

has_mouse() function of ncurses doesn't seem working reliably.
Revert the previous change for addressing the regressions.

Fixes: 31820c5f239f ("alsamixer: Check the availability of mouse")
BugLink: https://github.com/alsa-project/alsa-utils/issues/139
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agotopology: use cached Define subtree in pre_process_includes()
Jaroslav Kysela [Fri, 28 Jan 2022 09:04:07 +0000 (10:04 +0100)]
topology: use cached Define subtree in pre_process_includes()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix the define section merge from the included files
Jaroslav Kysela [Fri, 28 Jan 2022 08:34:06 +0000 (09:34 +0100)]
topology: fix the define section merge from the included files

The bellow commit assumed that the merge of the included file
is to the main configuration tree, but it's for the subtree.
The Define compound from the included file must be handled
separately.

Link: https://github.com/alsa-project/alsa-utils/pull/140
Fixes: e1a0711 ("topology: fix the command line define merge for new includes")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix the comment for improved -D option
Jaroslav Kysela [Fri, 28 Jan 2022 08:29:34 +0000 (09:29 +0100)]
topology: fix the comment for improved -D option

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: add support for multiple -D arguments
Jaroslav Kysela [Thu, 27 Jan 2022 17:48:16 +0000 (18:48 +0100)]
topology: add support for multiple -D arguments

It may be useful in the makefile rules for example.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: pre-process-object: expand variables before validating attributes
Ranjani Sridharan [Wed, 26 Jan 2022 23:36:24 +0000 (15:36 -0800)]
topology: pre-process-object: expand variables before validating attributes

With the introduction of variables in the topology files, validation of
attributes values must be done after they are expanded to their defined
values. Also, since valid values for attributes in the class definition
can also be variables, they need to be expanded as well. So, first expand
the attribute values and then check them against expanded valid values.

Fixes: https://github.com/alsa-project/alsa-utils/pull/138
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agospeaker-test: remove sample_map.csv from Makefile
Jaroslav Kysela [Thu, 27 Jan 2022 17:29:05 +0000 (18:29 +0100)]
speaker-test: remove sample_map.csv from Makefile

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: rename function free_pre_preprocessor to free_pre_processor
Jaroslav Kysela [Thu, 27 Jan 2022 14:01:50 +0000 (15:01 +0100)]
topology: rename function free_pre_preprocessor to free_pre_processor

Line up this name with others.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: optimization for pre_processor_defs parsing
Jaroslav Kysela [Thu, 27 Jan 2022 13:58:55 +0000 (14:58 +0100)]
topology: optimization for pre_processor_defs parsing

Parse the configuration tree only one time and then reuse
it for the merge.

Also, do not pass inc_path to all functions - add it
to the pre-processor structure.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: merge the pre-processor call to one function
Jaroslav Kysela [Thu, 27 Jan 2022 13:33:20 +0000 (14:33 +0100)]
topology: merge the pre-processor call to one function

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix the command line define merge for new includes
Jaroslav Kysela [Thu, 27 Jan 2022 13:11:45 +0000 (14:11 +0100)]
topology: fix the command line define merge for new includes

The defines from the command line must overwrite the defines
from the included configuration files forcefully.

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: flush stdout for monitor command
Alex Xu (Hello71) [Tue, 24 Aug 2021 14:39:12 +0000 (10:39 -0400)]
alsactl: flush stdout for monitor command

It may be useful to pipe the output to another program.

Fixes: https://github.com/alsa-project/alsa-utils/pull/109
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: fix typo in comment in 00main
Jaroslav Kysela [Thu, 27 Jan 2022 12:19:32 +0000 (13:19 +0100)]
alsactl: fix typo in comment in 00main

Fixes: https://github.com/alsa-project/alsa-utils/issues/132
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agospeaker-test: remove sample_map.csv
Jaroslav Kysela [Thu, 27 Jan 2022 12:15:46 +0000 (13:15 +0100)]
speaker-test: remove sample_map.csv

The CSV file is not used. The .wav file names are fixed
in the source code, but the directory may be specified
using --wavdir. Remove this file until there's a demand
for the more precise .wav file mapping.

Fixes: https://github.com/alsa-project/alsa-utils/issues/133
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: don't allow to mix verbose level and output to stdout
Jaroslav Kysela [Thu, 27 Jan 2022 12:03:36 +0000 (13:03 +0100)]
topology: don't allow to mix verbose level and output to stdout

Fixes: https://github.com/alsa-project/alsa-utils/issues/131
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsamixer: Fix regression in color setup
Takashi Iwai [Thu, 20 Jan 2022 07:49:17 +0000 (08:49 +0100)]
alsamixer: Fix regression in color setup

The recent change to add the background config broke the color setup
via the config file due.  Fix the regression by restoring the
initialization order back again, and changing the logic for the
default background color to be re-initializing color pairs instead.

Link: https://github.com/alsa-project/alsa-utils/issues/137
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoalsactl: fix the error path in set_controls()
Jaroslav Kysela [Mon, 3 Jan 2022 15:14:31 +0000 (16:14 +0100)]
alsactl: fix the error path in set_controls()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: pre-processor: Move the call to expand variables
Ranjani Sridharan [Sat, 11 Dec 2021 18:45:43 +0000 (10:45 -0800)]
topology: pre-processor: Move the call to expand variables

Remove the call to snd_config_expand_custom() to expand the top-level
input config. And replace it with calls to snd_config_evaluate_string()
for each non-compound config while processing individual objects. This
will allow retreving variable definitions from object attribute values
and global definitions.

Add a new field "current_obj_cfg" to hold the current object config
being pre-processed.

This will facilitate adding simple math expressions for computing
attribute values for objects based on other attributes. For ex: we can
set the expression for buffer size as follows:

buffer_size "$[($in_channels * 48) * 4]"

The buffer_size attribute value will be computed with the attribute
value "in_channels" based on the expression above. So if $in_channels =
2, buffer_size will be evaluated to 384.

Additionally this change also permits computing attribute values based
on previously computed values. For example:

buffer_size "$[($in_channels * 48) * 4]"
dma_buffer_size "$[$buffer_size * 2]"

dma_buffer_size will be computed as 768. Note that the order of
definitions for buffer_size and dma_buffer_size matters because the
evaluation for dma_buffer_size depends on the evaluation of buffer_size.
In order to conform to this, the tplg_object_copy_and_add_param() is
modified to add attribute configs from class config to an object using
snd_config_before() instead of snd_config_add().

With this change, we no longer need to set the auto_attr_updater for
buffer type widget objects. So remove it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix the file permissions for the generated files
Jaroslav Kysela [Sun, 12 Dec 2021 18:57:38 +0000 (19:57 +0100)]
topology: fix the file permissions for the generated files

The owner r/w file permissions are too restrictive.
Let umask do it's work and set the r/w permissions to any.

Fixes: https://github.com/alsa-project/alsa-utils/issues/126
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: define -I option only for alsa-lib 1.2.6+
Jaroslav Kysela [Wed, 8 Dec 2021 08:55:44 +0000 (09:55 +0100)]
topology: define -I option only for alsa-lib 1.2.6+

Link: https://github.com/alsa-project/alsa-utils/pull/125
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: Add option to pass include path for conditional includes
Ranjani Sridharan [Wed, 8 Dec 2021 05:06:29 +0000 (21:06 -0800)]
topology: Add option to pass include path for conditional includes

The include path passed with -I option will override the relative
include path based on the source file.

Fixes: https://github.com/alsa-project/alsa-utils/pull/125
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix the include path parsing
Jaroslav Kysela [Tue, 7 Dec 2021 08:39:12 +0000 (09:39 +0100)]
topology: fix the include path parsing

When the last '/' is not found use '.' as the source path.

Fixes: https://github.com/alsa-project/alsa-utils/issues/123
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoRelease v1.2.6 v1.2.6
Jaroslav Kysela [Mon, 6 Dec 2021 10:17:28 +0000 (11:17 +0100)]
Release v1.2.6

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoamidi: remove unused variable
Jaroslav Kysela [Mon, 6 Dec 2021 10:02:10 +0000 (11:02 +0100)]
amidi: remove unused variable

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: fix compilation for older alsa-lib
Jaroslav Kysela [Mon, 6 Dec 2021 10:00:02 +0000 (11:00 +0100)]
topology: fix compilation for older alsa-lib

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: change include path
Jaroslav Kysela [Mon, 6 Dec 2021 09:13:22 +0000 (10:13 +0100)]
topology: change include path

Add support for relative (based on the path from the parsed
configuration file) and absolute include path without
ALSA_CONFIG_DIR environment variable usage. The dependency
on the alsa-lib config tree may be added on demand.

Link: https://github.com/alsa-project/alsa-utils/pull/117
Link: https://github.com/alsa-project/alsa-utils/issues/118
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: pre-processor: Add support for conditional includes
Ranjani Sridharan [Mon, 6 Dec 2021 05:10:46 +0000 (21:10 -0800)]
topology: pre-processor: Add support for conditional includes

Add a new keyword "IncludeByKey" that will be used to conditional
include configuration files based on the argument value supplied during
build time. For example:

IncludeByKey.DMIC_CH_COUNT {
"[1-4]" "include/platform/intel/dmic-generic.conf"
}

The above config will include the dmic-generic.conf file if the argument
value for DMIC_CH_COUNT is between 1 and 4.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agotopology: Add option to pass pre-processor definitions
Ranjani Sridharan [Thu, 4 Nov 2021 19:17:24 +0000 (12:17 -0700)]
topology: Add option to pass pre-processor definitions

Add a -D switch to be able to pass pre-processor definitions that will
be used to expand arguments in the input config file. This will be
useful to generate multiple topology binaries from the same input config
file with different argument values.

For example: if we had a pipeline config as follows:

Object.Pipeline {
volume-playback.1 {
dynamic_pipeline $DYNAMIC_PIPELINE
}
}

We can define the variable for DYNAMIC_PIPELINE as:

Define {
DYNAMIC_PIPELINE 0
}

And when pre-processing the conf file pass "-D DYNAMIC_PIPELINE=1" to
override the default value for dynamic_pipeline attribute in the input
conf file.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsamixer: fix typo in man page (and/of -> and/or)
Jaroslav Kysela [Fri, 3 Dec 2021 13:55:03 +0000 (14:55 +0100)]
alsamixer: fix typo in man page (and/of -> and/or)

Fixes: https://github.com/alsa-project/alsa-utils/issues/110
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsa-info.sh: Fix alsa-usbstream.tmp test
Jaroslav Kysela [Fri, 3 Dec 2021 13:52:52 +0000 (14:52 +0100)]
alsa-info.sh: Fix alsa-usbstream.tmp test

Fixes: https://github.com/alsa-project/alsa-utils/issues/115
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: fix the check for additional elements
Jaroslav Kysela [Fri, 3 Dec 2021 10:09:54 +0000 (11:09 +0100)]
alsactl: fix the check for additional elements

The driver may export only write-only elements. The previous
heuristics code do not handle this use case correctly.
Iterate through all elements and skip the write-only ones.

Fixes: https://github.com/alsa-project/alsa-utils/issues/122
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsaloop: Support "Playback Pitch 1000000" rate shift
Pavel Hofman [Sun, 24 Oct 2021 08:31:55 +0000 (10:31 +0200)]
alsaloop: Support "Playback Pitch 1000000" rate shift

Linux 5.15 will introduce a new control element "Playback Pitch 1000000"
(commit 6fec018 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for
sync playback") which provides feedback mechanism for playback direction
of USB Audio Gadget. The control operates in the same way as the
existing control element "Capture Pitch 1000000".

This patch adds support for this feature.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsaloop: Renamed field capt_pitch to ctl_pitch
Pavel Hofman [Sun, 24 Oct 2021 08:31:54 +0000 (10:31 +0200)]
alsaloop: Renamed field capt_pitch to ctl_pitch

Renaming capt_pitch to ctl_pitch to respect the naming style of
snd_ctl_elem_value_t fields in loopback_handle. Also making the variable
name suitable for planned support of playback pitch.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsactl: suppress no device 'errors' for UCM
Jaroslav Kysela [Thu, 28 Oct 2021 10:07:10 +0000 (12:07 +0200)]
alsactl: suppress no device 'errors' for UCM

This patch adds --ucm-nodev (or -X) option to get those
messages back. The code works only with library 1.2.6+.

By default, these messages are suppressed:

  alsactl[xxx]: alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HDA Intel PCH...)
  alsactl[xxx]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6

Fixes: https://github.com/alsa-project/alsa-utils/issues/111
Link: https://lore.kernel.org/alsa-devel/20211027144008.27002-1-tiwai@suse.de/
Link: https://github.com/alsa-project/alsa-lib/commit/23198a72cd4f8f8759e650362b4adb485fc9fb12
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsamixer: Allow setting the default background color in config
Takashi Iwai [Wed, 20 Oct 2021 15:13:35 +0000 (17:13 +0200)]
alsamixer: Allow setting the default background color in config

The recent commit c867aa8a84a7 ("alsamixer: use background color
instead of COLOR_BLACK") changed the behavior of alsamixer to take the
system default background color instead of black.  This caused
problems on the terminal setups that have bright background colors,
e.g. yellow is very hard to read.

It could be "fixed" by setting up the color configurations in
~/.config/alsamixer.rc, but this needs to change the all colors in
every element, which is pretty cumbersome.  Instead, this patch
extends the config set command to allow user to specify the default
background color.  A user like me can create their own
~/.config/alsamixer.rc file containing the line

  set background black

and the old good black background is back again.

Note that, for achieving the above, we also had to shuffle the
function call order, to parse the config at first, then initialize
curses.  This shouldn't matter for other behavior.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoalsamixer: Check the availability of mouse
Takashi Iwai [Wed, 20 Oct 2021 13:39:13 +0000 (15:39 +0200)]
alsamixer: Check the availability of mouse

Let's check the availiabiy via has_mouse().  Otherwise the program
aborts unexpectedly just focusing on my rxvt terminal :-(

Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoalsaloop: fixed parsing value 'auto' of option 'sync'
Pavel Hofman [Wed, 13 Oct 2021 12:00:49 +0000 (14:00 +0200)]
alsaloop: fixed parsing value 'auto' of option 'sync'

The value 'auto' was not checked which resulted in using
SYNC_TYPE_NONE instead of SYNC_TYPE_AUTO.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsaloop: added option prateshift for PLAYSHIFT ctl elem used in PLAYSHIFT
Pavel Hofman [Wed, 13 Oct 2021 10:33:43 +0000 (12:33 +0200)]
alsaloop: added option prateshift for PLAYSHIFT ctl elem used in PLAYSHIFT

If snd-aloop device is on playback side, the required sync mode is
PLAYSHIFT. That means Loopback ctl elem "PCM Rate Shift 100000" of the
corresponding capture side of the Loopback pipe must be controlled (by
a reciprocal).

ASCII name of the playback rate shift ctl elem is specified with newly
added option -x/--prateshift, e.g.:
  -P hw:Loopback,0 -S playshift \
  -x iface=PCM,name='PCM Rate Shift 100000',device=1

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoalsaloop: Adding openctl_elem debug log
Pavel Hofman [Fri, 1 Oct 2021 08:00:28 +0000 (10:00 +0200)]
alsaloop: Adding openctl_elem debug log

When debugging what ctl elem was found and opened (if any) a debug log is
helpful.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
3 years agoamixer: print help and add doc for 'sevents' and 'events' commands
Jaroslav Kysela [Mon, 4 Oct 2021 08:40:07 +0000 (10:40 +0200)]
amixer: print help and add doc for 'sevents' and 'events' commands

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsatplg: use standard include/asoundlib.h instead direct headers
Jaroslav Kysela [Fri, 3 Sep 2021 06:49:01 +0000 (08:49 +0200)]
alsatplg: use standard include/asoundlib.h instead direct headers

BugLink: https://github.com/alsa-project/alsa-lib/pull/169
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoamidi: add timestamp option for dump
folkert van heusden [Tue, 24 Aug 2021 09:49:43 +0000 (11:49 +0200)]
amidi: add timestamp option for dump

Added -T / --timestamp option (with parameter "realtime", "monotonic" or "raw") which prints
a timestamp before each received message when using the --dump mode.

Fixes: https://github.com/alsa-project/alsa-utils/pull/108
Signed-off-by: Folkert van Heusden <mail@vanheusden.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoaplay: Fix out-of-bound access in stereo VU meter drawing
Takashi Iwai [Tue, 24 Aug 2021 08:06:05 +0000 (10:06 +0200)]
aplay: Fix out-of-bound access in stereo VU meter drawing

The left channel drawing of a stereo VU meter has a bug where it may
access a negative array index.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoaplay: Handle upper bound in peak calculations
Takashi Iwai [Tue, 24 Aug 2021 08:00:26 +0000 (10:00 +0200)]
aplay: Handle upper bound in peak calculations

Make sure that the calculated max_peak[] won't go beyond the sample
max resolution.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoaplay: Don't pass most negative integer to abs() in peak calculations
Takashi Iwai [Tue, 24 Aug 2021 07:58:29 +0000 (09:58 +0200)]
aplay: Don't pass most negative integer to abs() in peak calculations

The return value from abs() for the most negative integer is
undefined.  Cap it properly for the 32bit sample handling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoaplay: Handle 16bit sample negative overflow in peak calculations
Takashi Iwai [Tue, 24 Aug 2021 07:36:33 +0000 (09:36 +0200)]
aplay: Handle 16bit sample negative overflow in peak calculations

The handling of 16bit samples in the peak calculations has a bug when
a sample with 0x8000 is passed.  As abs() treats 32bit int, it returns
0x8000.  And yet the code stores back into 16bit value again.

To fix that overflow, use 32bit value (i.e. val instead of sval) for
the further calculations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoaplay: Fix conversion of unsigned samples in peak calculation
Takashi Iwai [Tue, 24 Aug 2021 07:00:40 +0000 (09:00 +0200)]
aplay: Fix conversion of unsigned samples in peak calculation

The XOR with the mask has to be applied before calculating abs value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoalsaloop: Support "Capture Pitch 1000000" rate shift
Yunhao Tian [Tue, 27 Jul 2021 15:52:30 +0000 (23:52 +0800)]
alsaloop: Support "Capture Pitch 1000000" rate shift

In Linux 5.14, a new feedback mechanism for USB Audio
Gadget is introduced (commit e89bb428), along with a
new control element "Capture Pitch 1000000". This patch
adds support for this feature. Note that this property
seems to be the reverse of PCM Rate Shift, so we have
to take reciprocal of pitch.

Signed-off-by: Yunhao Tian <t123yh@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoAdded configuration information to manual page
braph [Wed, 7 Jul 2021 19:48:06 +0000 (21:48 +0200)]
Added configuration information to manual page

Added sections FILES and CONFIGURATION.
Removed section BUGS, because the described terminal issues have been fixed.

Signed-off-by: braph <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>