Commit graph

143 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
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
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
Takashi Iwai
81b0cf46d1 control: Add UMP Endpoint and Block info query support
Add functions to query the UMP Endpoint and Block info via control
interface.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Takashi Iwai
8bc10c83b1 control: Add UMP device query support
Add a function to query the next available UMP device via control
interface, just like the existing one for rawmidi.  As the UMP rawmidi
is compatible with the standard rawmidi, no extra helper for the
rawmidi_info is present.  Ditto for the preferred subdevice, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Jaroslav Kysela
507d906abb pcm: add SND_CTL_EINTR open mode
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>
2023-05-03 15:59:15 +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
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
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
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
Tanjeff-N. Moos
c1e72460de control: Add documentation for snd_ctl_elem_value_*.
Signed-off-by: Tanjeff-N. Moos <tanjeff@cccmz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-03 09:12:41 +02:00
Tanjeff-N. Moos
e097dd491a control: Add documentation for snd_ctl_elem_list_*.
Signed-off-by: Tanjeff-N. Moos <tanjeff@cccmz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-08-18 12:18:30 +02: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 Sakamoto
7bebd4c980 ctl: rename APIs to add an element set so that their names are appropriate
In this development period, some APIs have already been added. Most of
them are to add an element set, while their names are not so appropriate
against their feature. This is due to following to names of old APIs.

This commit renames them.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-07-17 10:01:25 +02:00
Takashi Sakamoto
16812b70da ctl: add an API to set dimension levels to element information
In a former commit, 'struct snd_ctl_elem_info' is used as a 'container' to
transfer extra fields of element information for APIs to add an element
set. The extra fields should be filled in advance of call of the APIs.
Currently, dimension level is in the extra fields and no APIs to set it.

This commit adds an API to set dimension level to the information
structure. This API is expected to be used in advance of usage of APIs
to add an element set, for nothing others. When the information structure
is extended in future, then the similar APIs shall be added for the new
feature.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-06-30 08:42:17 +02:00
Takashi Sakamoto
f9e6011255 ctl: support extra information to user-defined element set
In ALSA control feature, information of an element includes extra fields
to type-specific parameters; i.e. dimension. The fields can be extended in
future.

Meanwhile, current APIs to add user-defined element set can not support
such an extended fields. This may cause inconveniences in future.

This commit supports the fields, by changing APIs for element set.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-06-30 08:42:17 +02:00
Takashi Sakamoto
7117d22cf2 ctl: use consistent name for second argument of snd_ctl_elem_read/write
Second argument of these functions has three different names in
documentation/header/code (obj/control/value). This easily causes users'
confusion.

This commit applies consistent names for the arguments.

Fixes: 90020c05f8 ('ctl: improve comments for handling element data')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-06-29 11:50:26 +02:00
Takashi Sakamoto
07861888e4 ctl: add functions to add an element set
ALSA control core allows userspace applications to add an element set.
However, in ALSA userspace library, there's no APIs enough to utilize
the feature. The library has APIs just to add an element set with a single
element.

This commit adds functions to add an element set with several elements.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-06-16 15:45:58 +02:00
Takashi Iwai
30122df4fa Use __inline__ for exported headers
Some programs are still using C90.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=817077
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-25 09:52:33 +02:00
Jaroslav Kysela
e23fb2c4de control, pcm: implement snd_ctl_abort() and snd_pcm_abort() functions
Upon an interrupt, it is necessary to abort the wait loops with the EINTR
error code. Introduce snd_*_abort() functions to handle this case.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-08 13:28:03 +02:00
Takashi Iwai
3c4a22ea49 Implement the channel mapping API
Added new channel-mapping API functions.
Not all plugins are covered, especially the route, multi and external
plugins don't work yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-11 11:34:50 +02:00
Clemens Ladisch
15c6f83296 control: add snd_ctl_elem_add_enumerated()
Handling of user control elements was implemented for all types except
BYTES and ENUMERATED.  Enumerated user controls will be needed for the
device-specific mixers of upcoming FireWire drivers.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2011-10-07 23:38:55 +02:00
Takashi Iwai
acb423d937 Add snd_{ctl|pcm}_open_fallback() functions
This patch adds new API functions, snd_ctl_open_fallback() and
snd_pcm_open_fallback().  These are just like snd_*_open_lconf() but
used to open a fallback PCM/control.  The difference is that it replaces
the name string with the given original name, so that hctl and other
upper-layers will recognize it as an alias.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-27 15:24:13 +02:00
Jaroslav Kysela
9b6df1cf64 control: add ASCII parsers from amixer
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-11-04 19:58:44 +01:00
David Fries
63acb87329 modem.conf Off-hook improve behavior
Only restore the old value if it differs from the requested
value, because if it has changed restoring the old value
overrides the change.  Take for example, a voice modem with
a .conf that sets preserve off-hook.  Start playback (on-hook
to off-hook), start record (off-hook to off-hook), stop
playback (off-hook to restore on-hook), stop record (on-hook
to restore off-hook), Clearly you don't want to leave the
modem "on the phone" now that there isn't any playback or
recording active.

