Jaroslav Kysela [Tue, 8 Apr 2025 09:18:16 +0000 (11:18 +0200)]
pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode (#2)
This is basically redo of all changed and add appropriate conditions
to disable only ioctl calls, but preserve tstamp_type assignments.
Fixes: 15f2b276 ("pcm: hw: fix default timestamp type for O_APPPEND") Fixes: 7e01443e ("pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode") Link: https://github.com/alsa-project/alsa-lib/pull/450 Suggested-by: Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode
When the first client of plugins such as dshare open the hw device they set
a default tstamp_type in snd_pcm_direct_initialize_slave based on
tstamp_type from the config file. But when subsequent clients open the same
plugin the snd_pcm_hw_open_fd function clobbers this default.
Closes: https://github.com/alsa-project/alsa-lib/pull/450 Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Mon, 7 Apr 2025 16:45:42 +0000 (18:45 +0200)]
seq: update_group_ports - rewrite blknames update
Resolve the warning bellow and use more optimized calls.
seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:45: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 61 [-Wformat-truncation=]
672 | ", %s", bp->name);
| ^~
seqmid.c:671:33: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 63
671 | snprintf(blknames + len, sizeof(blknames) - len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
672 | ", %s", bp->name);
| ~~~~~~~~~~~~~~~~~
Simon Howard [Wed, 2 Apr 2025 13:56:23 +0000 (09:56 -0400)]
Delete alsalisp code
Install of the alsalisp binary has been disabled since 2006 (in commit 8d382ccd), and building of it was disabled by default in 2018 (in commit 32ceab21), so it is reasonable to assume that nobody is using it.
Use within the alsa-lib project is limited to an aliases file that looks
like it is intended as an example, plus some very small .alisp files
associated with the SiS SI7018 PCI sound card which has not been
manufactured in years. These too have not been installed since 2018 when
commit 32ceab21 disabled building of the alsalisp binary.
In preparing this change, I searched the Github issue tracker for
"lisp", "alisp" and "alsalisp", and found no complaints about the above
changes. I also did a Github code search for projects that might be
including the `alisp.h` header and found none. Therefore I think this
code can be safely deleted and nobody is likely to object.
Closes: https://github.com/alsa-project/alsa-lib/pull/448 Signed-off-by: Simon Howard <fraggle@soulsphere.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Closes: https://github.com/alsa-project/alsa-lib/pull/446 Signed-off-by: Felix Wolfsteller <felix.wolfsteller@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ALSA: seq: Add missing UMP EP cap bit at snd_seq_create_ump_endpoint()
In snd_seq_create_ump_endpoint(), it was forgotten to give the UMP
Endpoint capability bit (SND_SEQ_PORT_CAP_UMP_ENDPOINT) to the port 0
("UMP 2.0"). This resulted in port 0 being a normal port for the
non-existing group.
Fixes: 6167b8ce3e80 ("seq: Add API helper functions for creating UMP Endpoint and Blocks") Closes: https://github.com/alsa-project/alsa-lib/issues/447 Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Thu, 13 Mar 2025 16:46:58 +0000 (17:46 +0100)]
ucm: add sys-card substitution
It may be useful to check additional sysfs parameters like USB descriptors
to determine the exact hardware capabilities.
Introduce 'sys-card' substitution and 'sys' substitution to allow data
fetching from given range. Also, add conversion to hexadecimal format
when the source file has binary contents.
Example - fetch bytes from positions 0x10..0x15 (6 bytes):
Takashi Iwai [Mon, 17 Feb 2025 11:06:09 +0000 (12:06 +0100)]
seq: Fix bogus return of snd_seq_client_info_get_ump_conversion()
snd_seq_client_info_get_ump_conversion() should have returned the
proper bit of group_filter bit field, but it just did return
midi_version field -- a stupid copy & paste error. Let's fix it.
Jaroslav Kysela [Sun, 2 Feb 2025 12:46:12 +0000 (13:46 +0100)]
include: prefer alsa/asoundlib.h for apps, dependency cleanups
Fixes several issues with header files:
- prefer alsa/asoundlib.h file for the alsa-lib core functionalities
(use #warning to inform current and future developers, do the job)
- include alsa/asoundlib.h in headers for external plugins by default
- pcm_external.h: dependencies cleanup
- as benefit, the parsers in IDEs should get all information for individial
header files (see PR#435)
This change was mainly tergetted to fix errors caused by wrong include order
(like for endianness detection, missing typedefs etc.).
Takashi Iwai [Mon, 13 Jan 2025 14:34:49 +0000 (15:34 +0100)]
seq: Define new events for UMP EP/FB change notifications
Two new sequencer event types are added for notifications of UMP info
changes: SND_SEQ_EVENT_UMP_EP_CHANGE (68) and
SND_SEQ_EVENT_UMP_BLOCK_CHANGE (69).
Takashi Iwai [Mon, 13 Jan 2025 14:24:11 +0000 (15:24 +0100)]
rawmidi: Extensions for tied device and substream inactive flag
This is the enhancements of rawmidi API for the new feature added in
6.14 kernel: the indication of a tied device and the inactive flag for
the selected substream.
The new function is added for obtaining the tied device,
snd_rawmidi_info_get_tied_device().
And the new bit flag is defined for indicating the inactive
substream, SNDRV_RAWMIDI_INFO_STREAM_INACTIVE, which is exposed via
snd_rawmidi_info_get_flags().
Takashi Iwai [Sun, 24 Nov 2024 08:33:16 +0000 (09:33 +0100)]
seq: include UMP headers
Some applications seem including alsa/seqmid.h individually, and this
got broken with the update of alsa-lib because now we have
dependencies to UMP stuff. Include the necessary UMP headers
internally. Also, add the inclusion of rawmidi.h in ump.h for similar
reasons.
Nicholas Vinson [Thu, 14 Nov 2024 12:49:53 +0000 (07:49 -0500)]
src/Versions.in.in: Update *_tempo_base name
Change @SYMBOL_PREFIX@snd_has_tempo_base to
@SYMBOL_PREFIX@snd_has_queue_tempo_base.
Starting with version 1.2.13, alsa-lib fails to link with ld.lld-19 due
to "version script assignment of 'ALSA_1.2.13' to symbol
'snd_seq_has_tempo_base' failed: symbol not defined".
Per commit 769d1db1b0a213a39c7e59c0d1d724e7f45b1ac3 the correct name for
the symbol is @SYMBOL_PREFIX@snd_has_queue_tempo_base; therefore, update
src/Vesions.in.in to match.
Closes: https://github.com/alsa-project/alsa-lib/pull/421 Signed-off-by: Nicholas Vinson <nvinson234@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Arkadiusz Bokowy [Sat, 31 Aug 2024 18:31:02 +0000 (20:31 +0200)]
Fix TLV dB parser in case of used container
In case when dB information does not appear as the only TLV type in the
stream (it might be wrapped in a container, but the container can not
have any other type), the TLV parser fails to get the dB TLV pointer.
This commit fixes it by distinguishing between TLV parse error and dB
information not being found in a container (-ENOENT), so the parser can iterate
over all elements in the container.
Also, it fixes out-of-bounds read in case of malicious TLV record.
Closes: https://github.com/alsa-project/alsa-lib/pull/409 Signed-off-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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.