Commit graph

4409 commits

Author SHA1 Message Date
Jaroslav Kysela
ea0850f3f3 test: latency - add --policy option to allow using SCHED_FIFO
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-24 08:33:47 +01:00
Jaroslav Kysela
536c93928b test: latency - usleep should not be used in the block mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-23 19:45:15 +01:00
Jaroslav Kysela
f0f054517c test: latency - add -y option (I/O usleep)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-23 17:56:20 +01:00
Jaroslav Kysela
9649b64c6f ucm: handle empty string also for ${env:} substitution
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-22 09:59:04 +01:00
Jaroslav Kysela
8b64f22459 ucm: clarify set_defaults calls
- do full reset in snd_use_case_mgr_reload

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-15 17:28:39 +01:00
Jaroslav Kysela
a0836e2af1 latency: add timestamps to the POS lines
- remove first capture pos line
- measure the snd_pcm_start() call, too

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 21:27:09 +01:00
Jaroslav Kysela
3e4aeba25b test: latency - add more realtime tests
Add '-x' and '-X' tests and '-U' - I/O update mode based
on the system timing.

It may be required to check the position updates for the specific hardware.
Print the real time / stream time differences.

Also include code to make valgrind happy (including the wrong memory
llocation for the stream buffer).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 20:47:59 +01:00
Jaroslav Kysela
425e4d1fbe pcm: fix the fast_ops pcm argument for fast_ops
The fast_ops callback invocation must always pass the fast_op_arg
as the pcm argument. Plugins expect that.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 14:39:26 +01:00
Jaroslav Kysela
78b20e3caa test: latency - use snd_pcm_format_physical_width()
We need to allocate frames using the physical size not
the sample bit size.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 12:36:07 +01:00
Jaroslav Kysela
152983f01b include: alsa-symbols.h - use newer gcc symver function attribute
Use the symver function attribute for newer gccs (version 11+).
The symver function attribute was introduced probably earlier
(gcc-10). We can fix that on demand later.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 15:18:43 +01:00
Jaroslav Kysela
161f47da5f include: pcm_old.h - use a macro for the symbol versioning
Make the header file more readable and error prone.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 15:03:09 +01:00
Jaroslav Kysela
39060852d8 pcm: rate - correct the previous fix for snd_pcm_rate_may_wait_for_avail_min()
The previous fix in aa4f56c3 was not correct. The root of the cause is
implementation in snd_pcm_may_wait_for_avail_min() inline function
where the improper pcm argument is passed to the fast_ops function.

Fixes: aa4f56c3 ("pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()")
Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 09:35:05 +01:00
Jaroslav Kysela
aa4f56c3c9 pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()
The pcm argument passed to the conversion function in
snd_pcm_plugin_may_wait_for_avail_min_conv() should be
pcm->fast_op_arg.

Test command: arecord -Dplughw:x -r12000 -c2 -fS16_LE -M temp.wav

Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin")

BugLink: https://lore.kernel.org/alsa-devel/1667793912-18957-1-git-send-email-shengjiu.wang@nxp.com/
Fixes: https://github.com/alsa-project/alsa-lib/issues/282
Reported-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 08:18:06 +01:00
Jaroslav Kysela
1b436862ed ucm: fix enhanced ID parsing in snd_use_case_parse_ctl_elem_id()
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-02 15:01:58 +01:00
Jaroslav Kysela
9447e57d7c Release v1.2.8
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-24 10:17:27 +02:00
Jaroslav Kysela
7e678d70c2 control: namehint - do not support 'card' devices
The card: devices do not exist. Do not return -ENOENT,
but -EINVAL in this case.

Fixes: https://github.com/alsa-project/alsa-lib/issues/277
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-24 10:02:54 +02:00
Jaroslav Kysela
3bb9c44375 ucm: do not handle multiple Syntax field updates
It is useful to include a toplevel configuration file from another
toplevel configuration file. Ignore the further Syntax updates
(assuming the that the parent knows what to do).

Also, parse the Syntax field in own function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-20 19:56:50 +02:00
Jaroslav Kysela
4633d35171 control: eld - skip trailing spaces
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-18 15:53:52 +02:00
Jaroslav Kysela
9253f08fb7 pcm: rate: fix the crash for the partial period copy
The size argument in snd_pcm_rate_commit_area can be smaller
than cont in drain. Return the original code. It should
not make things worse. Perhaps, we can fill the rest of
the period with silence in this case.