Signed-off-by: David Fries <david@fries.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-01-22 11:45:35 +01:00
Takashi Iwai
f8a34aa683 Add the support of TLV_DB_MINMAX types
Added the support of the new TLV_DB_MINMAX types.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-16 14:28:57 +02:00
Takashi Iwai
a51118bb62 Fix build with --disable-hwdep and co
control.h has function declarations with hwdep or rawmidi types
that aren't included when built without the corresponding supports.

Add ifdef appropriately to fix this.
2008-02-04 16:00:16 +01:00
Takashi Iwai
68e5771a6f Remove assert from header files
Putting assert in the public macros isn't good idea at all.
Let's get rid of them.

Also, clean up snd*_alloca() functions to use a helper macro
instead of copy and paste.
2007-10-25 15:36:03 +02:00
Takashi Iwai
f38e5feca3 Export dB conversion helper functions
Export helper functions to convert dB level and range.

snd_tlv_*dB*() are to convert dB level or range directly from TLV data.
snd_ctl_*dB*() are to get dB level or range from a control element.
2007-10-24 13:04:14 +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
2c02c139f4 remove snd_ctl_iface_conf_name() prototype, namehint doxygen cleanups 2006-12-07 15:29:20 +01:00
Jaroslav Kysela
6d90397add add snd_device_name_get_hint() prototype to include/control.h 2006-12-05 11:52:37 +01:00
Clemens Ladisch
0f99fe7830 fix string list parameter in snd_device_name_(free_)hint prototypes
Fix the type of the string list parameter in the prototypes of
snd_device_name_hint() and snd_device_name_free_hint().  The prototypes
used char**, while the implementation and the users are using void**.
2006-12-04 18:07:46 +01:00
Jaroslav Kysela
03389a444b change iface argument for namehint function to const char *
remove snd_ctl_iface_conf_name function
2006-10-27 13:31:32 +02:00
Jaroslav Kysela
13fdc41785 add snd_device_name_hint() function and initial implementation
- add snd_device_name_hint() and snd_device_name_free_hint() functions
- add snd_ctl_iface_conf_name() functions
- do not accept parameters for the plugin definition without @args section
- add defaults.pcm.dmix.card/device and dsnoop.card/device definitions
- add hints for HDA-Intel.conf, pcm/dmix.conf, pcm/dsnoop.conf and alsa.conf
- add test/namehint test utility
- doxygen related cleanups
2006-10-11 13:18:57 +02:00
Takashi Iwai
fba26cd668 Add support of dB range compound TLV
Added the support of dB range compound TLV type in the simple mixer layer.
All get_dB, get_dB_range and set_dB ops are supported.
2006-09-06 12:17:29 +02:00
Takashi Iwai
b0bbcd0697 Add handling of linear volume in simple mixer
Added the handling of linear volume TLV in the simple mixer layer.
2006-08-28 13:27:41 +02:00
Takashi Iwai
ae76129999 Move dB parser to mixer abstraction
Moved the parser of dB value to mixer abstraction from hcontrol layer.
Also, cleaned up codes.
2006-07-28 14:36:37 +02:00
James Courtier-Dutton
5e3fc87888 Implement support for dB gain display in alsamixer. 2006-07-22 14:56:48 +01:00
Jaroslav Kysela
c7a0708a23 Control API - add TLV support
snd_ctl_elem_tlv_read
snd_ctl_elem_tlv_write
snd_ctl_elem_tlv_command
snd_ctl_elem_info_is_tlv_readable
snd_ctl_elem_info_is_tlv_writable
snd_ctl_elem_info_is_tlv_commandable
snd_hctl_elem_tlv_read
snd_hctl_elem_tlv_write
snd_hctl_elem_tlv_command
2006-07-05 17:42:16 +02:00
Takashi Iwai
8a3d07022c Add external control plugin SDK
Added external control plugin SDK.
2005-06-09 17:12:08 +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
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
Takashi Iwai
0732cce6f0 Add accessor to user control elements
Added accessor functions to user control elements, snd_ctl_elem_add_*(),
and_ctl_elem_remove() and snd_ctl_elem_info_is_user().
2005-01-03 11:52:39 +00:00
Jaroslav Kysela
ab61b62cb4 More changes to the ordinary mixer API 2003-10-13 12:06:45 +00:00
Jaroslav Kysela
60585e25fc added snd_hctl_ctl() function
ordinary mixer:
  - revised Ordinary Mixer I/O type
  - sndo_mixer_open() take PCMs rather than strings to pass
    the real relationship
  - an initial version of toplevel alisp script
more alisp development:
  - renamed a* functions to A* functions (acall -> Acall etc.)
  - many improvements (unset*, exfun, Acall pcm_info, Asnderr, Asyserr)
2003-09-09 19:24:35 +00:00
Jaroslav Kysela
adbc93f1a4 More alisp extensions (card related functions, ctl_card_info). 2003-07-29 13:19:19 +00:00