Commit Graph

906 Commits

Author SHA1 Message Date
许学海
59b0dd90f5
update include/version.h.
Signed-off-by: 许学海 <xuxuehai2@huawei.com>
2024-07-17 03:54:52 +00:00
许学海
bfc207f453
update include/version.h.
Signed-off-by: 许学海 <xuxuehai2@huawei.com>
2024-07-17 03:54:31 +00:00
许学海
4945670c40
update include/config.h.
Signed-off-by: 许学海 <xuxuehai2@huawei.com>
2024-07-17 03:53:49 +00:00
许学海
2a79e2c23c
update include/config.h.
Signed-off-by: 许学海 <xuxuehai2@huawei.com>
2024-07-16 11:33:01 +00:00
许学海
c97e124f0f
update include/version.h.
Signed-off-by: 许学海 <xuxuehai2@huawei.com>
2024-07-16 11:30:00 +00:00
whoselittlelion
21631e2b26 fix: fix opensource notice
Signed-off-by: whoselittlelion <humin16@huawei.com>
2024-06-12 16:27:10 +08:00
whoselittlelion
795019bd8b fix: alsa config path define
Signed-off-by: whoselittlelion <humin16@huawei.com>
2024-06-05 11:31:44 +08:00
xuxuehai
582d7b6130 commit msg
Signed-off-by: xuxuehai <xuxuehai2@huawei.com>
2024-05-16 17:35:05 +08:00
zenglifeng
6878fd2cde Porting the third-party library alsa-lib, add head file
Signed-off-by: zenglifeng <zenglifeng2@huawei.com>
2022-06-05 19:16:33 +08:00
zenglifeng
39280c6f22 Porting the third-party library alsa-lib
Signed-off-by: zenglifeng <zenglifeng2@huawei.com>
2022-05-18 11:17:05 +08:00
Jaroslav Kysela
ebb8a6c7a1 conf: introduce snd_config_load_string()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-01 10:18:58 +01:00
Jaroslav Kysela
bf528b9066 conf: add possibility to evaluate simple integer math expressions
It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.

Examples:

	$[1 + 1]
	$[$[2 + 2] / $var1]
	$[0xa0 | 0x05]

As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-11-30 11:33:35 +01:00
Jaroslav Kysela
32d332b786 conf: add safe_strtoll_base() like safe_strtol_base()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-11-29 15:01:32 +01:00
Jaroslav Kysela
f0d540f851 pcm: partially revert "pcm: softvol - make snd_pcm_parse_control_id private"
This reverts partially commit b9a4997e92.

It seems that we have have some users for this very specific function.
Mark it deprecated and keep the softvol implementation separate,
so we can remove this function easily in future.

Fixes: https://github.com/alsa-project/alsa-lib/issues/186
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-11-02 11:00:35 +01:00
Jaroslav Kysela
f547b2e35f conf: introduce safe_strtol_base()
It is useful to parse hexadecimal strings, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-11-02 10:41:11 +01:00
Jaroslav Kysela
c932c1e7ab rawmidi: add support for SNDRV_RAWMIDI_IOCTL_USER_PVERSION
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-10-28 08:40:20 +02:00
Jaroslav Kysela
d3c5e9e009 rawmidi: rename enum snd_rawmidi_framing to snd_rawmidi_read_mode
We hide the internal data transfers using the data frames. Rename
the snd_rawmidi_framing enum to snd_rawmidi_read_mode to make
API more straight and understandable.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-10-28 08:40:20 +02:00
Jaroslav Kysela
5a5c2953ea rawmidi: define more abstract API for the timestamp reads
The frame structure is a bit internal thing for the kernel
data transfer implementation. Introduce snd_rawmidi_tread()
function which is straight for the application usage and hides
the framing data transfers (kernel space API).

The current code implements the read cache and does the merging
of the frame reads with the similar timestamps (opposite
to the kernel data split for big chunks).

If the application wants to use super-duper-lighting-fast reads,
the snd_rawmidi_read() may be used, but the structure must be
defined on it's own, because this mechanism is not preferred
and unsupported.

BugLink: https://github.com/alsa-project/alsa-lib/issues/172
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-10-28 08:40:20 +02:00
Takashi Iwai
754c696aef rawmidi: Use the standard types for snd_rawmidi_framing_tstamp_t definition
Using the kernel-specific types like __u8 breaks the compilation of
applications.  Also we need the packed attribute.

Although we may want to move to an opaque type later, let's put the
workaround at first.

Fixes: https://github.com/alsa-project/alsa-lib/issues/172
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-24 10:40:14 +02:00
Jaroslav Kysela
b97dec9502 asound.h: fix the __packed use for the out-of-kernel code
Also, move __kernel_long_t to type_compat.h for the consistency.