Fixes: https://github.com/alsa-project/alsa-lib/issues/274
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:58:41 +02:00
Swapnil Devesh
dac9059524 Remove non existent SPDIF output on ThinkPad USB-C Dock Gen2
Fixes: https://github.com/alsa-project/alsa-lib/pull/268
Signed-off-by: Swapnil Devesh <sid.swapnildevesh@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:13:51 +02:00
SASANO Takayoshi
60c1430b43 add DragonFlyBSD build support (except test/)
due to undefined reference to 'environ' error, ucm_exec.c uses workaround.

Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:11:47 +02:00
SASANO Takayoshi
f89245ee66 add FreeBSD build support (except test/)
Note: NetBSD and OpenBSD has both <endian.h> and <sys/endian.h>

Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:11:34 +02:00
SASANO Takayoshi
b33ef3f73d add NetBSD/OpenBSD build support (except test/)
Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:11:29 +02:00
Jaroslav Kysela
e288ca7c29 doc: ucm - more volume notes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:08:11 +02:00
Jaroslav Kysela
595115758b doc: ucm - add sequence graphs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-09-16 19:02:16 +02:00
Jaroslav Kysela
0222f45d11 pcm: hw_params - copy periods and buffer_time to the local variable
It is expected to return the correct numbers for get_periods and
get_buffer_time requests. Copy the appropriate fields in the
hw_params call.

Fixes: https://github.com/alsa-project/alsa-lib/issues/258
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-18 11:23:45 +02:00
Jaroslav Kysela
8033ff9996 pcm: fix the dshare delay reporting
Pulseaudio uses full ring buffer when the incorrect delay is reported.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/198
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-16 17:22:36 +02:00
Jaroslav Kysela
d80616c0c1 ucm: add NULL check for card_name in open
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 22:00:34 +02:00
Jaroslav Kysela
fc86eafa08 ucm: fix few memory-leaks in the error paths
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 21:56:57 +02:00
Jaroslav Kysela
378c6a9215 pcm: direct plugins: make three more symbols private to library
Those symbols should not be exported:
	snd_pcm_direct_poll_descriptors
	snd_pcm_direct_check_xrun
	snd_pcm_direct_slave_recover

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 21:44:50 +02:00
Jaroslav Kysela
27cfa707e3 Release v1.2.7.2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 17:34:30 +02:00
SASANO Takayoshi
9230d000b3 include/sound/type_compat.h: fix include guard
include/sound/type_compat.h uses #define __TYPE_COMPAT_H but it conflicts
same include guard of include/type_compat.h

now, include/sound/type_compat.h uses #define __SOUND_TYPE_COMPAT_H

this is already done in NetBSD's pkgsrc patch.

(thanks to tsutsui@netbsd.org)

Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 17:32:51 +02:00
Stephan Gerhold
cfd3da47fa ucm: fix st_mode check for symbolic links
The file type in the st_mode field is not encoded as unique bits but as
an enumerator. Checking if some bits of S_IFLNK are set does not work
correctly because it happens to evaluate to true for regular files as
well.

The POSIX man page suggests using the following approach to check
the file type:

    if ((sb.st_mode & S_IFMT) == S_IFLNK)

Alternatively, there is a S_ISLNK() macro to check this more easily.

Make use of the latter so that readlink() is only called on actual
symbolic links and not regular files. This makes audio work again
with slightly older alsa-ucm-conf versions or alternative top-level
ucm.conf configurations that do not make use of symlinks.

Fixes: d6adde0e ("ucm: top-level path - set directory from symlink")
Fixes: https://github.com/alsa-project/alsa-lib/pull/249
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 17:31:58 +02:00
Takashi Sakamoto
351a237b2d mixer: add documentation about postcondition of removal event processing
PulseAudio and PipeWire seems to appear including careless code to
process events of mixer element in implementation of mixer class.

 * https://lore.kernel.org/alsa-devel/YrbxZ2b+3rIdi7Ut@workstation/

They register own implementation of mixer class. At addition event,
they attach own mixer element into hcontrol element. However at removal
event, they never detach the mixer element from hcontrol element. They
hit assertion in mixer API internal due to unsatisfied postcondition.

This commit adds documentation about postcondition of removal event
processing so that developer for implementation of mixer class easily
realize the way to satisfy the postcondition.

Fixes: https://github.com/alsa-project/alsa-lib/pull/244
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-27 13:38:25 +02:00
Jaroslav Kysela
65c4796a85 pcm: share plugin: handle -EINTR
Fixes: https://github.com/alsa-project/alsa-lib/pull/242
Fixes: b97047b4 ("pcm: share plugin: return error if socket read or write call fails")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-27 13:36:36 +02:00
Tomohiro IKEDA
b97047b450 pcm: share plugin: return error if socket read or write call fails
Fixes: https://github.com/alsa-project/alsa-lib/pull/242
Signed-off-by: Tomohiro IKEDA <rilakkuma.san.xjapan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-27 13:35:44 +02:00
Jaroslav Kysela
917f412484 rawmidi: fix the params_mode check condition in snd_rawmidi_tread()
The condition should be obviously reversed.

