Commit graph

63 commits

Author SHA1 Message Date
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
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
Jaroslav Kysela
d65b1c7b52 ucm: add ${evali:} substitution
Example:

  Define.var1 2

  LibraryConfig.test.SubstiConfig {
          a "${evali:$var1+1}"
  }

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-13 16:10:51 +02: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
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
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
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
0c99c073d3 conf: add snd_config_is_array() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 12:00:42 +02:00
Jaroslav Kysela
4c021697f1 conf: implement snd_config_add_before() and snd_config_add_after()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 16:56:05 +01:00
Jaroslav Kysela
4724158c0a ucm: change the If block parsing
- evaluate always If before the other blocks
2019-11-14 15:13:38 +01:00
Jaroslav Kysela
8a36e38dc4 ucm: add If condition block
The syntax is simple:

If./any-if-identificator/ {
  Condition {
    Type /type_here/
    /optional defines/
  }
  True {
    /block used when condition is evaluated as true/
  }
  False {
    /block used when condition is evaluated as false/
  }
}

The Type "ControlExists" is implemented:

Condition {
  Type ControlExists
  Device "hw:${CardId}"
  Control "iface=CARD,name='Headphone Jack'"
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:37 +01:00
Jaroslav Kysela
5b9041bced Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:29:26 +01:00
Takashi Iwai
516bf057b0 conf: Allow dynamic top-level config directory
Currently the top-level config directory is specified only via
configure script option, and is fixed after that.  It's inconvenient
when the library is moved to another base directory, or if you want to
use a library code (e.g. with $LD_PRELOAD) with the incompatible
config setups.

This patch allows user to override the top-level config path via the
environment varialbe, $ALSA_CONFIG_DIR.  For that, a new helper
function, snd_config_topdir(), was introduced, and the codes referring
to the top config dir have been modified to handle it dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-03 09:54:16 +02:00
Takashi Iwai
c9a0d7d601 conf: Add thread-safe global tree reference
Most of open functions in alsa-lib have the call pattern:
  snd_config_update();
  return snd_xxx_open(x, snd_config, ...);

This means that the toplevel config gets updated, and passed to a
local open function.  Although snd_config_update() itself has a
pthread mutex to be thread safe, the whole procedure above isn't
thread safe.  Namely, the global snd_config tree may be deleted and
recreated at any time while the open function is being processed.
This may lead to a data corruption and crash of the program.

For avoiding the corruption, this patch introduces a refcount to
config tree object.  A few new helper functions are introduced as
well:
- snd_config_update_ref() does update and take the refcount of the
  toplevel tree.   The obtained config tree has to be freed via
  snd_config_unref() below.
- snd_config_ref() and snd_config_unref() manage the refcount of the
  config object.  The latter eventually deletes the object when all
  references are gone.

Along with these additions, the caller of snd_config_update() and
snd_config global tree in alsa-lib are replaced with the new helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-05-17 15:51:20 +02:00
Alexander E. Patrakov
4dc44bb34a Replace unsafe characters with _ in card name
Otherwise, they get misinterpreted as argument separators
in USB-Audio PCM definitions, and thus prevent SPDIF blacklist entries
from working.

While at it, add my Logitec C910 webcam to the SPDIF blacklist.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-29 20:33:26 +02:00
Clemens Ladisch
5332d74a67 fix doc errors
Fix various errors in the documentation that make doxygen complain.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-08-04 09:17:20 +02:00
Clemens Ladisch
5fe83677b5 conf.c: more documentation
Expand the documentation for the snd_config_* functions.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-07-27 10:09:03 +02:00
Jaroslav Kysela
d25e281230 Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
Jaroslav Kysela
d7ef50f5ee name clash (WINE, icc), interface -> iface renamed
Fix ALSA bug #1139.
2005-05-29 14:26:20 +00:00
Takashi Iwai
087184b0f9 Fix doxygen documents
Fix the warnings of doxygen parsing.
Add some missing documentation.
2005-05-24 14:14:28 +00:00
Jaroslav Kysela
a022bc1fbc API for device name lists and timer enhancements
- new snd_names_list and snd_names_list_free functions
- added snd_timer_ginfo related functions to the timer API
2005-05-10 10:52:30 +00:00
Clemens Ladisch
04c2de32c1 fix some file paths in comments
doxygen complains if the file name specified with \file does
not match the real file name, so fix it
2005-01-17 17:34:31 +00:00
Jaroslav Kysela
63d708a344 Documentation update by Clement Ladish 2002-07-23 19:51:16 +00:00
Takashi Iwai
2c1041f4f1 removed invalid const qualifier. 2002-06-18 16:05:36 +00:00
Jaroslav Kysela
ffda02123d Added INTEGER64 support by Paul Davis 2002-05-13 09:34:08 +00:00
Takashi Iwai
6ce9436b13 removed comma from last element of enums. 2002-02-05 11:36:20 +00:00
Jaroslav Kysela
d10bcbf76d Added snd_config_load_override().
Fixed problem with EOF detection in freestring parser.
Fixed problem with run-time argument parsing (snd_config_load()->snd_config_load_override() replace).
Added more documentation for configuration run-time arguments and hooks.
Fixed the behaviour of snd_config_search_definition() - implicit and explicit base.
2002-01-09 21:28:15 +00:00
Jaroslav Kysela
3e3df2d32b Updated GNU GPL license (address).
Changed GNU LGPL licence from 2.0 to 2.1.
2001-12-30 09:22:54 +00:00
Jaroslav Kysela
9a6902d8a4 Added snd_config_update_free_global().
Added snd_config_delete_compound_members().
'const' changes.
Fixed memory leaks.
2001-12-15 19:50:36 +00:00
Jaroslav Kysela
76c8029e2b Added snd_config_update_r, snd_config_update_free functions 2001-12-07 14:12:35 +00:00
Jaroslav Kysela
aa68b89c37 Added snd_config_get_ireal function 2001-11-26 15:19:19 +00:00
Jaroslav Kysela
f9756e6efd Added snd_config_imake_* functions. 2001-11-24 18:29:15 +00:00
Jaroslav Kysela
c39882f602 Configuration:
- changed snd_config_get_id function to follow semantic of other get functions
  - added snd_config_test_id
  - added runtime pointer type (not persistent)
    - added snd_config_make_pointer, snd_config_set_pointer, snd_config_get_pointer
  - added type/contents checking for callback functions
    - changed 'void *private_data' to 'snd_config_t *private_data'
  - renamed card_strtype functions to card_driver
Control:
  - fixed passing parameters to snd_ctl_async
Async handlers:
  - added public snd_async_handler_get_signo function
Documentation:
  - moved all documentation to source files
2001-11-19 08:14:21 +00:00
Jaroslav Kysela
87b5b249a5 pcm.h - major documentation updates and reordering
Cleanup for __cplusplus defines.
2001-11-14 11:40:46 +00:00
Jaroslav Kysela
58345ae4f4 Separated asoundlib.h to small files. 2001-09-13 11:38:32 +00:00
Jaroslav Kysela
8ae3783494 Some small modifications to make doxygen happy. 2001-08-15 14:04:04 +00:00
Jaroslav Kysela
b45c08611c Added symbol versioning for dlsym-callbacks.
Removed snd_config_refer_load from confmisc.c and pcm.c.
2001-08-15 12:12:16 +00:00
Jaroslav Kysela
3590f6ecd3 More documentation enhancements / removal of non-existent functions. 2001-07-11 15:48:27 +00:00
Jaroslav Kysela
3a993b4a3e Removed snd_config_string_replace function.
Added back modified snd_config_refer_load function.
Added snd_func_private_pcm_subdevice function.
Removed the callback from the snd_sctl_build function (no more required).
Modified alsa.conf to use refer {} blocks again.
Modified card specific conf files to use new snd_func_private_pcm_subdevice function.
2001-06-18 14:14:49 +00:00
Jaroslav Kysela
1e0c53a11c Added context handling for snd_config_expand.
PCM slave configuration is now dynamic.
2001-06-16 22:03:23 +00:00
Abramo Bagnara
a4768a7b10 Simplified evaluation using snd_config_walk. Fixed implementation 2001-06-16 08:19:15 +00:00
Abramo Bagnara
54daf2f16d Extended parameterization. Marked with @ all fields with special use 2001-06-15 14:00:19 +00:00
Jaroslav Kysela
977a9a33f0 * Cleaned the alsa.conf syntax:
- added pcm.front, pcm.rear, pcm.center_lfe blocks
* Added configuration for EMU10K1 (it's fully working one!!!)
* snd_config_redirect_load->snd_config_refer_load rename
* snd_config_search_alias code change (works also with pairs base.key)
* cleanups in the evaluate function (the function prototype has been changed)
2001-06-15 08:47:59 +00:00
Jaroslav Kysela
5c3075d32f Enhanced configuration syntax (added [ ] block for arrays).
The snd_config_expand functions expands the runtime contents (@func...).
Removed the environment variable replace code from the configuration parser.
Updated the alsa.conf configuration file.
2001-06-13 09:31:05 +00:00
Jaroslav Kysela
bf780a25a5 Added argument handling for the slave PCMs.
The configuration root (snd_config) can be specified for the internal routines.
The pcm_hooks code was recoded (independent code moved to control/setup.c).
Improved the pcm_multi plugin (added master configuration).
2001-06-11 13:35:48 +00:00
Jaroslav Kysela
61bf03ce70 New syntax for the substituted variables - $(var).
Improved the variable substitution (all references in a string are replaced).
Added special redirect loading code (to separate card dependant code to
single files).
2001-06-11 08:07:48 +00:00
Abramo Bagnara
1d9bf33550 Added parametric configuration. Removed some memory leaks 2001-05-18 17:18:47 +00:00
Jaroslav Kysela
f65b035a45 Improved in-source documentation (interfaces are divided into modules). 2001-04-24 13:02:58 +00:00