Fixes: https://github.com/alsa-project/alsa-lib/issues/171
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-08-20 21:15:01 +02:00
David Henningsson
95eb312fad rawmidi: Add rawmidi framing API
Optionally, incoming rawmidi bytes can be put inside a frame of type
snd_rawmidi_framing_tstamp_t.
The main current benefit is that can enable in-kernel timestamping of
incoming bytes, and that timestamp is likely to be more precise than
what userspace can offer.

Tstamp type framing requires a kernel >= 5.14 and a buffer size that
is a multiple of sizeof(snd_rawmidi_framing_tstamp_t). It is only
available on input streams.

Signed-off-by: David Henningsson <coding@diwic.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-20 08:46:26 +02:00
Jaroslav Kysela
f4f29d42be fix build with --disable-ucm
Link: https://mailman.alsa-project.org/pipermail/alsa-devel/2021-June/186729.html
Reported-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-28 12:13:56 +02:00
Tanjeff-N. Moos
7ba3f888d0 control: Minor documentation fixes.
Signed-off-by: Tanjeff-N. Moos <tanjeff@cccmz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 17:13:26 +02:00
Tanjeff-N. Moos
ccc14ae897 control: Add documentation for snd_ctl_card_* and friends.
In this patch series, I added a description about control interface
handling and how control interfaces are identified.

In addition, I added/improved Doxygen documentation for the
snd_ctl_card_info_t type and related corresponding functions,
e.g. snd_ctl_card_info(). I also documented other card-related like
snd_card_next().

Along the way I did minor documentation improvements.

Signed-off-by: Tanjeff-N. Moos <tanjeff@cccmz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 17:12:53 +02:00
Takashi Iwai
a5e11f9a81 pcm: Move snd_pcm_channel_area_addr() and _step() to public header
Used in the rate plugins commonly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 14:22:36 +02:00
Takashi Iwai
119d9c1678 pcm: rate: Improve the support multiple formats
This patch extends the PCM rate plugin for allowing its converter
plugin to deal with multiple formats.  Currently, the converter plugin
is allowed to take different formats only when convert callback is
defined.  And for this way (so far only the standard linear rate
plugin does), all linear formats have to be handled, and it's
cumbersome.

OTOH, most other rate plugins are implemented with convert_s16
callback, which accepts only S16 format.  This is often not ideal
because many converter engines can handle 32bit formats.  Also, the
target format is often 32bit format, hence this would require
additional conversion even if the converter engine can output 32bit
natively.

In this patch, for addressing the problems above, the rate plugin API
is extended in the following way:

- The new get_supported_formats callback is added; this stores the bit
  masks of the supported input and output formats, as well as the
  behavior flags.  Currently only linear formats are allowed.
- When the plugin accepts only the interleaved stream, set
  SND_PCM_RATE_FLAG_INTERLEAVED flag bit.  Otherwise the code has to
  handle snd_pcm_channel_area at each call.
- When both input and output formats have to be identical, pass
  SND_PCM_RATE_FLAG_SYNC_FORMATS flag bit.
- When the converter wants to process different formats, use convert
  callback instead of convert_s16.  You can put both in the ops for
  compatibility, too.
  The input and output formats are found in the info argument of init
  callback.
- Now the PCM rate plugin core will skip the temporary buffer
  allocation and conversions for pre- and post-process if not needed
  (i.e. matching with the requested input or output format).

The rate plugin API version is bumped to 0x010003.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 11:40:38 +02:00
Chih-Wei Huang
8253c1c1f9 Fix EXPORT_SYMBOL attribute for clang
Clang doesn't have the externally_visible attribute.

    src/pcm/pcm.c:1503:1: error: unknown attribute 'externally_visible' ignored [-Werror,-Wunknown-attributes]
    #define EXPORT_SYMBOL __attribute__((visibility("default"),externally_visible))                                                         ^

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 10:11:42 +02:00
Jaroslav Kysela
0e4ba2ea8c ucm: add _alibpref to get the private device prefix
It may be useful to get the device prefix for the local configuration.

Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1251
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-02 11:09:46 +02:00
Jaroslav Kysela
f9bb2487ac include: try to fix the out-of-source-tree build
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 17:13:06 +02:00
Jaroslav Kysela
b0e99e4cfe include: fix out-of-source-tree build
Fixes:

  cd alsa-lib
  if test -r Makefile; then
    make distclean
  fi
  mkdir build
  cd build
  ../configure
  make

