Commit graph

973 commits

Author SHA1 Message Date
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
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
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
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
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
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
18579adfbc ump_msg.h: Fix doxygen comments
Correct the lack of markers and missing comments for some unions.

Fixes: 040356ecf0 ("ump: Add helpers to parse / set UMP packet data")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:22:06 +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
b359ed813e use-case.h: add DisplayPort to HDMI device description
Link: https://github.com/alsa-project/alsa-ucm-conf/pull/423
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-10 09:06:51 +02: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
Tim Blechmann
8476874843 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>
2024-01-24 18:26:36 +01:00
Takashi Iwai
55c6338290 seq: Add snd_seq_ump_ev_clear()
Like snd_seq_ev_clear(), let's add a helper to clear the event record
for a UMP-capable sequencer event.

While we're at it, change snd_seq_ev_clear() to be a static inline
function, so that we make sure that the proper pointer type is
passed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-18 16:43:55 +01:00
Cezary Rojewski
d8000f57fc pcm: Add MSBITS subformat options
Improve granularity of format selection for S32/U32 formats by adding
masks representing 20, 24 and 32 most significant bits.

Closes: https://github.com/alsa-project/alsa-lib/pull/342
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-08 20:03:46 +01:00
Cezary Rojewski
f33284e85e pcm: Introduce snd_pcm_subformat_value()
Allow userspace applications to select subformats easily just like in
snd_pcm_format_t case - by string conversion.

Closes: https://github.com/alsa-project/alsa-lib/pull/342
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-08 20:03:28 +01:00
Jaroslav Kysela
10bd599970 global.h: move __STRING() macro outside !PIC ifdef block
It solves the musl libc compilation issue.

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>
2023-09-06 15:16:44 +02:00
Jaroslav Kysela
fcce13a672 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>
2023-09-04 09:38:28 +02:00
Bernd Kuhls
c72bbed825 Fix symver build error on non-ELF platforms
The following error is observed on Microblaze [1] build:

    error: symver is only supported on ELF platforms

due to using __attribute__((symver)) on non-ELF platform.

[1] http://autobuild.buildroot.net/results/1e9/1e965d83d75615f35308440c5db044314a349357/build-end.log

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>
2023-09-01 16:54:44 +02:00
Jaroslav Kysela
70d4e042dc dogyxen: fix topology.h warnings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:27:15 +02:00
borine
08e79fc5a3 doxygen: include docs for shmarea functions
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:12:24 +02:00
borine
220377a2dd doxygen: topology: silence 'not documented' warnings
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:12:06 +02:00
borine
c4680ed458 doxygen: global: silence 'not documented' warnings
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:12:02 +02:00
borine
382c700dfe doxygen: namehint: silence 'not documented' warnings
Also creates a new module within the Configuration interface
documentation in which to present the name hint docs.

From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:11:51 +02:00
borine
9cb4414e3b doxygen: conf: silence 'not documented' warnings
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:11:43 +02:00
borine
23931800da doxygen: pcm: silence 'not documented' warnings
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:11:30 +02:00
borine
f53fd880f0 doxygen: fix inadvertent link requests
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:11:22 +02:00
borine
57959cef8f doxygen: fix list indentation errors
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:11:15 +02:00
borine
e72c605179 doxygen: escape xml tags
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:11:09 +02:00
borine
9505cfdb46 doxygen: fix broken parameter name tags
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:10:55 +02:00
borine
f39256a9b0 doxygen: Fix missing group end markers
From: borine@github
Link: https://github.com/alsa-project/alsa-lib/pull/340
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:10:16 +02:00
Jaroslav Kysela
ad3a8b8b31 reshuffle included files to include config.h as first
config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).

Related: https://github.com/alsa-project/alsa-lib/pull/333
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 18:25:37 +02:00
Takashi Iwai
91bbe55894 seq: Add overflow check in snd_seq_ev_set_ump_data()
It's better to add a sanity check than sorry for breaking.
Now the function return -EINVAL.

Closes: https://github.com/alsa-project/alsa-lib/issues/346
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-24 19:24:03 +02:00
Takashi Iwai
58da05803b seq: ump: Fix typo in function name containing "group"
In a couple places the function names were misspelled as "gruop"
instead of "group".  Fix them.

Reported-by: Jean-Michaël Celerier <jeanmichael.celerier@gmail.com>
Fixes: https://github.com/alsa-project/alsa-lib/pull/337
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-07-28 17:35:02 +02:00
Takashi Iwai
77247f51c4 seq: Add UMP 1.1 features
Add APIs for groupless message filtering.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-12 10:14:23 +02:00
Takashi Iwai
80e20a1052 ump: Add UMP 1.1 features
Add a few new features for UMP 1.1:
- New attributes in UMP Endpoint and Block info
- Static block bit flag for EP info

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-12 10:14:20 +02:00
Takashi Iwai
517957a24b uapi: Update rawmidi API to 2.0.4
Sync with the kernel change of rawmidi API for supporting UMP 1.1
features.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-12 10:14:17 +02:00
Takashi Iwai
2aefb5c41c 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().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Takashi Iwai
c40dc19a57 uapi: Update asequencer.h definitions for 1.0.3
Updated from kernel for supporting UMP on sequencer API.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00