summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* usecase: add CaptureMicInfoFile field to documentationHEADmasterJaroslav Kysela2023-05-161-0/+3
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include: fix SND_DLSYM_BUILD_VERSION() for static buildJaroslav Kysela2023-05-161-6/+6
| | | | | | | Correct the dlsym_name string for nested macros. See Fixes:. Fixes: https://github.com/alsa-project/alsa-lib/issues/316 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: add SND_CTL_EINTR open modeJaroslav Kysela2023-05-031-0/+3
| | | | | | | | Add possibility to return -EINTR instead waiting for the event. The applications may want to handle -EINTR condition themselves. BugLink: https://github.com/alsa-project/alsa-lib/issues/228 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: add SND_PCM_EINTR open modeJaroslav Kysela2023-05-031-0/+2
| | | | | | | | Add possibility to return -EINTR instead waiting for the event. The applications may want to handle -EINTR condition themselves. BugLink: https://github.com/alsa-project/alsa-lib/issues/228 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: improve handling for snd_pcm_wait()Jaroslav Kysela2023-05-031-0/+7
| | | | | | | | | | | | | The snd_pcm_wait() function is called also internally from the various plugins to wait for the drain with -1 and from i/o routines in pcm.c. Define two special negative timeout values to distinguish the drain and i/o wait and calculate the maximal timeout according the wait place. Fixes: https://github.com/alsa-project/alsa-lib/issues/228 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: introduce SNDRV_PCM_HW_PARAMS_DRAIN_SILENCEJaroslav Kysela2023-05-032-0/+5
| | | | | | | | | | The application may not require to touch the playback sample stream for the drain operation at all. In this case, the application is responsible to setup a silencing mechanism for the playback or another graceful stop (like using the rewind operation). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAINJaroslav Kysela2023-05-032-0/+2
| | | | | | | | | Handle the driver informing us that it is not necessary to set up silencing upon playback draining. This will be the case for drivers which are guaranteed to not read any samples beyond the application pointer. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* type_compat.h: use ESPIPE instead of EPIPE when ESTRPIPE not definedSASANO Takayoshi2023-02-031-1/+1
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/298 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include: alsa-symbols.h - use newer gcc symver function attributeJaroslav Kysela2022-11-091-0/+7
| | | | | | | | Use the symver function attribute for newer gccs (version 11+). The symver function attribute was introduced probably earlier (gcc-10). We can fix that on demand later. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include: pcm_old.h - use a macro for the symbol versioningJaroslav Kysela2022-11-091-65/+68
| | | | | | Make the header file more readable and error prone. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* add FreeBSD build support (except test/)SASANO Takayoshi2022-10-172-2/+2
| | | | | | | | Note: NetBSD and OpenBSD has both <endian.h> and <sys/endian.h> Fixes: https://github.com/alsa-project/alsa-lib/pull/250 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* add NetBSD/OpenBSD build support (except test/)SASANO Takayoshi2022-10-174-14/+21
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/250 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include/sound/type_compat.h: fix include guardSASANO Takayoshi2022-07-081-3/+3
| | | | | | | | | | | | | | include/sound/type_compat.h uses #define __TYPE_COMPAT_H but it conflicts same include guard of include/type_compat.h now, include/sound/type_compat.h uses #define __SOUND_TYPE_COMPAT_H this is already done in NetBSD's pkgsrc patch. (thanks to tsutsui@netbsd.org) Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* output: include stdarg.hBernd Kuhls2022-06-172-0/+4
| | | | | | | | | | | | | | | Fixes a build error with alsa-utils when build with a uClibc toolchain: alsa-utils/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/alsa/output.h:75:66: error: unknown type name ‘va_list’ 75 | int snd_output_vprintf(snd_output_t *output, const char *format, va_list args); | ^~~~~~~ alsa-utils/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/alsa/output.h:1:1: note: ‘va_list’ is defined in header ‘<stdarg.h>’; did you forget to ‘#include <stdarg.h>’? Fixes: https://github.com/alsa-project/alsa-lib/pull/237 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: Use ino64_t to save and compare inode numbersSimon McVittie2022-06-051-0/+1
| | | | | | | | | | | | | | | | | | On 32-bit platforms when not using the large-file-support ABI, struct stat64 contains ino64_t which is 64-bit, while ino_t is only 32-bit. snd_config_update_r() checks whether a file has been replaced by saving the ino member of a struct stat64 and comparing it with a previously-saved inode number. On 32-bit platforms, assigning the 64-bit member of struct stat64 to a 32-bit member of struct finfo will truncate it modulo 1<<32, which could conceivably result in libasound not reloading configuration when it should (although the inode number space is large enough to make this failure mode highly unlikely). Fixes: https://github.com/alsa-project/alsa-lib/pull/231 Signed-off-by: Simon McVittie <smcv@collabora.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* use-case.h: add Channels/ChannelPos values to the documentationJaroslav Kysela2022-05-241-0/+12
| | | | | | | | We have use cases, where the channel split is required. We can use alsa-lib plugins for this job, but some sound servers or applications may want to do the split themselves. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* configure: add --with-lfs optionJaroslav Kysela2022-05-201-0/+10
| | | | | | | | | We are forcibly use the LFS (64-bit) calls in the source now. Add a new check to the configure script and use compatibility defines when those calls are not available for a reason. Fixes: https://github.com/alsa-project/alsa-lib/pull/223 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* use-case.h: add SND_USE_CASE_DEV_DIRECT defineJaroslav Kysela2022-05-141-0/+1
| | | | | | | It may be useful to define the devices without channel remapping (e.g. ProAudio devices). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: add ${evali:} substitutionJaroslav Kysela2022-05-131-0/+1
| | | | | | | | | | | | Example: Define.var1 2 LibraryConfig.test.SubstiConfig { a "${evali:$var1+1}" } Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: fix the export of safe_strto* functions from libasoundJaroslav Kysela2022-01-011-2/+6
| | | | | | | | | | Only one library should define the safe_strto function. Export it correctly and add _snd_ prefix to avoid possible clashes with the other application code. Fixes: 47252054 ("src/topology/parser.c: drop duplicate safe_strtol_base") Fixes: https://github.com/alsa-project/alsa-lib/pull/208 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: introduce snd_config_load_string()Jaroslav Kysela2021-12-011-0/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: add possibility to evaluate simple integer math expressionsJaroslav Kysela2021-11-301-0/+7
| | | | | | | | | | | | | | | | | | 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>
* conf: add safe_strtoll_base() like safe_strtol_base()Jaroslav Kysela2021-11-291-0/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: partially revert "pcm: softvol - make snd_pcm_parse_control_id private"Jaroslav Kysela2021-11-021-1/+1
| | | | | | | | | | | This reverts partially commit b9a4997e92e4c16147fcf96453a4c3e08080ac66. 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>
* conf: introduce safe_strtol_base()Jaroslav Kysela2021-11-021-1/+2
| | | | | | It is useful to parse hexadecimal strings, too. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* rawmidi: add support for SNDRV_RAWMIDI_IOCTL_USER_PVERSIONJaroslav Kysela2021-10-281-0/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* rawmidi: rename enum snd_rawmidi_framing to snd_rawmidi_read_modeJaroslav Kysela2021-10-281-8/+8
| | | | | | | | 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>
* rawmidi: define more abstract API for the timestamp readsJaroslav Kysela2021-10-281-20/+1
| | | | | | | | | | | | | | | | | | | 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>
* rawmidi: Use the standard types for snd_rawmidi_framing_tstamp_t definitionTakashi Iwai2021-08-241-8/+9
| | | | | | | | | | | 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>
* asound.h: fix the __packed use for the out-of-kernel codeJaroslav Kysela2021-08-202-8/+5
| | | | | | | 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>
* rawmidi: Add rawmidi framing APIDavid Henningsson2021-08-202-2/+66
| | | | | | | | | | | | | | | 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>
* fix build with --disable-ucmJaroslav Kysela2021-06-281-0/+10
| | | | | | 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>
* control: Minor documentation fixes.Tanjeff-N. Moos2021-06-211-2/+7
| | | | | Signed-off-by: Tanjeff-N. Moos <tanjeff@cccmz.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* control: Add documentation for snd_ctl_card_* and friends.Tanjeff-N. Moos2021-06-211-3/+37
| | | | | | | | | | | | | | | 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>
* pcm: Move snd_pcm_channel_area_addr() and _step() to public headerTakashi Iwai2021-06-211-0/+23
| | | | | | Used in the rate plugins commonly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pcm: rate: Improve the support multiple formatsTakashi Iwai2021-06-171-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix EXPORT_SYMBOL attribute for clangChih-Wei Huang2021-06-141-0/+4
| | | | | | | | | | 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>
* ucm: add _alibpref to get the private device prefixJaroslav Kysela2021-06-021-0/+1
| | | | | | | 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>
* include: try to fix the out-of-source-tree buildJaroslav Kysela2021-05-251-1/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include: fix out-of-source-tree buildJaroslav Kysela2021-05-251-5/+12
| | | | | | | | | | | | | | | | | | | | | 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>
* conf: add snd_config_make_path() functionJaroslav Kysela2021-05-131-0/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: add snd_config_is_empty() functionJaroslav Kysela2021-05-131-0/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include: fix SND_LIB_VER() macroJaroslav Kysela2021-04-131-1/+1
| | | | | Fixes: c132509a ("include: add SND_LIB_VER() macro") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: add LibraryConfig supportJaroslav Kysela2021-04-132-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* output: Add snd_output_buffer_steal() functionJaroslav Kysela2021-04-131-0/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: add snd_config_merge() functionJaroslav Kysela2021-04-131-0/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* include: add SND_LIB_VER() macroJaroslav Kysela2021-04-071-3/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* control: remap plugin - add docsJaroslav Kysela2021-04-072-1/+11
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* control: doc - create controls plugin pageJaroslav Kysela2021-04-071-0/+49
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* control: remap plugin - initial versionJaroslav Kysela2021-04-071-1/+3
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>