Note:

  The srcdir is used for the symlinks to generated include files :-(
  I've not found a better (easy) way to fix this.

Fixes: https://github.com/alsa-project/alsa-lib/issues/136
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-25 16:43:25 +02:00
Jaroslav Kysela
1aef5a8f8a conf: add snd_config_make_path() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 11:02:41 +02:00
Jaroslav Kysela
3050af4b90 conf: add snd_config_is_empty() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-05-13 10:59:47 +02:00
Jaroslav Kysela
d18ebb79d7 include: fix SND_LIB_VER() macro
Fixes: c132509a ("include: add SND_LIB_VER() macro")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 18:01:09 +02:00
Jaroslav Kysela
8f5779eb3f ucm: add LibraryConfig support
This commit allows to define private alsa-lib's configuration. When
the configuration is present, the device values ("PlaybackCTL",
"CaptureCTL", "PlaybackMixer", "CaptureMixer", "CapturePCM")
are prefixed with '_ucmHEXA.' string where HEXA is replaced by the
unique hexadecimal number identifying the opened ucm manager handle.

    Syntax 4

    LibraryConfig.a_label.SubstiConfig {
            # substituted library configuration like:
            usr_share_dir "${ConfLibDir}"
    }

    LibraryConfig.b_label.Config {
            # non-substituted library configuration like:
            usr_share_dir "/usr/share/alsa"
    }

    The File counterparts:

    LibraryConfig.c_label.SubstiFile "/some/path"
    LibraryConfig.d_label.File "/some/path"

Note that for files the contents is substituted on the request,
but the file name is always substituted (useful for ${ConfDir} etc.).

The private configuration is not saved or preserved. It's life time
belongs to the opened ucm manager handle.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 17:14:28 +02:00
Jaroslav Kysela
3e0140088c output: Add snd_output_buffer_steal() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
4870358b2f conf: add snd_config_merge() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
c132509a86 include: add SND_LIB_VER() macro
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:25:15 +02:00
Jaroslav Kysela
493a41bcad control: remap plugin - add docs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:09 +02:00
Jaroslav Kysela
7371ac9aad control: doc - create controls plugin page
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:05 +02:00
Jaroslav Kysela
a64391a428 control: remap plugin - initial version
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:50 +02:00
Jaroslav Kysela
83e4c1ab77 control: add snd_ctl_elem_id_compare_numid() function
Idea for the function prototype by Takashi Sakamoto.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:48:30 +01:00
Jaroslav Kysela
6f4b96ecc9 control: rename snd_ctl_elem_id_compare() to snd_ctl_elem_id_compare_set()
- add asserts to check if the unsigned integers are in the valid range
- replace tuple with set in the id description
- add const prefix for id1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:31:30 +01:00
Jaroslav Kysela
9c194a0ba7 ucm: add _fboot / FixedBootSequence
Actually, the BootSequence is executed only when the driver controls
(identifiers or value types) are changed. It may be handy to have
also a sequence which is executed at _each_ boot without any condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:25:52 +01:00
Jaroslav Kysela
2cfe6addae control: add snd_ctl_elem_id_compare() function
Compare two control element identifiers like strcmp().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
19ad9bdc49 conf: introduce snd_config_get_card() function
It's helper for the "card" entries parsing. It reduces
the code in most of open_hw functions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
174592280d control: improve snd_ctl_add_*_elem_set functions (access flags)
The access flags are useful for the user space elements
with the custom access flags.

Introduce snd_ctl_elem_info_set_*() functions to set those flags
in the info structure.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 20:32:20 +01:00
Takashi Iwai
a9cbfecd87 pcm: Fix a typo in SND_PCM_AUDIO_TSTAMP_TYPE_LAST definition
It was wrongly defined with SNDRV_ prefix.  Fix it.

Fixes: ea02dbd20a ("pcm: Add snd_pcm_audio_tstamp_type_t constants")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-22 16:11:05 +01:00
David Henningsson
ea02dbd20a pcm: Add snd_pcm_audio_tstamp_type_t constants
These are mostly a copy-paste from the kernel headers. But since functions
snd_pcm_audio_tstamp_config make use of these they should be added to the
public API as well.

Reported-by: Alex Moon <alex.r.moon@gmail.com>
Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-17 11:25:57 +01:00
Pierre-Louis Bossart
e5c350d7bc topology: use inclusive language in documentation
Use codec_provider and codec_consumer for bclk and fsync

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-11-17 14:01:30 +01:00
Pierre-Louis Bossart
706192341d topology: use inclusive language for fsync
use fsync_provider for structure fields, 'codec_provider' and
'codec_consumer' for options and modify #defines to use CP and CC
suffixes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-11-17 14:01:20 +01:00