Reported-by: Mark ZurSchmiede <zursch@gmail.com>
Fixes: 5ac61983 ("rawmidi: allow timestamp reads only for the appropriate read mode")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-26 16:07:56 +02:00
Jaroslav Kysela
f91c89da99 Release v1.2.7.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-17 11:42:05 +02:00
Bernd Kuhls
92fff4e9d0 output: include stdarg.h
Fixes a build error with alsa-utils when build with a uClibc toolchain:

alsa-utils/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/alsa/output.h:75:66:
 error: unknown type name ‘va_list’
   75 | int snd_output_vprintf(snd_output_t *output, const char *format, va_list args);
      |                                                                  ^~~~~~~
alsa-utils/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/alsa/output.h:1:1:
 note: ‘va_list’ is defined in header ‘<stdarg.h>’; did you forget to ‘#include <stdarg.h>’?

Fixes: https://github.com/alsa-project/alsa-lib/pull/237
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-17 10:25:39 +02:00
Tomohiro IKEDA
ff0db96bbc pcm: dmix - Add error handler for fgets
Fixes: https://github.com/alsa-project/alsa-lib/pull/238
Signed-off-by: Tomohiro IKEDA <rilakkuma.san.xjapan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-17 10:23:43 +02:00
Jaroslav Kysela
2d56ff8ded ucm: list also hardware configs (hw:X) in uc_mgr_scan_master_configs() fcn
BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/168
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-16 18:03:03 +02:00
Jaroslav Kysela
89ee619147 control: eld - fix the decoding for older hw
It seems that the monitor name is not always present in the
ELD structure. Add asterisk suffix to notify user about
the monitor present for this case.

Thanks goes to Bernhard Rosenkränzer <bero@lindev.ch> for the report.

Fixes: https://github.com/alsa-project/alsa-lib/pull/233
Fixes: https://github.com/alsa-project/alsa-lib/pull/234
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-06 12:14:24 +02:00
Simon McVittie
87ff5318e3 conf: Use ino64_t to save and compare inode numbers
On 32-bit platforms when not using the large-file-support ABI,
struct stat64 contains ino64_t which is 64-bit, while ino_t is only
32-bit.

snd_config_update_r() checks whether a file has been replaced by saving
the ino member of a struct stat64 and comparing it with a previously-saved
inode number. On 32-bit platforms, assigning the 64-bit member of struct
stat64 to a 32-bit member of struct finfo will truncate it modulo 1<<32,
which could conceivably result in libasound not reloading configuration
when it should (although the inode number space is large enough to make
this failure mode highly unlikely).

Fixes: https://github.com/alsa-project/alsa-lib/pull/231
Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-05 10:24:26 +02:00
Jaroslav Kysela
d836146e91 Release v1.2.7
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 16:25:33 +02:00
Jaroslav Kysela
0418fd32c7 ucm: fix the reload call (snd_use_case_mgr_reload)
Handle the local configuration and macros trees properly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-27 14:28:23 +02:00
Jaroslav Kysela
4119e33d28 ucm: implement disdevall sequence command
It is useful to run all disable sequences for all
UCM devices in a verb to ensure the valid, expected
initial state.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-24 16:28:23 +02:00
Jaroslav Kysela
0ba999591b use-case.h: add Channels/ChannelPos values to the documentation
We have use cases, where the channel split is required. We
can use alsa-lib plugins for this job, but some sound servers
or applications may want to do the split themselves.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-24 14:42:44 +02:00
Jaroslav Kysela
7474518a96 ucm: fix memory leak in the error path (Include)
The included configuration tree must be freed
in the error path, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-23 13:29:39 +02:00
Jaroslav Kysela
7f2d6c3aac pcm: hw: change rate range syntax
Allow three configuration types:

  rate 48000			# single rate
  rate [ 48000 ]		# single rate (2nd)
  rate [ 44100 48000 ]		# range

Fixes: https://github.com/alsa-project/alsa-lib/pull/191
Fixes: ac04cb63 ("hw: add "min_rate" and "max_rate" as alternatives to single "rate" parameter")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-20 18:45:23 +02:00
Benedek Kupper
d85c0d8d46 pcm: hw: add "min_rate" and "max_rate" as alternatives to single "rate" parameter
Fixes: https://github.com/alsa-project/alsa-lib/pull/191
Signed-off-by: Benedek Kupper <benedek.kupper@streamunlimited.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-20 18:44:42 +02:00