Commit graph

3422 commits

Author SHA1 Message Date
Nicholas Vinson
76edab4e59 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 769d1db1b0 the correct name for
the symbol is @SYMBOL_PREFIX@snd_has_queue_tempo_base; therefore, update
src/Vesions.in.in to match.

Fixes bug #420
Fixes Gentoo bug 943399 (https://bugs.gentoo.org/943399)

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>
2024-11-15 09:27:10 +01:00
Jaroslav Kysela
49295a4e17 control: remap - clarify comments and docs
Fix copy-n-paste errors.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-12 10:32:56 +01:00
Jaroslav Kysela
4e7a510095 control: remap - fix copy-n-paste in _snd_ctl_remap_open's comment
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-10-24 11:08:00 +02:00
Jaroslav Kysela
93d7645d84 pcm: close - deactivate async handler before snd_pcm_drop()
It reduces probablity to activate the async handler when snd_pcm_close() is called.

Link: https://github.com/alsa-project/alsa-lib/issues/394
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 12:58:14 +02:00
Arkadiusz Bokowy
9ac93d1252 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>
2024-09-06 10:51:06 +02:00
Takashi Iwai
fc58f8fcc3 pcm: dmix: Don't clear scpm->info flag
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: 982786e9eb ("Fix bogus pause flag on dmix")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-09-06 10:15:46 +02:00
Takashi Iwai
2adc30e983 pcm: dmix: Fix resume with multiple instances
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: 6d1d620ead ("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>
2024-09-06 10:13:29 +02:00
Jaroslav Kysela
3b9f3b9431 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.

Link: https://github.com/alsa-project/alsa-lib/issues/394
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 09:58:47 +02:00
Takashi Iwai
645668dca2 src/Versions.in: Add the new snd_pcm_hw_params_get_sync for 1.2.13
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-20 16:21:33 +02:00
Jaroslav Kysela
b154d9145f pcm: implement snd_pcm_hw_params_get_sync() and obsolete snd_pcm_info_get_sync()
Use the new clock source mechanism to get information about
similar PCM clock sources for PCM streams.

Link: https://lore.kernel.org/linux-sound/20240625172836.589380-1-perex@perex.cz/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-08-20 15:43:30 +02:00
Takashi Iwai
fa673b719c control: Make ump_{endpoint|block}_info calls optional
Add the NULL check for ump_endpoint_info and ump_block_info calls.
Those can be NULl depending on the target.

Fixes: 81b0cf46d1 ("control: Add UMP Endpoint and Block info query support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-15 16:26:33 +02:00
Takashi Iwai
769d1db1b0 seq: Correct a typo in documentation
The right function name is snd_seq_has_queue_tempo_base().

Fixes: 24c7f42733 ("seq: Add API functions to set different tempo base values")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-07 15:50:21 +02:00
Takashi Iwai
ddc4c668ba 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-07 15:48:26 +02:00
Takashi Iwai
d969439813 seq: Avoid strlcat()
strlcat() isn't available in every system, so better to avoid it.
Rewrite the code without strlcat().

Fixes: 6167b8ce3e ("seq: Add API helper functions for creating UMP Endpoint and Blocks")
Link: https://lore.kernel.org/0796c157-1ac3-47a3-9d54-ba86f59d64d5@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-31 11:20:16 +02:00
Takashi Iwai
48101de6fa 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-09 07:23:23 +02:00
Takashi Iwai
24c7f42733 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-05 17:12:44 +02:00
Takashi Iwai
568b2ac1db ump: Add a function to provide the packet word length of a UMP type
Add a helper function to return the number of words of a given UMP
packet type.  Used for parsing MIDI Clip File stream, for example.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-04 14:44:00 +02:00
Takashi Iwai
32e2c8d8a2 src/Versions.in: Add guards for sequencer and rawmidi syms
Similarly like PCM and others, add the ifdef guards for new symbols
for sequencer and rawmidi interfaces.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:46:35 +02:00
Takashi Iwai
2071eb8a44 src/Versions.in: Add new seq / rawmidi functions for UMP
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:39:06 +02:00
Takashi Iwai
f8df023597 ump: Add descriptions for UMP RawMidi interface
Also update doxygen config accordingly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:25:32 +02:00
Takashi Iwai
8da704ef4f seq: Correct section descriptions for UMP
The usage of \section and \subsection were wrong in the previous
commit, where the tags were missing.

Fixes: 3390f31664 ("seq: Add description about MIDI 2.0 and UMP handling")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:20:18 +02:00
Takashi Iwai
3390f31664 seq: Add description about MIDI 2.0 and UMP handling
Add more description of the new ALSA sequencer features for MIDI 2.0
and UMP handling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-25 11:00:29 +02:00
Takashi Iwai
6da898cf40 ump: Fix doxygen error for snd_ump_endpoint_info_set_protocol()
Fix a typo that caused a doxygen error.

Fixes: 6767f623ca ("ump: Add missing *_set variants for snd_ump_endpoint_info and snd_ump_block_info")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-25 11:00:29 +02:00
Jaroslav Kysela
ef38bff00e conf: fix snd_config_substitute (for src->parent)
If source configuration node has a parent set, it must be always
detached to avoid memory corruptions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-21 16:32:10 +02:00
Takashi Iwai
6167b8ce3e 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-19 17:12:24 +02:00
Takashi Iwai
6767f623ca ump: Add missing *_set variants for snd_ump_endpoint_info and snd_ump_block_info
The API functions to fill the data on snd_ump_endpoint_info and
snd_ump_block_info were missing.  Let's add them.

They can be used to construct a virtual UMP endpoint and block.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-18 16:01:04 +02:00
Jaroslav Kysela
5600b901b2 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>
2024-06-04 11:17:57 +02:00
Jaroslav Kysela
291e727dfe ucm: doc - add Variant and Macro to the evaluation order
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-05-14 15:28:44 +02:00
Jaroslav Kysela
3864f7d95f ucm: define and describe Syntax 7
- for new macro argument substitution
- for new Path condition fields substitutions

Link: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Link: https://github.com/alsa-project/alsa-lib/issues/395
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 15:36:05 +02:00
Jaroslav Kysela
c6cd83bd0a ucm: raise error when macro argument is already defined (used)
Link: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 15:19:24 +02:00
Jaroslav Kysela
99499a6ebc ucm: do argument value substitution for Macros
Link: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 15:18:36 +02:00
Jaroslav Kysela
3fd24db22d ucm: fix Path condition - substitute Path
Use the appropriate variable for access/eaccess call.

Fixes: https://github.com/alsa-project/alsa-lib/issues/395
Fixes: ef6463a2 ("ucm: fix Path condition - substitute Path and Mode fields")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 14:48:13 +02:00
Jaroslav Kysela
ef6463a209 ucm: fix Path condition - substitute Path and Mode fields
The Path and Mode fields should be also substituted for
the runtime evaluation. See Fixes.

Fixes: https://github.com/alsa-project/alsa-lib/issues/395
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 13:01:04 +02:00
Peter Ujfalusi
de529410da 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>
2024-04-23 09:11:53 +02:00
David Senoner
08bf1a7b0c 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.

Link: https://lore.kernel.org/alsa-devel/ZeWGbxZIc7AF96h0@m.b4.vu/
Signed-off-by: David Senoner <seda18@rolmail.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-03-04 09:43:21 +01:00
Geoffrey D. Bennett
6f17ec50b3 conf: USB-Audio: Add more Scarlett devices to the IEC958 blacklist
The Scarlett Solo and 2i2 don't have S/PDIF outputs.

Link: https://lore.kernel.org/alsa-devel/ZeWGbxZIc7AF96h0@m.b4.vu/
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-03-04 09:39:36 +01:00
Jaroslav Kysela
4489923d2c pcm: extend doc for snd_pcm_hw_params_get_sbits()
Try to explain more the output value and its relation between
format and sample bits defined by the format.

Link: https://github.com/larsimmisch/pyalsaaudio/pull/146
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-26 14:54:02 +01:00
Jaroslav Kysela
13057b74c8 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.

Link: https://lore.kernel.org/linux-sound/20240222173649.1447549-1-perex@perex.cz/
Link: https://github.com/larsimmisch/pyalsaaudio/pull/146
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-23 21:52:23 +01:00
Marc Aldorasi
da744ef116 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>
2024-02-23 09:53:21 +01:00
Jaroslav Kysela
19be3b23b3 pcm: snd_pcm_(physical_)format_width() - change documentation
The word "nominal" is not so correct here. Use similar
wording as we use in the kernel space (the bit-width of the format).

Link: https://github.com/larsimmisch/pyalsaaudio/pull/146
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-22 19:03:35 +01:00
Jaroslav Kysela
d8ce72f256 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.

Link: https://lore.kernel.org/alsa-devel/81b0be0a-5ab7-db91-21cb-0c59a55291e9@ivitera.com/
Suggested-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-09 11:21:04 +01:00
Jan Palus
2a736a0d25 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: dc7da761f3 ("topology: separate Versions linker script")
Signed-off-by: Jan Palus <jpalus@fastmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-30 14:31:46 +01:00
Zeno Endemann
ffed4f3426 pcm: document interaction of drain silence and sw silence
I'm not sure this is the best way to describe the interaction, but I think
this needs to be mentioned in some form at least.

Closes: https://github.com/alsa-project/alsa-lib/pull/381
Signed-off-by: Zeno Endemann <zeno.endemann@mailbox.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 17:15:36 +01:00
Jaroslav Kysela
f48dd3a751 topology: fix Versions file
The exported symbols were tagged with ALSA_0.9 version previously.
We cannot use a different version (regressions).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 17:12:34 +01:00
Jaroslav Kysela
a69ac97e4d pcm: route plugin: allocate temporary array on stack only one time
Fixes: https://github.com/alsa-project/alsa-lib/pull/363
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:20:48 +01:00
q66
55a758a964 pcm: sofvol plugin: fix signed overflow
This fixes functionality on specific setups with UBSan.

Closes: https://github.com/alsa-project/alsa-lib/pull/351
Signed-off-by: q66 <q66@chimera-linux.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:15:24 +01:00
Jaroslav Kysela
f0658e6dbd add back Versions source file to EXTRA_DIST to fix packaging
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:13:36 +01:00
Ryan Underwood
b44eff91c9 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>
2024-01-24 18:12:53 +01:00
Nicholas Vinson
14308adb0d 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>
2024-01-24 18:12:14 +01:00
Nicholas Vinson
10ff172202 src/Versions.in: Add guards for opt. alisp symbols
Add guards for optional alisp symbols. This ensures that the Versions
file does not contain undefined symbols when building alisp support is
disabled.

Fixes Gentoo bugs 914511 (https://bugs.gentoo.org/914511),
    914643 (https://bugs.gentoo.org/914643),
    and 919417 (https://bugs.gentoo.org/919417).

Fixes bug #305
Fixes alsa_lisp symbol error reported in bug #356

Closes: https://github.com/alsa-project/alsa-lib/pull/376
Fixes: https://github.com/alsa-project/alsa-lib/issues/305
Link: https://github.com/alsa-project/alsa-lib/issues/356
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:11:52 +01:00