Nicholas Vinson [Sun, 7 Jan 2024 03:54:56 +0000 (22:54 -0500)]
configure.ac: Update AC_OUTPUT() function
Modern autoconf practice says AC_OUTPUT() should be called with no
arguments and generated configuration files should be specified by
calling AC_CONFIG_FILES() before AC_OUTPUT().
Update configure.ac to follow this practice.
Closes: https://github.com/alsa-project/alsa-lib/pull/376 Signed-off-by: Nicholas Vinson <nvinson234@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Tue, 23 Jan 2024 15:16:41 +0000 (16:16 +0100)]
topology: separate Versions linker script
A slightly different solution is preferred than PR recommends (bellow).
Only symbols with snd_ prefix should be public. Create a minimal Versions
file for libatopology.
Zeno Endemann [Fri, 24 Nov 2023 13:33:47 +0000 (14:33 +0100)]
pcm: clarify documentation of poll descriptor usage
This is based on my understanding of the intended behavior, the
test/pcm.c example code, as well as the github pull request
discussion (#370).
There needs to be more clarifiaction regarding the exact semantics
of the value of the revents output parameter of
snd_pcm_poll_descriptors_revents, since there are events that do
not necessarily correspond to POLLIN or POLLOUT (such as period
events), but I believe this is a lot less obvious and needs
confirmation first.
Closes: https://github.com/alsa-project/alsa-lib/pull/370 Signed-off-by: Zeno Endemann <zeno.endemann@mailbox.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Mon, 6 Nov 2023 15:33:59 +0000 (16:33 +0100)]
seq: Simplify snd_seq_extract_output()
Now that we never put UMP events on the output buffer in the legacy
mode, the check and skip of UMP events are no longer necessary.
It means that ump_allowed argument is meaningless in extract_output(),
too.
Let's drop the unnecessary check and move the code extract_output()
into snd_seq_extract_output() again, and call this directly from
snd_seq_ump_extract_output() for simplification.
Takashi Iwai [Mon, 6 Nov 2023 15:27:11 +0000 (16:27 +0100)]
seq: Clear UMP event flag for legacy apps
It seems that some applications (at least Chrome WebMIDI) set random
bits to the flags of event packet, and this confuses as if they were
UMP-events, which are eventually filtered out.
Although it's a bug of applications, it's better to avoid the
regressions. So this patch forcibly clears the UMP flag of the
incoming and outgoing events when the application is running in the
legacy mode (i.e. midi_version = 0).
Hector Martin [Sat, 28 Oct 2023 12:33:29 +0000 (21:33 +0900)]
mixer: simple: Support dB TLVs for CTL_SINGLE controls
dB mappings do not work for controls not named "* Volume", since we do not
fall back to CTL_SINGLE in get_selem_ctl. Add that branch to make it
work.
Fixes dB ranges for e.g. controls named "* Gain".
Closes: https://github.com/alsa-project/alsa-lib/pull/358 Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Wed, 13 Sep 2023 10:27:21 +0000 (12:27 +0200)]
reshuffle included files to include config.h as first - v2
config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).
Fixes: ad3a8b8b ("reshuffle included files to include config.h as first")
Related: https://github.com/alsa-project/alsa-lib/pull/333 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The recent rearrangement of header inclusion order caused a regression
showing segfaults on 32bit Arm. The primary reason is the
inconsistent compile condition depending on the inclusion of config.h;
while most of other code include pcm_local.h (that implicitly includes
config.h) at first, pcm_direct.c doesn't do it, hence the access with
direct plugins crashes.
For fixing it, we need to include config.h at the beginning. But,
it's better to include pcm_local.h for all relevant code for
consistency. The patch does it, and also it adds the guard in
pcm_local.h for double inclusions.
control.c: In function 'snd_ctl_open_conf':
../../include/global.h:98:36: warning: implicit declaration of function '__STRING' [-Wimplicit-function-declaratio]
98 | #define SND_DLSYM_VERSION(version) __STRING(version)
| ^~~~~~~~
Fixes: https://github.com/alsa-project/alsa-lib/issues/350 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Mon, 4 Sep 2023 07:38:26 +0000 (09:38 +0200)]
control.h: Fix ump header file detection
Apparently, the control.h is used from apps separately (outside
asoundlib.h). Avoid errors like:
/usr/include/alsa/control.h:417:47: error: ‘snd_ump_endpoint_info_t’ has not been declared
417 | int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info);
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/alsa/control.h:418:44: error: ‘snd_ump_block_info_t’ has not been declared
418 | int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info);
| ^~~~~~~~~~~~~~~~~~~~
Fixes: https://github.com/alsa-project/alsa-lib/issues/348 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ac_check_attribute_symver.m4 was downloaded from
https://github.com/smuellerDD/libkcapi/blob/master/m4/ac_check_attribute_symver.m4
Fixes: https://github.com/alsa-project/alsa-lib/pull/334 Signed-off-by: Tan En De <ende.tan@starfivetech.com> Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Bernd Kuhls <bernd@kuhls.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Sat, 26 Aug 2023 19:21:13 +0000 (21:21 +0200)]
seq: Fix wrong seq version update at snd_seq_hw_get_client_info()
snd_seq_hw_get_client_info() calls mistakenly update_midi_version()
that leads to the update of seq->version from another client info.
It may lead to the inconsistent packet size calculation and the
unaligned read, eventually a program may hit segfault.
Drop the incorrect call of update_midi_version() for fixing it.
Dan Cross [Wed, 14 Jun 2023 21:09:10 +0000 (21:09 +0000)]
pcm: hw: fix minor bug in sw_params ioctl
Commit 2115cdb added a new call to the `SNDRV_PCM_IOCTL_SW_PARAMS`
ioctl on line 675 of src/pcm/pcm_hw.c, but passed the `sw_params`
argument by value; this should be passed by pointer.
I ran across this in the context of the direwolf software modem
for amateur radio; debugging details are in
https://groups.io/g/direwolf/message/8286
Fixes: https://github.com/alsa-project/alsa-lib/pull/330 Signed-off-by: Dan Cross <cross@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Thu, 17 Nov 2022 14:49:44 +0000 (15:49 +0100)]
seq: Add UMP support
This patch adds the basic support of UMP on ALSA sequencer API.
An extended event type, snd_seq_ump_event_t, is defined. It's
compatible with the existing type, snd_seq_event_t, but it has a
larger payload of 16 bytes instead of 12 bytes, for holding the full
128bit UMP packet.
The new snd_seq_ump_event_t must have the bit SND_SEQ_EVENT_UMP in the
event flags.
A few new API functions have been added such as
snd_seq_ump_event_output() and snd_seq_ump_event_input() for
reading/writing this new event object.
The support of UMP in the sequencer client is switched by the function
snd_seq_client_set_midi_version(). It can switch from the default
legacy MIDI to UMP MIDI 1.0 or 2.0 on the fly.
The automatic event conversion among UMP and legacy clients can be
suppressed via snd_seq_client_set_ump_conversion().
The inquiry of the associated UMP Endpoints and UMP Blocks can be done
via snd_seq_get_ump_endpoint_info() and snd_seq_get_ump_block_info().
Takashi Iwai [Sun, 25 Dec 2022 11:09:51 +0000 (12:09 +0100)]
control: Add UMP device query support
Add a function to query the next available UMP device via control
interface, just like the existing one for rawmidi. As the UMP rawmidi
is compatible with the standard rawmidi, no extra helper for the
rawmidi_info is present. Ditto for the preferred subdevice, too.
Takashi Iwai [Mon, 22 May 2023 15:55:51 +0000 (17:55 +0200)]
uapi: Update control API to 2.0.9
Copied from the kernel uapi header for control API.
A few new ioctls have been added for the support of UMP next device
and inquiries of UMP Endpoint and Block info.
Jaroslav Kysela [Wed, 3 May 2023 20:24:47 +0000 (22:24 +0200)]
pcm: hw: fix the silence size setup in drain
The silence size cannot exceed the silence threshold. Move the check
from the manual condition to the common code. This may happen for
small ring buffers (where the 1/10th second is too large).
Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The application may not require to touch the playback
sample stream for the drain operation at all. In this case,
the application is responsible to setup a silencing mechanism
for the playback or another graceful stop (like using the
rewind operation).
Jaroslav Kysela [Tue, 25 Apr 2023 12:36:19 +0000 (14:36 +0200)]
pcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAIN
Handle the driver informing us that it is not necessary to set up
silencing upon playback draining. This will be the case for drivers
which are guaranteed to not read any samples beyond the application
pointer.
Jaroslav Kysela [Fri, 21 Apr 2023 14:12:24 +0000 (16:12 +0200)]
pcm: hw: setup explicit silencing for snd_pcm_drain by default
Some applications may not alignt transfers to the period size
and also the driver developers may not follow the consequeces of the
access beyond valid samples in the playback DMA buffer.
To avoid clicks, fill a little silence at the end of the playback
ring buffer when snd_pcm_drain() is called.
Related: https://lore.kernel.org/alsa-devel/20230420113324.877164-2-oswald.buddenhagen@gmx.de/
Related: https://lore.kernel.org/alsa-devel/20230405201219.2197789-2-oswald.buddenhagen@gmx.de/ Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- rename devname -> pcmdev, it conflicts *BSD <stdlib.h> function
- replace <values.h> -> <limits.h> and fix K&R style related warning
- use config.h to determine include <malloc.h>
- add OpenBSD support and fix printf() warning
- fix warning
Fixes: https://github.com/alsa-project/alsa-lib/pull/298 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology: Parse ignore_suspend property for dapm widget
snd_soc_tplg_dapm_widget has ignore_suspend field, but there is no way
to set value for it, because we don't parse topology field for it.
Fix this by adding parsing code.
Fixes: https://github.com/alsa-project/alsa-lib/pull/230 Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology: Add decompilation support for ignore_suspend
Previous patch added build support for ignore_suspend, however it should
be also possible to decompile binary back to human readable form and not
lose data.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cezary Rojewski [Wed, 27 Mar 2019 14:45:04 +0000 (15:45 +0100)]
topology: Parse ignore_suspend flag
XXX_VOICE_WAKEUP also known as 'ignore_suspend' is already processed by
kernel in soc-topology, but there is no way of setting it via topology
file like it's the case for other flags. Fix this by adding it to pcm,
dai and link parsing mechanism.
Signed-off-by: Piotr Maziarz <piotrx.maziarz@intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Sam James [Sun, 30 Oct 2022 18:06:37 +0000 (18:06 +0000)]
utils/alsa.m4: include <stdlib.h> for exit()
Clang 16 makes -Wimplicit-function-declaration an error by default
and it's easier to just explicitly include <stdlib.h> rather
than hope the ALSA headers always have it.
Fixes: https://github.com/alsa-project/alsa-lib/pull/278 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>