Commit graph

1750 commits

Author SHA1 Message Date
Takashi Iwai
5d4442b2cf alsamixer: Allow setting the default background color in config
The recent commit c867aa8a84 ("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>
2021-10-20 17:24:35 +02:00
Takashi Iwai
31820c5f23 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>
2021-10-20 17:24:30 +02:00
Pavel Hofman
0fd3022e82 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>
2021-10-13 14:05:02 +02:00
Pavel Hofman
138e53aabb 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>
2021-10-13 13:52:12 +02:00
Pavel Hofman
e2b167c490 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>
2021-10-04 10:44:46 +02:00
Jaroslav Kysela
68473a41c6 amixer: print help and add doc for 'sevents' and 'events' commands
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-10-04 10:40:14 +02:00
Jaroslav Kysela
1a32420577 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>
2021-09-03 08:49:03 +02:00
folkert van heusden
9a8fcec5aa 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>
2021-08-24 12:05:52 +02:00
Takashi Iwai
dea51861a8 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>
2021-08-24 10:06:05 +02:00
Takashi Iwai
2efe124c31 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>
2021-08-24 10:00:26 +02:00
Takashi Iwai
d9b3133815 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>
2021-08-24 09:58:29 +02:00
Takashi Iwai
5c4bf63a94 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>
2021-08-24 09:53:53 +02:00
Takashi Iwai
0ea7bfea83 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>
2021-08-24 09:51:39 +02:00
Yunhao Tian
ce05208085 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>
2021-08-23 16:55:36 +02:00
braph
2b9bfacca7 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>
2021-08-23 16:50:47 +02:00
Ranjani Sridharan
a1c2275090 topology:pre-process-object: merge object config with parent object config
An object can be declared within a class definition as follows:

Class.Pipeline.volume-playback {
	Object.Widget.pga.0 {
		ramp_step_ms 250
	}
}

While instantiating the volume-pipeline class, the pga object
could be modified as follows:

Object.Pipeline.volume-playback.0 {
	Object.Widget.pga.0 {
		format "s24le"
	}
}

When building the pga.0 object in the class definition, merge
the attributes declared in the volume-playback.0 object to create
a new config as follows to make sure that all attributes are
set for the pga object.

	Object.Widget.pga.0 {
		ramp_step_ms 250
                format "s24le"
        }

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
814dc3b19e pre-process-object: set tlv name if config exists already
Do not create TLV config if it exists already. Just
set the string value with the name name.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
b13a940618 pre-process-dapm: add data section for kcontrols
Allow support for adding data section for kcontrols.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
3d55a99ccd topology: pre-processor: fix typo in pre_process_config()
Fix typo in config variable name. Should be n2 instead of n.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
c1f0ec46b4 topology: pre-process-object: dont create if section already exists
Skip creating section when it exists already.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
3c81766242 pre-process-object: skip parent update if parent is NULL
Nothing to do for top-level objects with no parent.
Also, add access to the bytes control template.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
268f599d24 pre-process-dapm: fix source and sink for DAPM routes
Switch source and sink widgets in the DAPM route.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Ranjani Sridharan
48ebb1dc0c topology: pre-process-object: Add support for pre-process objects with no builder
Some objects just need tobe processed to add their attributes
to the private data section of their parent objects.
An example of this would be the pdm_config objects for
DMIC DAI's. Each pdm_config object's attributes need
to be added as separate arrays in the DAI object's
private data.

Modify the signature of tplg_add_object_data() to pass
the array_name parameter when multiple objects of the
same type in the same parent are processed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Chao Song
b848786f42 topology: pre-process-dapm: update automatic attributes for buffer
Add the function to compute the value for the
"size" automatic attribute in the buffer objects.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Chao Song
88c6dd6cf4 topology: pre-process-object: add support for updating automatic attributes
Classes definitions in Topology2.0 can have attributes
qualified with the "automatic" constraint. Values for
these attributes will be calculated by the compiler.
This patch provides a generic method for defining automatic
attributes computation logic for different classes.

To update automatic attributes for a class, add an item
in object_build_map with auto_attr_updater defined, and then
add updating logic in the custom auto_attr_updater function.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-23 16:49:56 +02:00
Jaroslav Kysela
5471a0b285 aseqnet: add ipv6 support
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-09 20:24:44 +02:00
Jaroslav Kysela
c8e5762750 aseqnet: use getaddrinfo() instead obsolete gethostbyname()
- modernize code (preparation for IPv6)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-09 18:11:37 +02:00
Jaroslav Kysela
f076518254 alsatplg: do not do NULL check for string arrays
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-18 10:15:46 +02:00
Jaroslav Kysela
0b8d2dfdcc alsatplg: fix memory-leak in tplg_construct_object_name()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-18 10:11:34 +02:00
Jaroslav Kysela
9e59c928af Release v1.2.5.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 12:28:46 +02:00
Jaroslav Kysela
fc7500c3c7 arecord: Inform users when 8-bit sampling is used on tty
When we reverted 0c5948e ("aplay: try to use 16-bit format to
increase capture quality"), we should also handle the original
problem somehow. This code shows a warning with a hint to
the right parameter.

Fixes: https://github.com/alsa-project/alsa-utils/issues/96
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 12:25:10 +02:00
Jaroslav Kysela
f35b66d8f1 Revert "aplay: try to use 16-bit format to increase capture quality"
This reverts commit 0c5948e98a.

Link: https://github.com/alsa-project/alsa-utils/issues/96
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 12:02:51 +02:00
Andrea Piras
0e21f4d864 added an option to aseqnet to optionally set the midi process name
This option allows to run multiple instances of aseqnet without having
to double check the assigned port number, since each one can get spawned
with a unique name.

Fixes: https://github.com/alsa-project/alsa-utils/pull/95
Signed-off-by: Andrea Piras <andrea.piras.85@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 12:00:44 +02:00
Andreas Müller
6a0d13ddb2 utils.c: Include limits.h explicitly to fix build on musl
Fixes:
| ../../alsa-utils-1.2.5/alsactl/utils.c: In function 'snd_card_clean_cfgdir':
| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: error: 'PATH_MAX' undeclared (first use in this function)
|   309 |         char path[PATH_MAX];
|       |                   ^~~~~~~~
| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: note: each undeclared identifier is reported only once for each function it appears in

Fixes: https://github.com/alsa-project/alsa-utils/pull/92
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-07 19:13:47 +02:00
Sören Tempel
6018c2014a alsactl: load_state: Only delete config if one was loaded
If load_configuration fails with open_failed == true, load_state will
jump to the out label without config being initialized and pass this
uninitialized config value to snd_config_delete. This commit fixes this
issue by initializing config with NULL and checking if it is non-null
before invoking snd_config_delete.

Fixes: https://github.com/alsa-project/alsa-utils/pull/94
Fixes: f138117 ("alsactl: load_state() - initialize config variable for the open_failed case")
BugLink: https://github.com/alsa-project/alsa-utils/issues/93
Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-07 19:06:19 +02:00
Jaroslav Kysela
f138117a45 alsactl: load_state() - initialize config variable for the open_failed case
Fixes: https://github.com/alsa-project/alsa-utils/issues/93
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-07 17:21:58 +02:00
Jaroslav Kysela
c58f981e15 topology: fix few coverity detected defects
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 10:19:41 +02:00
Jaroslav Kysela
74ad91245f axfer: fix wrong calloc() item size in allocate_containers()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 10:12:06 +02:00
Jaroslav Kysela
cd2f779b8d alsactl: fix lock_fd unlock in load_configuration() - error path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 10:08:18 +02:00
Jaroslav Kysela
646d6ff094 alsactl: state - fix ‘item’ may be used uninitialized gcc warning
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 10:04:50 +02:00
Jaroslav Kysela
2bc595e7bd alsactl: check for error values from snd_config_get...()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 10:04:00 +02:00
Jaroslav Kysela
511dd7a597 alsactl: init() - return error value from snd_card_iterator_sinit() call
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 09:56:20 +02:00
Jaroslav Kysela
d6d566a9ee alsactl: return error value in dump_config_tree()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 09:53:56 +02:00
Chao Song
3d7a6facd9 topology: fix potential null pointer from strchr
This patch adds check to the return pointer from strchr,
because it may be null and cause segment fault, if component
is not properly constructed.

Fixes: https://github.com/alsa-project/alsa-utils/pull/91
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-02 16:55:57 +02:00
Jaroslav Kysela
78212445de alsactl: fix the nested iteration
There may be nested iterations for hw: card names.
Handle this card name in snd_card_iterator_sinit().

BugLink: https://github.com/alsa-project/alsa-lib/issues/142
Fixes: eefc2c6 ("alsactl: use card iterator functions for all card loops")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-01 17:49:27 +02:00
Jaroslav Kysela
ef62ab34fc Release v1.2.5
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-27 19:18:36 +02:00
Jaroslav Kysela
62f97bd3a7 amixer: Makefile - add volume_mapping.h to noinst_HEADERS
Fixes: dc20c4b ("amixer: add the volume_mapping.h link")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:58:53 +02:00
Jaroslav Kysela
dc20c4b512 amixer: add the volume_mapping.h link
Fixes: 75e644d ("amixer: link volume_mapping.c from alsamixer to amixer")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:48:00 +02:00
Jaroslav Kysela
8037d4812e topology: some whitespace fixups
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:36:46 +02:00
Ranjani Sridharan
1832f6f254 topology: pre-process-object: add support for prepocessing child objects
Add support for processing object instances embedded
within objects and classes. For example:
		Object.Control.mixer."0" {
			#Channel register and shift for Front Left/Right
			Object.Base.channel."fl" {
				shift	0
			}
			Object.Base.channel."fr" {
			}

			Object.Base.tlv."vtlv_m64s2" {
				Object.Base.scale."m64s2" {
					mute	1
				}
			}

			Object.Base.ops."ctl" {
				info 	"volsw"
				#256 binds the mixer control to volume get/put handlers
				get 	256
				put 	256
			}
		}

and pga class embeds the mixer objects as follows:
Class.Widget."pga" {
...
Object.Control {
		mixer."0" {...}
		mixer."1" {...}
}

The pre-processor starts with the top-pevel PGA widget object
and processes the mixer objects in the class definition.
This will recursively pre-processes its child objects to add the channels,
tlv and ops.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 18:26:51 +02:00