Commit graph

4509 commits

Author SHA1 Message Date
Jaroslav Kysela
e550dcdd90 utils: add missing alsa-topology.pc.in to EXTRA_DIST
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-03 11:54:12 +01:00
Jaroslav Kysela
305168fd22 seq: seq.c - fix calloc arguments
The usage was inverted. The first argument is count of
elements, the second one is size of one element.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:28:17 +01:00
Jaroslav Kysela
0bb35d4980 seq: seqmid - fix info->name is always true error
Replate pointer check to the zero string check as it
was the intention.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:26:42 +01:00
Jaroslav Kysela
995e279081 include: pcm extplug/ioplug: fix internal include
The header files are directly included when the alsa-lib is building.
Do not show warning.

Fixes: ea8972c8 ("include: prefer alsa/asoundlib.h for apps, dependency cleanups")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:00:54 +01:00
Jaroslav Kysela
1101c397aa doc: fix permissions
Doxygen create also subdirectories. Make sure that files
in those directories have required permissions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 21:51:25 +01:00
Jaroslav Kysela
c8bc54a9ca test/playmidi1: fix compilation caused by conflict between midifile.h and ump_msg.h
It's a fast fix. The better way is to fix midifile.h or remote this example
(we have already some

Closes: https://github.com/alsa-project/alsa-lib/issues/436
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 19:22:05 +01:00
Jaroslav Kysela
a7de48692f include/ump_msg.h: Fix endianness detection
The SNDRV_BIG_ENDIAN_BITFIELD define is only available in the alsa-lib's
internal build process (include/local.h).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 18:59:06 +01:00
Jaroslav Kysela
ea8972c83b 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.).

Closes: https://github.com/alsa-project/alsa-lib/issues/431
Link: https://github.com/alsa-project/alsa-lib/pull/435
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 18:56:47 +01:00
Takashi Iwai
35d2efefa9 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).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:47:37 +01:00
Takashi Iwai
cdd5a9fa10 rawmidi: Make rawmidi flag bits doxygen-style comments
We forgot to put the markers in rawmidi info bit flags.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:47:34 +01:00
Takashi Iwai
137eca7720 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().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:46:50 +01:00
Takashi Iwai
e1cf4d3f68 Sync UAPI asequencer.h with 6.14 kernel
There are the new event types for UMP EP and FB notifications as well
as the new struct for them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:44:47 +01:00
Takashi Iwai
3fe7d9a49b Sync UAPI asound.h with 6.14 kernel
There is a small update of rawmidi API for supporting the UMP tied
device info and inactive flag.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:44:43 +01:00
Jaroslav Kysela
352cbc5eb9 rawmidi: ump - fix snd_ump_block_info_set_block_id double version
Fix mistake snd_ump_block_info_get_block_id / snd_ump_block_info_set_block_id .

Fixes: 76d2d285 ("rawmidi: ump - fix snd_ump_block_info_get_block_id double version")
Link: https://github.com/alsa-project/alsa-lib/issues/422
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-25 16:18:42 +01:00
Jaroslav Kysela
76d2d285c1 rawmidi: ump - fix snd_ump_block_info_get_block_id double version
The changes for 1.2.13 in Versions.in.in file matches also old
1.2.10 function snd_ump_block_info_get_block_id:

1 Removed function:

  [D] 'function void snd_ump_block_info_set_block_id(snd_ump_block_info_t*, unsigned int)'    {snd_ump_block_info_set_block_id@@ALSA_1.2.10}

Add 1.2.10 symbol back, but keep 1.2.13 symbol as default.

Closes: https://github.com/alsa-project/alsa-lib/issues/422
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-25 15:14:42 +01:00
Takashi Iwai
07cee0ba05 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.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1233682
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-11-24 09:37:03 +01:00
Takashi Iwai
6880219ad4 configure: Make sequencer dependent on rawmidi
The sequencer feature requires rawmidi implicitly, and it became more
obvious with UMP support.  Add the dependency check to configure
script.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-11-24 09:32:29 +01:00
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
785fd327ad Release v1.2.13
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-12 10:36:52 +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
a3865b2439 configure: do allow to use --with-pic for static build
Closes: https://github.com/alsa-project/alsa-lib/issues/411
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-10-21 09:31:16 +02:00
Jaroslav Kysela
073dc7577a configure: bumb version to 1.2.13pre1 (for alsa-utils)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-19 11:55:58 +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
Jaroslav Kysela
513ef7ace4 github: use upload-artifacts@v4
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 12:53:03 +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
Takashi Iwai
f81236cf7e 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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-20 16:16:47 +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
9b6dfb3eb6 ump_msg: Add missing definition for Set Key Signature Message
The Set Key Signature message was missing at the time we defined
for Flex Data types.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-20 09:41:53 +02:00
Takashi Iwai
f08f4aceec .gitignore: Add test/umpinfo
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-15 16:43:10 +02:00
Takashi Iwai
3e38164ee5 test: Add an example program to inquire UMP Endpoint and Block info
Provide an example program to inquire UMP Endpoint and Block info in
various APIs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-15 16:41:53 +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
f090a93ea8 ump_msg: Define types for UMP Mixed Data Set messages
Mixed Data Set messages is another messages of the type 5
(SND_UMP_MSG_TYPE_EXTENDED_DATA) with the status 8 and 9.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-28 10:55:00 +02:00
Takashi Iwai
28948f2fcc ump_msg: Add a new helper snd_ump_get_byte()
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-28 10:54:53 +02:00
Takashi Iwai
530e2f8131 ump_msg: Correct a typo in snd_ump_msg_flex_data_t definition.
There was a typo in snd_ump_msg_flex_data_t definition; it should be
"set_metronome".

Fixes: 30f8ba74c5 ("ump_msg: Add definitions for Utility, Stream and Flex Data messages")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-19 14:30:12 +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
ade099fab7 ump_msg: Drop unsuitable comments
There were some leftover comments from the old code that don't fit any
longer.  Drop them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-04 14:42:25 +02:00
Takashi Iwai
30f8ba74c5 ump_msg: Add definitions for Utility, Stream and Flex Data messages
This patch provides more struct / union definitions for UMP Utility,
Stream and Flex Data messages, provided in the new UMP v1.1
specification.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-04 14:42:03 +02:00
Takashi Iwai
8734673c21 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: 040356ecf0 ("ump: Add helpers to parse / set UMP packet data")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 16:53:17 +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