spcm->info bits should be a copy of the slave PCM info as is.
While we clear the unsupported SND_PCM_INFO_PAUSE bit there, it should
be rather cleared only for the exposed info to apps, not spcm->info.
Fixes: 982786e9ebff ("Fix bogus pause flag on dmix") Signed-off-by: Takashi Iwai <tiwai@suse.de>
The fix for PCM dmix suspend/resume checks spcm->info bit of
SND_PCM_INFO_RESUME for applying a workaround for drivers with the
full resume support. This assumed that scpm->info is exposed from the
underlying slave PCM device.
The above is true for the first opened instance, but for the second
opened instance, it's a copy from the saved data in shmem. And, we
dropped SND_PCM_INFO_RESUME bit there to assure not to expose the full
resume capability to applications. This resulted in the
inconsistencies, and when the second instance is resumed at first, it
misses the snd_pcm_resume() call, hence the driver doesn't react
properly any longer.
For addressing it, we keep SND_PCM_INFO_RESUME bit in shmptr->s.info
bits as is, while dropping the bit exposed to apps in
snd_pcm_direct_hw_refine() and *_hw_params() callbacks.
Fixes: 6d1d620eadf3 ("pcm: dmix: resume workaround for buggy driver") Reported-and-tested-by: Chancel Liu <chancel.liu@nxp.com> Closes: https://lore.kernel.org/DB9PR04MB94988752ED7C43B399E0BC00E3942@DB9PR04MB9498.eurprd04.prod.outlook.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Fri, 6 Sep 2024 07:58:47 +0000 (09:58 +0200)]
Fixes: 5600b901 ("async: snd_async_del_handler - move clear signal using sigaction as last")
A wrong list head is used to check if the given list with async handlers
is empty. Correct this.
Takashi Iwai [Tue, 20 Aug 2024 12:27:13 +0000 (14:27 +0200)]
Sync UAPI asound.h and asequencer.h with 6.12 kernel
The recent upstream kernel received a few features and extended /
cleaned up the asound.h and asequencer.h uapi files:
- ALSA: pcm: Introduce MSBITS subformat interface
- ALSA: pcm: clarify and fix default msbits value for all formats
- ALSA: pcm: reinvent the stream synchronization ID API
- ALSA: timer: Introduce virtual userspace-driven timers
Takashi Iwai [Wed, 7 Aug 2024 13:46:31 +0000 (15:46 +0200)]
seq: Add snd_seq_{get|set}_ump_is_midi1() API functions
Implement the API function calls corresponding to the new sequencer
port flag bit that has been added recently to the kernel.
A UMP MIDI 2.0 device allow to have an optional MIDI 1.0 port while
speaking in MIDI 2.0 protocol for other UMP Groups. The new seq port
flag indicates that.
This is rather a minor difference, and since ALSA sequencer core
covers the all conversions, usually you don't have to worry about it
at all.
For making it easier to extract a byte from the UMP packet no matter
which endian is used, introduce a new helper function
snd_ump_get_byte(). It'll be useful for retrieving SysEx byte or a
name string.
seq: Fix wrong FB direction at snd_seq_create_ump_block()
snd_seq_create_ump_block() receives a snd_ump_block_info_t data at the
creation of a FB and updates its associated sequencer port, but it
handled the port direction incorrectly. The UMP / port direction
means the connectivity, but the current code translated other way
round. The correct translation should be that input = receiver, i.e.
a writable port for applications, and output = source, a readable port
for applications.
This patch corrects the translation, and add more comments to the
direction definition.
seq: Add API functions to set different tempo base values
MIDI2 Set Tempo message uses 10ns-based values, and we need to update
the API to change the base time unit.
This patch adds a few new API functions:
- snd_seq_has_queue_tempo_base() returns 1 if the client supports a
new tempo-base value; if 0, it's an old system and application has
to use the tempo in the fixed 1us unit
- the tempo base can be changed with
snd_seq_queue_tempo_set_tempo_base(), provided in nsec unit;
the value has to be either 10 or 1000 (or 0 as default, equivalent
with 1000)
The protocol version is checked and fallback to the fixed 1us base for
the old clients.
Takashi Iwai [Wed, 26 Jun 2024 14:53:17 +0000 (16:53 +0200)]
ump_msg: Fix the wrong snd_ump_msg_system_t argument in little-endian
For the little-endian format, the parameters are stored incorrectly
in snd_ump_msg_system_t type. Swap the both parameter positions to
correct to the right positions.
Fixes: 040356ecf06b ("ump: Add helpers to parse / set UMP packet data") Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 19 Jun 2024 15:22:15 +0000 (17:22 +0200)]
test: Add an example program to create a virtual UMP Endpoint
Provide an example program to demonstrate how to create a UMP Endpoint
and Blocks, i.e. a virtual UMP device.
It's a simple filtering application that just haves the incoming note
on/off velocity and sends out to the output. The UMP Endpoint and
Block attributes can be adjusted via command-line options.
Takashi Iwai [Wed, 19 Jun 2024 12:35:36 +0000 (14:35 +0200)]
seq: Add API helper functions for creating UMP Endpoint and Blocks
For making it easer for applications to create a virtual UMP Endpoint
and UMP blocks, add two API helper functions.
snd_seq_create_ump_endpoint() creates (unsurprisingly) a UMP Endpoint,
based on the given snd_ump_endpoint_info_t information. The number of
(max) UMP groups belonging to this Endpoint has to be specified.
This function sets up the Endpoint info on the sequencer client, and
creates a MIDI 2.0 UMP port as well as UMP Group ports automatically.
The name of the sequencer client is updated from the Endpoint name,
too.
After creating a UMP Endpoint, create each UMP Block via
snd_seq_create_ump_block() function with a snd_ump_block_info_t info.
The associated groups for each block have to be specified there.
The port names and capability bits are updated accordingly after
setting each block information.
Jaroslav Kysela [Tue, 4 Jun 2024 09:17:57 +0000 (11:17 +0200)]
async: snd_async_del_handler - move clear signal using sigaction as last
Improve the shutdown order for the asynchronous users. There may be
unhandled signals, because the signal is reset before signal deactivation
using fnctl (O_ASYNC).
Closes: https://github.com/alsa-project/alsa-lib/issues/394 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Peter Ujfalusi [Tue, 23 Apr 2024 07:09:46 +0000 (10:09 +0300)]
conf: aliases: hdmi: Include unconditionally the
The hdmi.conf contains the high level macro to be used by cards to create
the hdmi: device.
Instead of including it in different config files, include it in the main
aliases.conf and remove it's inclusion by other config files.
This change is needed to add support for the hdmi: device mapping via UCM.
Closes: https://github.com/alsa-project/alsa-lib/pull/393 Suggested-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Senoner [Mon, 26 Feb 2024 14:14:03 +0000 (15:14 +0100)]
conf: USB-Audio: Add Corsair HS60 Pro to the IEC958 blacklist
This device is just an external USB soundcard with a female 3.5mm jack
for a headset, no S/PDIF | IEC958 connector. Add it to the blacklist to
prevent it being opened.
Jaroslav Kysela [Fri, 23 Feb 2024 20:50:01 +0000 (21:50 +0100)]
pcm: clarify and fix default sbits (msbits) value for all formats
As described in the kernel patch (link bellow), the significant (resolution)
bits should be related to the usable sample bits not the physical sample bits.
Marc Aldorasi [Fri, 23 Feb 2024 04:42:57 +0000 (23:42 -0500)]
pcm: ladspa - Skip missing ladspa directories
Closes: https://github.com/alsa-project/alsa-lib/pull/385 Signed-off-by: Marc Aldorasi <m101010a@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Fri, 9 Feb 2024 10:21:04 +0000 (11:21 +0100)]
pcm: plug - add automatic conversion for iec958 subframe samples
As Pavel noted, a possibility to automatically convert standard
linear samples to iec958 subframe format would be handy for latest
Raspberry HDMI driver.
Jan Palus [Tue, 30 Jan 2024 13:24:25 +0000 (14:24 +0100)]
topology: correct version script path
contrary to libasound, version script for libatopology is a regular
source file. while it's often the case that $(builddir) and $(srcdir)
point to the same directory, they don't always have to. therefore path
needs to point explicitly to $(srcdir) for Versions script in topology
Closes: https://github.com/alsa-project/alsa-lib/pull/383 Fixes: GH-382 Fixes: dc7da761f3a2 ("topology: separate Versions linker script") Signed-off-by: Jan Palus <jpalus@fastmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Tim Blechmann [Mon, 5 Dec 2022 06:42:58 +0000 (14:42 +0800)]
headers: avoid c++ keyword
`class` is a c++ keyword, let's try not to use them in public headers
Closes: https://github.com/alsa-project/alsa-lib/pull/286 Signed-off-by: Tim Blechmann <tim@klingt.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Ryan Underwood [Sat, 13 May 2023 22:16:34 +0000 (17:16 -0500)]
conf: pcm: Set C-Media USB 7.1 sound card (ICUSBAUDIO7D) to six_channel for surround40
This 7.1 analog sound card identifies as the following:
0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device (lsusb)
1 [ICUSBAUDIO7D ]: USB-Audio - ICUSBAUDIO7D (/proc/asound/cards)
It has the following four-channel analog stream layout:
Interface 1
Altset 3
Format: S16_LE
Channels: 4
Endpoint: 6 OUT (ADAPTIVE)
Rates: 44100, 48000
Bits: 16
Channel map: FL FR FC LFE
(/proc/asound/card1/stream0)
This layout makes it impossible to play audio to the surround (SL/SR)
speakers plugged into the "Surround" jack in 4 channel mode. Instead,
set six_channel so that the six-channel layout will be used to access
those speakers:
Interface 1
Altset 4
Format: S16_LE
Channels: 6
Endpoint: 6 OUT (ADAPTIVE)
Rates: 44100, 48000
Bits: 16
Channel map: FL FR FC LFE SL SR
Tested with speaker-test -Dsurround40:CARD=ICUSBAUDIO7D,DEV=0 -c4
The speaker system that required surround40 in order to downmix LFE into
the front/rear mix is a Klipsch ProMedia v.2-400, which has 4 speakers
and a subwoofer with an internal crossover, connected via front and rear
stereo analog cables.
Closes: https://github.com/alsa-project/alsa-lib/pull/319 Signed-off-by: Ryan Underwood <nemesis@icequake.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Nicholas Vinson [Thu, 4 Jan 2024 01:24:36 +0000 (20:24 -0500)]
src/Versions.in: Add guards for pcm and timer syms
Configure script allows for the disabling of the pcm module. When
disabled, the pcm symbols will not be available. Add guards to remove
symbols from version map when not present.
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>
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>