Compare commits

..

267 commits

Author SHA1 Message Date
Jaroslav Kysela
d62b1d5407 conf: fix parse_array_def override code path
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
The error may cause segmentation fault and incorrect behaviour.

Closes: https://github.com/alsa-project/alsa-lib/issues/477
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-09-18 11:00:47 +02:00
Adam Sampson
3a97718124 test: update midifile library to ANSI C
The midifile library used by the playmidi1 program dates from 1989, and
used pre-ANSI function definitions and prototypes. GCC 15 now defaults
to C23 where () means the same as (void) in prototypes, which causes
type mismatch errors.

Update the code to use ANSI function definitions and prototypes, so
it'll compile happily as anything from ANSI C to C23. This revealed that
playmidi1's do_tempo had the wrong argument type, so correct that as
well.

Closes: https://github.com/alsa-project/alsa-lib/pull/463
Signed-off-by: Adam Sampson <ats@offog.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-07-31 15:31:40 +02:00
Jochen Sprickerhof
782b0597c2 ucm: use close_range on _GNU_SOURCE
Closes: https://github.com/alsa-project/alsa-lib/pull/459
Signed-off-by: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-07-31 15:30:51 +02:00
wyjstrong
4ad4d9590a Force to use alphasort64() sorting function for Harmony OS
Closes: https://github.com/alsa-project/alsa-lib/pull/467
Signed-off-by: wyjstrong <wyjstrong@163.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-07-31 15:29:21 +02:00
Kai Vehmanen
5f524e3004 pcm: add a loop to snd_pcm_avail_delay() to avoid bogus delay values
snd_pcm_avail_delay() is expected to report avail and delay values
in atomic fashion. However the function does two separate syscalls
and it cannot guarantee the avail value is the same as was used
to calculate the delay. This is a problem as the reported delay is
always relative to avail frames value.

If application (like e.g. alsa_conformance_test) uses snd_pcm_avail_delay()
to estimate the effective play position, it can observe bogus delay
values (and effective play position going backwards) if
snd_pcm_avail_delay() is called during a DMA burst where hw_ptr
moves quickly.

This commit adds a loop similar to that used in snd_pcm_hw_htimestamp()
to wait until we get a stable avail reading, and only then extract
the delay. This will avoid bogus values if function is called during
DMA bursts.

Closes: https://github.com/alsa-project/alsa-lib/pull/469
Closes: https://github.com/alsa-project/alsa-lib/issues/468
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-07-31 15:25:18 +02:00
Jaroslav Kysela
ee5a58f48e ucm: regex: fix the error message (missing argument)
Link: https://github.com/alsa-project/alsa-ucm-conf/pull/580
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-06-26 11:33:15 +02:00
Daniel Dadap
07ec2ad34c conf: aliases: add hda-acpi -> HDA-Intel alias
The new snd_hda_acpi driver in Linux exposes the existing Azalia
interface to non-PCI devices advertised over ACPI. Add an alias
to the existing HDA-Intel configuration file so that devices using
this driver can be discovered properly.

Signed-off-by: Daniel Dadap <ddadap@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-05-22 09:04:55 +02:00
Jaroslav Kysela
8df60992b7 mixer: bag - fix bag_del_all implementation (missing free)
The bag1_t structure must be freed, too.

Fixes: https://github.com/alsa-project/alsa-lib/issues/453
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-05-09 09:55:00 +02:00
Jaroslav Kysela
368ea9af82 github: fix Fedora workflow (awk package dependency)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-24 15:16:12 +02:00
Jaroslav Kysela
8ab0228f51 Revert "ucm: do not bump syntax version to 8"
This reverts commit e51cba0973.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-24 13:25:38 +02:00
Jaroslav Kysela
81d70a2713 Release v1.2.14
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-14 18:42:04 +02:00
Jaroslav Kysela
c748afe123 seq: seqmid - use correct snd_strlcat instead snd_strlcpy in update_group_ports()
Fixes: a4e47461 ("seq: update_group_ports - rewrite blknames update")
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-14 18:41:42 +02:00
Jaroslav Kysela
8291d2c601 add snd_strlcat() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-14 18:41:42 +02:00
Jaroslav Kysela
e51cba0973 ucm: do not bump syntax version to 8
The new code for syntax 8 is not widely tested. Postpone it for next
alsa-lib release.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-14 09:44:42 +02:00
Jaroslav Kysela
6073f53051 rawmidi: ump - fix snd_ump_block_info_set_block_id double version #2
Define two different symbols with similar functionality.

Fix for:

  CC       ump.lo
/tmp/ccZKscpB.s: Assembler messages:
/tmp/ccZKscpB.s:18: Error: multiple versions [`snd_ump_block_info_set_block_id@@ALSA_1.2.13'|`snd_ump_block_info_set_block_id@ALSA_1.2.10'] for symbol `__snd_ump_block_info_set_block_id'
make[3]: *** [Makefile:392: ump.lo] Error 1

Fixes: 352cbc5e ("rawmidi: ump - fix snd_ump_block_info_set_block_id double version")
Link: https://github.com/alsa-project/alsa-lib/issues/422
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-08 16:28:38 +02:00
Jaroslav Kysela
8b75db9676 pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode (#2)
This is basically redo of all changed and add appropriate conditions
to disable only ioctl calls, but preserve tstamp_type assignments.

Fixes: 15f2b276 ("pcm: hw: fix default timestamp type for O_APPPEND")
Fixes: 7e01443e ("pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode")
Link: https://github.com/alsa-project/alsa-lib/pull/450
Suggested-by: Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-08 11:20:04 +02:00
Jaroslav Kysela
15f2b27612 pcm: hw: fix default timestamp type for O_APPPEND
Fixes: 7e01443e ("pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode")
Link: https://github.com/alsa-project/alsa-lib/pull/450
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-07 18:53:02 +02:00
Kevin Groeneveld
7e01443ecc pcm: hw: do not reset tstamp_type in SND_PCM_APPEND mode
When the first client of plugins such as dshare open the hw device they set
a default tstamp_type in snd_pcm_direct_initialize_slave based on
tstamp_type from the config file. But when subsequent clients open the same
plugin the snd_pcm_hw_open_fd function clobbers this default.

Closes: https://github.com/alsa-project/alsa-lib/pull/450
Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-07 18:49:52 +02:00
Jaroslav Kysela
a4e47461ec seq: update_group_ports - rewrite blknames update
Resolve the warning bellow and use more optimized calls.

seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:45: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 61 [-Wformat-truncation=]
  672 |                                          ", %s", bp->name);
      |                                             ^~
seqmid.c:671:33: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 63
  671 |                                 snprintf(blknames + len, sizeof(blknames) - len,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  672 |                                          ", %s", bp->name);
      |                                          ~~~~~~~~~~~~~~~~~

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-07 18:46:32 +02:00
Simon Howard
647c001321 Delete alsalisp code
Install of the alsalisp binary has been disabled since 2006 (in commit
8d382ccd), and building of it was disabled by default in 2018 (in commit
32ceab21), so it is reasonable to assume that nobody is using it.

Use within the alsa-lib project is limited to an aliases file that looks
like it is intended as an example, plus some very small .alisp files
associated with the SiS SI7018 PCI sound card which has not been
manufactured in years. These too have not been installed since 2018 when
commit 32ceab21 disabled building of the alsalisp binary.

In preparing this change, I searched the Github issue tracker for
"lisp", "alisp" and "alsalisp", and found no complaints about the above
changes. I also did a Github code search for projects that might be
including the `alisp.h` header and found none. Therefore I think this
code can be safely deleted and nobody is likely to object.

Closes: https://github.com/alsa-project/alsa-lib/pull/448
Signed-off-by: Simon Howard <fraggle@soulsphere.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-07 18:36:54 +02:00
Felix Wolfsteller
0d2acc2084 pcm: fix minor typos in doc
Closes: https://github.com/alsa-project/alsa-lib/pull/446
Signed-off-by: Felix Wolfsteller <felix.wolfsteller@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-07 18:36:32 +02:00
Takashi Iwai
90eb3c1e96 ALSA: seq: Use SND_* instead of SNDRV_*
The values SNDRV_XXX are used incorrectly in some code where they
should have been SND_XXX, due to copy&paste from the kernel code.

Practically seen there are no difference, and the code still works
fine, but those should be corrected for consistency.

Fixes: 6167b8ce3e ("seq: Add API helper functions for creating UMP Endpoint and Blocks")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-04-01 08:10:27 +02:00
Takashi Iwai
95d0274b60 ALSA: seq: Add missing UMP EP cap bit at snd_seq_create_ump_endpoint()
In snd_seq_create_ump_endpoint(), it was forgotten to give the UMP
Endpoint capability bit (SND_SEQ_PORT_CAP_UMP_ENDPOINT) to the port 0
("UMP 2.0").  This resulted in port 0 being a normal port for the
non-existing group.

Fixes: 6167b8ce3e ("seq: Add API helper functions for creating UMP Endpoint and Blocks")
Closes: https://github.com/alsa-project/alsa-lib/issues/447
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-04-01 08:10:27 +02:00
Jaroslav Kysela
e088d08c76 control: remap - improve sync feature
It may be useful to deactivate the sync mechanism for some configurations.
Create a new virtual boolean control for this.

Link: https://github.com/alsa-project/alsa-ucm-conf/pull/410
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-24 11:50:52 +01:00
Jaroslav Kysela
d8300e5cb7 ucm: add '${LibCaps}' substitution
It is a preparation for future checking of alsa-lib's extensions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-21 11:41:09 +01:00
Jaroslav Kysela
70f4c95df5 ucm: remove @@LibraryVersion and @@SyntaxVersion variables
It seems that version checking is more complicated:

Syntax is one-way settlement from the configuration files.
It cannot be conditional.

The library version string is hard to check with regex.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-21 11:26:32 +01:00
Jaroslav Kysela
d5f19bcabc control: remap - add sync feature
For UCM, it may be required to sync multiple controls. The logic
is really simple - last write to any control in the group wins.

Link: https://github.com/alsa-project/alsa-ucm-conf/pull/410
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-21 10:39:09 +01:00
Jaroslav Kysela
42b8f1299f control: remap - separate event handling from map (preparation for sync)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-21 09:43:04 +01:00
Jaroslav Kysela
fb285b366f seq: shuffle calloc arguments in snd_seq_hw_open (gcc warning)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-21 09:42:35 +01:00
Jaroslav Kysela
1b9a073e6a seq: add more checks to snd_seq_hw_set_client_info for older kernels
The snd_seq_set_client_midi_version() should fail for older kernel
when applications are trying to configure new midi versions.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4621
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-20 21:55:54 +01:00
Jaroslav Kysela
6855cb838d control: remap - add possibility to remap multiple source channels
For UCM (ASoC), there is a requirement to remap two stereo
controls to one stereo control (amplifiers).

Link: https://github.com/alsa-project/alsa-ucm-conf/pull/525
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-19 17:55:33 +01:00
Jaroslav Kysela
e9e3c01ff7 ucm: format @@SyntaxVersion to 4 digits
It is better for regex matching.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-19 12:20:27 +01:00
Jaroslav Kysela
8f6fef8b1a ucm: enhance documentation (sys-card + ranges + more)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-19 12:05:34 +01:00
Jaroslav Kysela
12f6790910 ucm: add @@LibraryVersion and @@SyntaxVersion variables
It may be useful to check the current syntax version (and maybe
library version) when new features are added.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-19 11:54:50 +01:00
Jaroslav Kysela
7fbd47ce79 ucm: add sys-card substitution
It may be useful to check additional sysfs parameters like USB descriptors
to determine the exact hardware capabilities.

Introduce 'sys-card' substitution and 'sys' substitution to allow data
fetching from given range. Also, add conversion to hexadecimal format
when the source file has binary contents.

Example - fetch bytes from positions 0x10..0x15 (6 bytes):

  Define.Bytes1 "${sys-card:[type=hex,pos=0x10,size=6]device/../descriptors}"

Example - fetch one byte from position 0x22:

  Define.Bytes2 "${sys-card:[type=hex,pos=0x22]device/../descriptors}"

Replace type=hex or omit this variable settings to work with ASCII
characters.

Link: https://github.com/alsa-project/alsa-ucm-conf/issues/444
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-03-13 18:28:05 +01:00
Takashi Iwai
0c7086777a seq: Fix typo of the group number in snd_seq_create_ump_endpoint()
The group number of UMP Endpoint client created by
snd_seq_create_ump_endpoint() is wrongly set due to a copy&paste
error.

Fixes: 6167b8ce3e ("seq: Add API helper functions for creating UMP Endpoint and Blocks")
Closes: https://github.com/alsa-project/alsa-lib/issues/440
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-03-01 11:00:15 +01:00
Takashi Iwai
df8f1cc1ec seq: Fix bogus return of snd_seq_client_info_get_ump_conversion()
snd_seq_client_info_get_ump_conversion() should have returned the
proper bit of group_filter bit field, but it just did return
midi_version field -- a stupid copy & paste error.  Let's fix it.

Fixes: 2aefb5c41c ("seq: Add UMP support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-02-17 12:06:09 +01:00
Jaroslav Kysela
e550dcdd90 utils: add missing alsa-topology.pc.in to EXTRA_DIST
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-03 11:54:12 +01:00
Jaroslav Kysela
305168fd22 seq: seq.c - fix calloc arguments
The usage was inverted. The first argument is count of
elements, the second one is size of one element.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:28:17 +01:00
Jaroslav Kysela
0bb35d4980 seq: seqmid - fix info->name is always true error
Replate pointer check to the zero string check as it
was the intention.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:26:42 +01:00
Jaroslav Kysela
995e279081 include: pcm extplug/ioplug: fix internal include
The header files are directly included when the alsa-lib is building.
Do not show warning.

Fixes: ea8972c8 ("include: prefer alsa/asoundlib.h for apps, dependency cleanups")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:00:54 +01:00
Jaroslav Kysela
1101c397aa doc: fix permissions
Doxygen create also subdirectories. Make sure that files
in those directories have required permissions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 21:51:25 +01:00
Jaroslav Kysela
c8bc54a9ca test/playmidi1: fix compilation caused by conflict between midifile.h and ump_msg.h
It's a fast fix. The better way is to fix midifile.h or remote this example
(we have already some

Closes: https://github.com/alsa-project/alsa-lib/issues/436
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 19:22:05 +01:00
Jaroslav Kysela
a7de48692f include/ump_msg.h: Fix endianness detection
The SNDRV_BIG_ENDIAN_BITFIELD define is only available in the alsa-lib's
internal build process (include/local.h).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 18:59:06 +01:00
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
Takashi Iwai
35d2efefa9 seq: Define new events for UMP EP/FB change notifications
Two new sequencer event types are added for notifications of UMP info
changes: SND_SEQ_EVENT_UMP_EP_CHANGE (68) and
SND_SEQ_EVENT_UMP_BLOCK_CHANGE (69).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:47:37 +01:00
Takashi Iwai
cdd5a9fa10 rawmidi: Make rawmidi flag bits doxygen-style comments
We forgot to put the markers in rawmidi info bit flags.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-01-14 16:47:34 +01:00
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
Jaroslav Kysela
352cbc5eb9 rawmidi: ump - fix snd_ump_block_info_set_block_id double version
Fix mistake snd_ump_block_info_get_block_id / snd_ump_block_info_set_block_id .

Fixes: 76d2d285 ("rawmidi: ump - fix snd_ump_block_info_get_block_id double version")
Link: https://github.com/alsa-project/alsa-lib/issues/422
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-25 16:18:42 +01:00
Jaroslav Kysela
76d2d285c1 rawmidi: ump - fix snd_ump_block_info_get_block_id double version
The changes for 1.2.13 in Versions.in.in file matches also old
1.2.10 function snd_ump_block_info_get_block_id:

1 Removed function:

  [D] 'function void snd_ump_block_info_set_block_id(snd_ump_block_info_t*, unsigned int)'    {snd_ump_block_info_set_block_id@@ALSA_1.2.10}

Add 1.2.10 symbol back, but keep 1.2.13 symbol as default.

Closes: https://github.com/alsa-project/alsa-lib/issues/422
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-25 15:14:42 +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
6880219ad4 configure: Make sequencer dependent on rawmidi
The sequencer feature requires rawmidi implicitly, and it became more
obvious with UMP support.  Add the dependency check to configure
script.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-11-24 09:32:29 +01:00
Nicholas Vinson
76edab4e59 src/Versions.in.in: Update *_tempo_base name
Change @SYMBOL_PREFIX@snd_has_tempo_base to
@SYMBOL_PREFIX@snd_has_queue_tempo_base.

Starting with version 1.2.13, alsa-lib fails to link with ld.lld-19 due
to "version script assignment of 'ALSA_1.2.13' to symbol
'snd_seq_has_tempo_base' failed: symbol not defined".

Per commit 769d1db1b0 the correct name for
the symbol is @SYMBOL_PREFIX@snd_has_queue_tempo_base; therefore, update
src/Vesions.in.in to match.

Fixes bug #420
Fixes Gentoo bug 943399 (https://bugs.gentoo.org/943399)

Closes: https://github.com/alsa-project/alsa-lib/pull/421
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-15 09:27:10 +01:00
Jaroslav Kysela
785fd327ad Release v1.2.13
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-12 10:36:52 +01:00
Jaroslav Kysela
49295a4e17 control: remap - clarify comments and docs
Fix copy-n-paste errors.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-12 10:32:56 +01:00
Jaroslav Kysela
4e7a510095 control: remap - fix copy-n-paste in _snd_ctl_remap_open's comment
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-10-24 11:08:00 +02:00
Jaroslav Kysela
a3865b2439 configure: do allow to use --with-pic for static build
Closes: https://github.com/alsa-project/alsa-lib/issues/411
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-10-21 09:31:16 +02:00
Jaroslav Kysela
073dc7577a configure: bumb version to 1.2.13pre1 (for alsa-utils)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-19 11:55:58 +02:00
Jaroslav Kysela
93d7645d84 pcm: close - deactivate async handler before snd_pcm_drop()
It reduces probablity to activate the async handler when snd_pcm_close() is called.

Link: https://github.com/alsa-project/alsa-lib/issues/394
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 12:58:14 +02:00
Jaroslav Kysela
513ef7ace4 github: use upload-artifacts@v4
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 12:53:03 +02:00
Arkadiusz Bokowy
9ac93d1252 Fix TLV dB parser in case of used container
In case when dB information does not appear as the only TLV type in the
stream (it might be wrapped in a container, but the container can not
have any other type), the TLV parser fails to get the dB TLV pointer.

This commit fixes it by distinguishing between TLV parse error and dB
information not being found in a container (-ENOENT), so the parser can iterate
over all elements in the container.

Also, it fixes out-of-bounds read in case of malicious TLV record.

Closes: https://github.com/alsa-project/alsa-lib/pull/409
Signed-off-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 10:51:06 +02:00
Takashi Iwai
fc58f8fcc3 pcm: dmix: Don't clear scpm->info flag
spcm->info bits should be a copy of the slave PCM info as is.
While we clear the unsupported SND_PCM_INFO_PAUSE bit there, it should
be rather cleared only for the exposed info to apps, not spcm->info.

Fixes: 982786e9eb ("Fix bogus pause flag on dmix")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-09-06 10:15:46 +02:00
Takashi Iwai
2adc30e983 pcm: dmix: Fix resume with multiple instances
The fix for PCM dmix suspend/resume checks spcm->info bit of
SND_PCM_INFO_RESUME for applying a workaround for drivers with the
full resume support.  This assumed that scpm->info is exposed from the
underlying slave PCM device.

The above is true for the first opened instance, but for the second
opened instance, it's a copy from the saved data in shmem.  And, we
dropped SND_PCM_INFO_RESUME bit there to assure not to expose the full
resume capability to applications.  This resulted in the
inconsistencies, and when the second instance is resumed at first, it
misses the snd_pcm_resume() call, hence the driver doesn't react
properly any longer.

For addressing it, we keep SND_PCM_INFO_RESUME bit in shmptr->s.info
bits as is, while dropping the bit exposed to apps in
snd_pcm_direct_hw_refine() and *_hw_params() callbacks.

Fixes: 6d1d620ead ("pcm: dmix: resume workaround for buggy driver")
Reported-and-tested-by: Chancel Liu <chancel.liu@nxp.com>
Closes: https://lore.kernel.org/DB9PR04MB94988752ED7C43B399E0BC00E3942@DB9PR04MB9498.eurprd04.prod.outlook.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-09-06 10:13:29 +02:00
Jaroslav Kysela
3b9f3b9431 Fixes: 5600b901 ("async: snd_async_del_handler - move clear signal using sigaction as last")
A wrong list head is used to check if the given list with async handlers
is empty. Correct this.

Link: https://github.com/alsa-project/alsa-lib/issues/394
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-09-06 09:58:47 +02:00
Takashi Iwai
645668dca2 src/Versions.in: Add the new snd_pcm_hw_params_get_sync for 1.2.13
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-20 16:21:33 +02: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
f08f4aceec .gitignore: Add test/umpinfo
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-15 16:43:10 +02:00
Takashi Iwai
3e38164ee5 test: Add an example program to inquire UMP Endpoint and Block info
Provide an example program to inquire UMP Endpoint and Block info in
various APIs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-15 16:41:53 +02:00
Takashi Iwai
fa673b719c control: Make ump_{endpoint|block}_info calls optional
Add the NULL check for ump_endpoint_info and ump_block_info calls.
Those can be NULl depending on the target.

Fixes: 81b0cf46d1 ("control: Add UMP Endpoint and Block info query support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-15 16:26:33 +02:00
Takashi Iwai
769d1db1b0 seq: Correct a typo in documentation
The right function name is snd_seq_has_queue_tempo_base().

Fixes: 24c7f42733 ("seq: Add API functions to set different tempo base values")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-07 15:50:21 +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
d969439813 seq: Avoid strlcat()
strlcat() isn't available in every system, so better to avoid it.
Rewrite the code without strlcat().

Fixes: 6167b8ce3e ("seq: Add API helper functions for creating UMP Endpoint and Blocks")
Link: https://lore.kernel.org/0796c157-1ac3-47a3-9d54-ba86f59d64d5@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-07-31 11:20:16 +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
32e2c8d8a2 src/Versions.in: Add guards for sequencer and rawmidi syms
Similarly like PCM and others, add the ifdef guards for new symbols
for sequencer and rawmidi interfaces.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:46:35 +02:00
Takashi Iwai
2071eb8a44 src/Versions.in: Add new seq / rawmidi functions for UMP
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:39:06 +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
8da704ef4f seq: Correct section descriptions for UMP
The usage of \section and \subsection were wrong in the previous
commit, where the tags were missing.

Fixes: 3390f31664 ("seq: Add description about MIDI 2.0 and UMP handling")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-26 11:20:18 +02:00
Takashi Iwai
3390f31664 seq: Add description about MIDI 2.0 and UMP handling
Add more description of the new ALSA sequencer features for MIDI 2.0
and UMP handling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-25 11:00:29 +02:00
Takashi Iwai
6da898cf40 ump: Fix doxygen error for snd_ump_endpoint_info_set_protocol()
Fix a typo that caused a doxygen error.

Fixes: 6767f623ca ("ump: Add missing *_set variants for snd_ump_endpoint_info and snd_ump_block_info")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-25 11:00:29 +02:00
Jaroslav Kysela
ef38bff00e conf: fix snd_config_substitute (for src->parent)
If source configuration node has a parent set, it must be always
detached to avoid memory corruptions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-21 16:32:10 +02:00
Takashi Iwai
cacc5bd5c1 Add test/seq-ump-example to .gitignore
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-19 17:25:57 +02:00
Takashi Iwai
f784035a90 test: Add an example program to create a virtual UMP Endpoint
Provide an example program to demonstrate how to create a UMP Endpoint
and Blocks, i.e. a virtual UMP device.

It's a simple filtering application that just haves the incoming note
on/off velocity and sends out to the output.  The UMP Endpoint and
Block attributes can be adjusted via command-line options.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-19 17:24:50 +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
34422861f5 Release v1.2.12
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-10 11:18:34 +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
5600b901b2 async: snd_async_del_handler - move clear signal using sigaction as last
Improve the shutdown order for the asynchronous users. There may be
unhandled signals, because the signal is reset before signal deactivation
using fnctl (O_ASYNC).

Closes: https://github.com/alsa-project/alsa-lib/issues/394
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-04 11:17:57 +02:00
Jaroslav Kysela
291e727dfe ucm: doc - add Variant and Macro to the evaluation order
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-05-14 15:28:44 +02:00
Jaroslav Kysela
3864f7d95f ucm: define and describe Syntax 7
- for new macro argument substitution
- for new Path condition fields substitutions

Link: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Link: https://github.com/alsa-project/alsa-lib/issues/395
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 15:36:05 +02:00
Jaroslav Kysela
c6cd83bd0a ucm: raise error when macro argument is already defined (used)
Link: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 15:19:24 +02:00
Jaroslav Kysela
99499a6ebc ucm: do argument value substitution for Macros
Link: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 15:18:36 +02:00
Jaroslav Kysela
3fd24db22d ucm: fix Path condition - substitute Path
Use the appropriate variable for access/eaccess call.

Fixes: https://github.com/alsa-project/alsa-lib/issues/395
Fixes: ef6463a2 ("ucm: fix Path condition - substitute Path and Mode fields")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 14:48:13 +02:00
Jaroslav Kysela
ef6463a209 ucm: fix Path condition - substitute Path and Mode fields
The Path and Mode fields should be also substituted for
the runtime evaluation. See Fixes.

Fixes: https://github.com/alsa-project/alsa-lib/issues/395
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-24 13:01:04 +02:00
Peter Ujfalusi
de529410da conf: aliases: hdmi: Include unconditionally the
The hdmi.conf contains the high level macro to be used by cards to create
the hdmi: device.
Instead of including it in different config files, include it in the main
aliases.conf and remove it's inclusion by other config files.

This change is needed to add support for the hdmi: device mapping via UCM.

Closes: https://github.com/alsa-project/alsa-lib/pull/393
Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-23 09:11:53 +02:00
Ryan Carsten Schmidt
dcc5d6a8bd GitHub Actions: Use actions/checkout@v4
Fixes: #389
2024-03-17 09:42:55 +09:00
David Senoner
08bf1a7b0c conf: USB-Audio: Add Corsair HS60 Pro to the IEC958 blacklist
This device is just an external USB soundcard with a female 3.5mm jack
for a headset, no S/PDIF | IEC958 connector. Add it to the blacklist to
prevent it being opened.

Link: https://lore.kernel.org/alsa-devel/ZeWGbxZIc7AF96h0@m.b4.vu/
Signed-off-by: David Senoner <seda18@rolmail.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-03-04 09:43:21 +01:00
Geoffrey D. Bennett
6f17ec50b3 conf: USB-Audio: Add more Scarlett devices to the IEC958 blacklist
The Scarlett Solo and 2i2 don't have S/PDIF outputs.

Link: https://lore.kernel.org/alsa-devel/ZeWGbxZIc7AF96h0@m.b4.vu/
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-03-04 09:39:36 +01:00
Jaroslav Kysela
4489923d2c pcm: extend doc for snd_pcm_hw_params_get_sbits()
Try to explain more the output value and its relation between
format and sample bits defined by the format.

Link: https://github.com/larsimmisch/pyalsaaudio/pull/146
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-26 14:54:02 +01:00
Jaroslav Kysela
13057b74c8 pcm: clarify and fix default sbits (msbits) value for all formats
As described in the kernel patch (link bellow), the significant (resolution)
bits should be related to the usable sample bits not the physical sample bits.

Link: https://lore.kernel.org/linux-sound/20240222173649.1447549-1-perex@perex.cz/
Link: https://github.com/larsimmisch/pyalsaaudio/pull/146
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-23 21:52:23 +01:00
Giulio Moro
431f69a8c3 tests: latency.c - fix copy-n-paste typos (sw -> hw params) in error messages
Closes: https://github.com/alsa-project/alsa-lib/pull/384
Signed-off-by: Giulio Moro <giuliomoro@yahoo.it>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-23 09:57:15 +01:00
Marc Aldorasi
da744ef116 pcm: ladspa - Skip missing ladspa directories
Closes: https://github.com/alsa-project/alsa-lib/pull/385
Signed-off-by: Marc Aldorasi <m101010a@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-23 09:53:21 +01:00
Jaroslav Kysela
19be3b23b3 pcm: snd_pcm_(physical_)format_width() - change documentation
The word "nominal" is not so correct here. Use similar
wording as we use in the kernel space (the bit-width of the format).

Link: https://github.com/larsimmisch/pyalsaaudio/pull/146
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-02-22 19:03:35 +01: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
Jan Palus
2a736a0d25 topology: correct version script path
contrary to libasound, version script for libatopology is a regular
source file. while it's often the case that $(builddir) and $(srcdir)
point to the same directory, they don't always have to. therefore path
needs to point explicitly to $(srcdir) for Versions script in topology

Closes: https://github.com/alsa-project/alsa-lib/pull/383
Fixes: GH-382
Fixes: dc7da761f3 ("topology: separate Versions linker script")
Signed-off-by: Jan Palus <jpalus@fastmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-30 14:31:46 +01:00
Jaroslav Kysela
7e3a3c2b0a Release v1.2.11
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 17:16:07 +01:00
Zeno Endemann
ffed4f3426 pcm: document interaction of drain silence and sw silence
I'm not sure this is the best way to describe the interaction, but I think
this needs to be mentioned in some form at least.

Closes: https://github.com/alsa-project/alsa-lib/pull/381
Signed-off-by: Zeno Endemann <zeno.endemann@mailbox.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 17:15:36 +01:00
Jaroslav Kysela
f48dd3a751 topology: fix Versions file
The exported symbols were tagged with ALSA_0.9 version previously.
We cannot use a different version (regressions).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 17:12:34 +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
Jaroslav Kysela
a69ac97e4d pcm: route plugin: allocate temporary array on stack only one time
Fixes: https://github.com/alsa-project/alsa-lib/pull/363
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:20:48 +01:00
q66
55a758a964 pcm: sofvol plugin: fix signed overflow
This fixes functionality on specific setups with UBSan.

Closes: https://github.com/alsa-project/alsa-lib/pull/351
Signed-off-by: q66 <q66@chimera-linux.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:15:24 +01:00
Jaroslav Kysela
f0658e6dbd add back Versions source file to EXTRA_DIST to fix packaging
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:13:36 +01:00
Ryan Underwood
b44eff91c9 conf: pcm: Set C-Media USB 7.1 sound card (ICUSBAUDIO7D) to six_channel for surround40
This 7.1 analog sound card identifies as the following:
0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device (lsusb)
 1 [ICUSBAUDIO7D   ]: USB-Audio - ICUSBAUDIO7D (/proc/asound/cards)

It has the following four-channel analog stream layout:
  Interface 1
    Altset 3
    Format: S16_LE
    Channels: 4
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 44100, 48000
    Bits: 16
    Channel map: FL FR FC LFE
(/proc/asound/card1/stream0)

This layout makes it impossible to play audio to the surround (SL/SR)
speakers plugged into the "Surround" jack in 4 channel mode.  Instead,
set six_channel so that the six-channel layout will be used to access
those speakers:
  Interface 1
    Altset 4
    Format: S16_LE
    Channels: 6
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 44100, 48000
    Bits: 16
    Channel map: FL FR FC LFE SL SR

Tested with speaker-test -Dsurround40:CARD=ICUSBAUDIO7D,DEV=0 -c4

The speaker system that required surround40 in order to downmix LFE into
the front/rear mix is a Klipsch ProMedia v.2-400, which has 4 speakers
and a subwoofer with an internal crossover, connected via front and rear
stereo analog cables.

Closes: https://github.com/alsa-project/alsa-lib/pull/319
Signed-off-by: Ryan Underwood <nemesis@icequake.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:12:53 +01:00
Jaroslav Kysela
5801f1b861 .gitignore: add src/Versions.in to ignore file list
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:12:23 +01:00
Nicholas Vinson
14308adb0d src/Versions.in: Add guards for pcm and timer syms
Configure script allows for the disabling of the pcm module. When
disabled, the pcm symbols will not be available. Add guards to remove
symbols from version map when not present.

Closes: https://github.com/alsa-project/alsa-lib/pull/376
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:12:14 +01:00
Nicholas Vinson
10ff172202 src/Versions.in: Add guards for opt. alisp symbols
Add guards for optional alisp symbols. This ensures that the Versions
file does not contain undefined symbols when building alisp support is
disabled.

Fixes Gentoo bugs 914511 (https://bugs.gentoo.org/914511),
    914643 (https://bugs.gentoo.org/914643),
    and 919417 (https://bugs.gentoo.org/919417).

Fixes bug #305
Fixes alsa_lisp symbol error reported in bug #356

Closes: https://github.com/alsa-project/alsa-lib/pull/376
Fixes: https://github.com/alsa-project/alsa-lib/issues/305
Link: https://github.com/alsa-project/alsa-lib/issues/356
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:11:52 +01:00
Nicholas Vinson
c905573003 configure.ac: Update AC_OUTPUT() function
Modern autoconf practice says AC_OUTPUT() should be called with no
arguments and generated configuration files should be specified by
calling AC_CONFIG_FILES() before AC_OUTPUT().

Update configure.ac to follow this practice.

Closes: https://github.com/alsa-project/alsa-lib/pull/376
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-24 18:11:39 +01:00
Jaroslav Kysela
dc7da761f3 topology: separate Versions linker script
A slightly different solution is preferred than PR recommends (bellow).
Only symbols with snd_ prefix should be public. Create a minimal Versions
file for libatopology.

Link: https://github.com/alsa-project/alsa-lib/pull/376
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-23 16:22:05 +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
Zeno Endemann
31f2ab57e2 pcm: documentation improvement mostly regarding samples and frames
In some places samples and frames are used interchangeably, which may
be a little confusing, so update it to say 'frames' where it could matter.

Closes: https://github.com/alsa-project/alsa-lib/pull/375
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-02 12:02:43 +01:00
Jaroslav Kysela
c3fec78ddd pcm: handle start_treshold in snd_pcm_write_areas more robustly
The start_treshold is defined as unsigned, so fix the condition
to allow using values avobe LONG_MAX.

Also, fix the documentation for the 64-bit platforms (INTMAX -> LONG_MAX).

Fixes: https://github.com/alsa-project/alsa-lib/issues/374
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-02 11:20:05 +01:00
Jaroslav Kysela
19e6349182 pcm: plug plugin - fast_ops may be changed when sw_params are set
Link: https://github.com/alsa-project/alsa-lib/issues/372
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-02 11:03:30 +01:00
Jaroslav Kysela
d4992c36cc pcm: fix the documentation for snd_pcm_poll_descriptors again
As noted in the github issue, the poll descriptors may change depending
on the stream parameters.

Fixes: cd04da2b ("pcm: clarify documentation of poll descriptor usage")
Fixes: https://github.com/alsa-project/alsa-lib/issues/372
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-02 10:52:33 +01:00
Jaroslav Kysela
60d6fad711 control: remap - fix the endless loop in remap_numid_child_new()
Avoid the new numid search for the maped only controls.

Link: https://lore.kernel.org/alsa-devel/20231219164539.GB14858@ediswmail.ad.cirrus.com/
Reported-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-19 18:45:54 +01:00
Jaroslav Kysela
3d4230aa8c configure: bumb version to 1.2.11pre1 (for aplay/alsa-utils)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-12 13:41:30 +01:00
Mingjie Shen
0e0a92bde2 aserver: fix buffer overwriting
name array should allocate space for the null terminator. Also, need to
check if client->name has enough space for strcpy.

Closes: https://github.com/alsa-project/alsa-lib/pull/364
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-11 09:20:06 +01:00
Zeno Endemann
cd04da2bcf pcm: clarify documentation of poll descriptor usage
This is based on my understanding of the intended behavior, the
test/pcm.c example code, as well as the github pull request
discussion (#370).

There needs to be more clarifiaction regarding the exact semantics
of the value of the revents output parameter of
snd_pcm_poll_descriptors_revents, since there are events that do
not necessarily correspond to POLLIN or POLLOUT (such as period
events), but I believe this is a lot less obvious and needs
confirmation first.

Closes: https://github.com/alsa-project/alsa-lib/pull/370
Signed-off-by: Zeno Endemann <zeno.endemann@mailbox.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-11 09:18:59 +01:00
Zeno Endemann
454638ef30 pcm: clarify documentation on some hw params related functions
Closes: https://github.com/alsa-project/alsa-lib/pull/369
Signed-off-by: Zeno Endemann <zeno.endemann@mailbox.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-08 20:14:28 +01:00
Cezary Rojewski
caab680d7e pcm: Fix incompatible-pointer-type warnings
Update snd_pcm_subformat_t getters and setters so they no longer throw
warnings when building.

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:51 +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
Takashi Iwai
ed6b07084b seq: Check protocol compatibility with the current version
There is no need for checking the protocol compatibility with another
version, but we just need to check for the current version.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-07 12:16:47 +01:00
Takashi Iwai
94a5ddff9d seq: Simplify snd_seq_extract_output()
Now that we never put UMP events on the output buffer in the legacy
mode, the check and skip of UMP events are no longer necessary.
It means that ump_allowed argument is meaningless in extract_output(),
too.

Let's drop the unnecessary check and move the code extract_output()
into snd_seq_extract_output() again, and call this directly from
snd_seq_ump_extract_output() for simplification.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-07 12:16:47 +01:00
Takashi Iwai
2fca03e792 seq: Clear UMP event flag for legacy apps
It seems that some applications (at least Chrome WebMIDI) set random
bits to the flags of event packet, and this confuses as if they were
UMP-events, which are eventually filtered out.

Although it's a bug of applications, it's better to avoid the
regressions.  So this patch forcibly clears the UMP flag of the
incoming and outgoing events when the application is running in the
legacy mode (i.e. midi_version = 0).

Fixes: 2aefb5c41c ("seq: Add UMP support")
Closes: https://github.com/alsa-project/alsa-lib/issues/360
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-07 12:16:47 +01:00
Hector Martin
f202ec3c23 mixer: simple: Support dB TLVs for CTL_SINGLE controls
dB mappings do not work for controls not named "* Volume", since we do not
fall back to CTL_SINGLE in get_selem_ctl. Add that branch to make it
work.

Fixes dB ranges for e.g. controls named "* Gain".

Closes: https://github.com/alsa-project/alsa-lib/pull/358
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-11-07 10:30:46 +01:00
Takashi Iwai
915a71a2cd seq: Fix invalid sanity-check in snd_seq_set_input_buffer_size()
snd_seq_set_input_buffer_size() has an assert() call with packet_size,
but it's still uninitialized at that point.  Fix it with the real
packet size.

Fixes: 2aefb5c41c ("seq: Add UMP support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-04 10:05:39 +01:00
Takashi Iwai
96f60d829f seq: Fix typos in symbol version definitions
There were obvious typos in src/Versions.in that resulted in the
undefined symbols.  Correct those entries.

Fixes: 2aefb5c41c ("seq: Add UMP support")
Closes: https://github.com/alsa-project/alsa-lib/issues/356
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-10 08:20:15 +02:00
Jaroslav Kysela
81a7a93636 reshuffle included files to include config.h as first - v2
config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).

Fixes: ad3a8b8b ("reshuffle included files to include config.h as first")
Related: https://github.com/alsa-project/alsa-lib/pull/333
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-13 12:35:35 +02:00
Takashi Iwai
0e3dfb9f70 pcm: Fix segfault with 32bit libs
The recent rearrangement of header inclusion order caused a regression
showing segfaults on 32bit Arm.  The primary reason is the
inconsistent compile condition depending on the inclusion of config.h;
while most of other code include pcm_local.h (that implicitly includes
config.h) at first, pcm_direct.c doesn't do it, hence the access with
direct plugins crashes.

For fixing it, we need to include config.h at the beginning.  But,
it's better to include pcm_local.h for all relevant code for
consistency.  The patch does it, and also it adds the guard in
pcm_local.h for double inclusions.

Fixes: ad3a8b8b31 ("reshuffle included files to include config.h as first")
Link: https://github.com/alsa-project/alsa-lib/issues/352
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-09 17:42:03 +02: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
Jaroslav Kysela
9685505bf4 gitcompile: Add static build
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 09:37:29 +02:00
Jaroslav Kysela
f70653fda7 Release v1.2.10
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 17:35:48 +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
8883943995 ucm: main - remove cast to pointer from integer of different size warning
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:50:51 +02:00
Tony Wasserka
00da3feace ucm: mark internal functions static
From: Tony Wasserka /neobrain@github/
Fixes: https://github.com/alsa-project/alsa-lib/pull/335
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:40:56 +02:00
Jaroslav Kysela
9ed626d472 topology: fix src/mixer/mixer.c return value warning
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 16:27:43 +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
2714f438cb doxygen: fix broken examples links
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:32 +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
731253e82a doxygen: conf: do not hide PCM specific function
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:20 +02:00
borine
bbe38d055f doxygen: silence warning from asoundlib.h
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:16 +02:00
borine
cde0e819f7 doxygen: ucm: silence warnings
Removes duplicate documentation blocks and fixes '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:10 +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
47228e4e6e doxygen: seq: 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:47 +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
72e72ed029 doxygen: rawmidi: 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:39 +02:00
borine
473a2eaba8 doxygen: control: silence 'not documented' item 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:34 +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
6a0a316bfb doxygen: include external control 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:26 +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
df0feab38f doxygen: fix image path
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:03 +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
Jaroslav Kysela
6142ff0ca7 configure: add AC_SYS_LARGEFILE
The support for the large files may be disabled using
--disable-largefile configure parameter.

Related: https://github.com/alsa-project/alsa-lib/pull/333
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 17:04:58 +02:00
Takashi Iwai
dc1e683cc2 seq: Fix wrong seq version update at snd_seq_hw_get_client_info()
snd_seq_hw_get_client_info() calls mistakenly update_midi_version()
that leads to the update of seq->version from another client info.
It may lead to the inconsistent packet size calculation and the
unaligned read, eventually a program may hit segfault.

Drop the incorrect call of update_midi_version() for fixing it.

Fixes: 2aefb5c41c ("seq: Add UMP support")
Closes: https://github.com/alsa-project/alsa-utils/issues/232
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-26 21:38:13 +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
Jaroslav Kysela
ec20272797 test: oldapi - fix the clang-16 compilation error
Fixes: https://github.com/alsa-project/alsa-lib/issues/323
From: Fabio Scaccabarozzi
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-22 16:52:15 +02:00
Takashi Iwai
403d687b95 rawmidi: Suppress error messages for non-fatal errors
Align the behavior of rawmidi errors at open & co with PCM, i.e. use
SYSMSG() instead of SYSERR() for suppressing the error messages as
default.

Closes: https://github.com/alsa-project/alsa-lib/issues/344
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-22 14:29: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
Dan Cross
b7389e2e2e pcm: hw: fix minor bug in sw_params ioctl
Commit 2115cdb added a new call to the `SNDRV_PCM_IOCTL_SW_PARAMS`
ioctl on line 675 of src/pcm/pcm_hw.c, but passed the `sw_params`
argument by value; this should be passed by pointer.

I ran across this in the context of the direwolf software modem
for amateur radio; debugging details are in
https://groups.io/g/direwolf/message/8286

Fixes: https://github.com/alsa-project/alsa-lib/pull/330

Signed-off-by: Dan Cross <cross@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-06-15 07:51:11 +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
Takashi Iwai
e80ee6ae75 ump: Add helpers for handling SysEx data
Yet a few more helpers for handling SysEx data with UMP packets.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Takashi Iwai
040356ecf0 ump: Add helpers to parse / set UMP packet data
This patch defines the structs / unions that can be used for encoding
and decoding UMP packets, as well as inline helper functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +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
Takashi Iwai
f47763d2c1 ump: Add initial support
This patch adds the initial support for UMP rawmidi access.
It's merely the wrapper for the standard rawmidi to access to the UMP
rawmidi device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Takashi Iwai
6627953de0 rawmidi: Add UMP ioctl support
Just implement internal callbacks for two new ioctls for UMP
(ump_endpoint_info and ump_block_info).  No public API functions are
added yet here.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Takashi Iwai
a034b84705 uapi: Update control API to 2.0.9
Copied from the kernel uapi header for control API.
A few new ioctls have been added for the support of UMP next device
and inquiries of UMP Endpoint and Block info.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Takashi Iwai
c86a4f5cf6 uapi: Update rawmidi API to 2.0.3
Copied from the kernel uapi header for rawmidi API.
A few new structs and constants for UMP are defined in addition to a
few new ioctls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-06 15:13:27 +02:00
Jaroslav Kysela
cbdb428ab9 remove extra trailing new line in SNDMSG and SNDERR calls
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-06-06 13:47:41 +02:00
Jaroslav Kysela
325210acc8 usecase: add CaptureMicInfoFile field to documentation
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-16 15:57:15 +02:00
Jaroslav Kysela
55cdf2fd63 include: fix SND_DLSYM_BUILD_VERSION() for static build
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>
2023-05-16 09:16:12 +02:00
Jaroslav Kysela
3661bdae35 pcm: hw - prevent divide by zero for broken apps
Fixes: https://github.com/alsa-project/alsa-lib/issues/318
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-16 08:59:20 +02:00
Jaroslav Kysela
904f0f7e7a Release v1.2.9
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-04 09:16:16 +02:00
Jaroslav Kysela
58077e2f0d pcm: hw: fix the silence size setup in drain
The silence size cannot exceed the silence threshold. Move the check
from the manual condition to the common code. This may happen for
small ring buffers (where the 1/10th second is too large).

Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 22:27:40 +02:00
Oswald Buddenhagen
798f387fe9 conf/emu10k1: remove compat with two decades old drivers
There really isn't much of a point to clutter the files with this.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 18:01:40 +02:00
Oswald Buddenhagen
3da32ca4db pcm: remove duplicate SND_PCM_HW_PARAM_{FIRST,LAST}_* #defines
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 17:59:49 +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
Jaroslav Kysela
d6d5982d3a pcm: add SND_PCM_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
Jaroslav Kysela
e2d9e41174 pcm: improve handling for snd_pcm_wait()
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>
2023-05-03 15:59:15 +02:00
Jaroslav Kysela
1de6f99c7d pcm: add new symbols to Versions.in
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 15:58:57 +02:00
Jaroslav Kysela
264d6c43ee pcm: hw: introduce SNDRV_PCM_HW_PARAMS_DRAIN_SILENCE
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>
2023-05-03 15:58:56 +02:00
Jaroslav Kysela
90e25887d2 pcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAIN
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>
2023-05-03 14:00:57 +02:00
Jaroslav Kysela
dd9cb31a90 pcm: hw: add drain_silence configuration keyword
# Add silence in drain (-1 = auto /default/, 0 = off, > 0 milliseconds)
  [drain_silence INT]

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 13:56:19 +02:00
Jaroslav Kysela
2115cdb4dc pcm: hw: setup explicit silencing for snd_pcm_drain by default
Some applications may not alignt transfers to the period size
and also the driver developers may not follow the consequeces of the
access beyond valid samples in the playback DMA buffer.

To avoid clicks, fill a little silence at the end of the playback
ring buffer when snd_pcm_drain() is called.

Related: https://lore.kernel.org/alsa-devel/20230420113324.877164-2-oswald.buddenhagen@gmx.de/
Related: https://lore.kernel.org/alsa-devel/20230405201219.2197789-2-oswald.buddenhagen@gmx.de/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 13:50:56 +02:00
Maxython
b40fcda7fb compilation: fix ANDROID -> __ANDROID__ define detection
Fixes: https://github.com/alsa-project/alsa-lib/pull/301/
Signed-off-by: Maxython <mixython@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-02 14:52:27 +02:00
Jaroslav Kysela
a8afb0449c pcm: avoid endless loop in snd_pcm_sw_params_default()
BugLink: https://lore.kernel.org/alsa-devel/167734349294.22.1388671545195719262@mailman-web.alsa-project.org/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-02-25 18:03:46 +01:00
SASANO Takayoshi
44705e3a20 test: BSD-like fixes
- rename devname -> pcmdev, it conflicts *BSD <stdlib.h> function
- replace <values.h> -> <limits.h> and fix K&R style related warning
- use config.h to determine include <malloc.h>
- add OpenBSD support and fix printf() warning
- fix warning

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>
2023-02-03 13:22:04 +01:00
SASANO Takayoshi
3b4cdbdf19 type_compat.h: use ESPIPE instead of EPIPE when ESTRPIPE not defined
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>
2023-02-03 13:21:54 +01:00
SASANO Takayoshi
fea9fc2298 configure: avoid libdl detecion on *BSD
NetBSD and OpenBSD has no libdl
FreeBSD and DragonFlyBSD has libdl but dummy

These OSes are no need to use -ldl to use dlopen()

Fixes: https://github.com/alsa-project/alsa-lib/pull/290
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-29 19:00:59 +01:00
Gunnar Dibbern
2f9bbefb8d pcm: hw - fix return code checking in snd_pcm_hw_hw_refine
The isse was introduced in commit 7f2d6c3

Fixes: 7f2d6c3a ("pcm: hw: change rate range syntax")
Fixes: https://github.com/alsa-project/alsa-lib/issues/271
Fixes: https://github.com/alsa-project/alsa-lib/pull/293
Signed-off-by: Gunnar Dibbern <gunnar.dibbern@lht.dlh.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-29 18:58:51 +01:00
Amadeusz Sławiński
e11ea20645 topology: Parse ignore_suspend property for dapm widget
snd_soc_tplg_dapm_widget has ignore_suspend field, but there is no way
to set value for it, because we don't parse topology field for it.
Fix this by adding parsing code.

Fixes: https://github.com/alsa-project/alsa-lib/pull/230
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-29 18:55:53 +01:00
Amadeusz Sławiński
e824f70d62 topology: Add decompilation support for ignore_suspend
Previous patch added build support for ignore_suspend, however it should
be also possible to decompile binary back to human readable form and not
lose data.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-29 18:55:29 +01:00
Cezary Rojewski
d72da154a3 topology: Parse ignore_suspend flag
XXX_VOICE_WAKEUP also known as 'ignore_suspend' is already processed by
kernel in soc-topology, but there is no way of setting it via topology
file like it's the case for other flags. Fix this by adding it to pcm,
dai and link parsing mechanism.

Signed-off-by: Piotr Maziarz <piotrx.maziarz@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-29 18:55:29 +01:00
Sam James
1fc1c1b7dc utils/alsa.m4: include <stdlib.h> for exit()
Clang 16 makes -Wimplicit-function-declaration an error by default
and it's easier to just explicitly include <stdlib.h> rather
than hope the ALSA headers always have it.

Fixes: https://github.com/alsa-project/alsa-lib/pull/278
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-29 18:51:54 +01:00
Jaroslav Kysela
496c4e031b ucm: fix geti() macro - return zero on success
Fixes: c083417b ("ucm: simplify and fix the previous patch (geti)")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-15 18:57:56 +01:00
Jaroslav Kysela
c083417b72 ucm: simplify and fix the previous patch (geti)
Use macro to maintain only one code. The status may be 0 or 1 - handle
both values correctly.

Also, fix the possible memory leak in snd_use_case_geti() - string
str should be freed even when the error is returned.

Fixes: 436cd5b6 ("ucm: add existence checks to geti calls")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-15 18:37:40 +01:00
Curtis Malainey
436cd5b6d0 ucm: add existence checks to geti calls
Right now in snd_use_case_geti you cannot tell if the item being queried
exists or not when being checked. This also means the only way to check
for the existence of something in the client of the library is to
iterate over the list of mods/devs even if we know exactly the name we
are looking for. We have functions that do exactly this internally so
lets return this information in a logical fashion through geti.

Also clean up some trailing white space nearby.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-15 17:57:13 +01:00
Jaroslav Kysela
d25ddafaa7 ucm: fix possible memory leak in execute_sysw()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-05 15:42:31 +01:00
Alan Young
2e82060ebc pcm: rate: fix last_commit_ptr boundary wrapping
Wrap last_commit_ptr using boundary. Was just wrapped to 0, which is
correct only if the buffer size, and hence the boundary, is an integer
multiple of the period size.

Fixes: 467d69c5bc ("Fix CPU hog with combination of rate plugin")
Fixes: 29041c5220 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Link: https://lore.kernel.org/alsa-devel/20221230164814.901457-1-consult.awy@gmail.com/
Signed-off-by: Alan Young <consult.awy@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-12-30 20:12:42 +01:00
Jaroslav Kysela
9f2c68cef7 pcm: route/softvol use snd_config_get_ireal vs get_real to handle also integers
Link: https://lore.kernel.org/alsa-devel/f9a7ad6a256d4ad7a31642dcf875d436@axis.com/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-12-13 10:31:35 +01:00
Jaroslav Kysela
13e31fb1ec alsa-lib: conf - fix possible use-after-free in get_char_skip_comments
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-12-07 14:54:30 +01:00
Jaroslav Kysela
e29413a220 ucm: execute_sysw - fix possible use-after-free
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-12-07 14:51:32 +01:00
Jaroslav Kysela
d28e8cb294 topology: ctl - remove the wrong (debug) code
This code was commited by mistake. It was used for testing
of ALSA_PCM_OLD_HW/SW_PARAMS_API.

BugLink: https://github.com/thesofproject/sof/issues/6667
Related-to: 78b20e3c ("test: latency - use snd_pcm_format_physical_width()")
Reported-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-29 19:43:52 +01:00
Jaroslav Kysela
75f8e2e73e test: latency - --policy option - allow using SCHED_OTHER
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-24 10:55:32 +01:00
Jaroslav Kysela
ea0850f3f3 test: latency - add --policy option to allow using SCHED_FIFO
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-24 08:33:47 +01:00
Jaroslav Kysela
536c93928b test: latency - usleep should not be used in the block mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-23 19:45:15 +01:00
Jaroslav Kysela
f0f054517c test: latency - add -y option (I/O usleep)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-23 17:56:20 +01:00
Jaroslav Kysela
9649b64c6f ucm: handle empty string also for ${env:} substitution
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-22 09:59:04 +01:00
Jaroslav Kysela
8b64f22459 ucm: clarify set_defaults calls
- do full reset in snd_use_case_mgr_reload

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-15 17:28:39 +01:00
Jaroslav Kysela
a0836e2af1 latency: add timestamps to the POS lines
- remove first capture pos line
- measure the snd_pcm_start() call, too

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 21:27:09 +01:00
Jaroslav Kysela
3e4aeba25b test: latency - add more realtime tests
Add '-x' and '-X' tests and '-U' - I/O update mode based
on the system timing.

It may be required to check the position updates for the specific hardware.
Print the real time / stream time differences.

Also include code to make valgrind happy (including the wrong memory
llocation for the stream buffer).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 20:47:59 +01:00
Jaroslav Kysela
425e4d1fbe pcm: fix the fast_ops pcm argument for fast_ops
The fast_ops callback invocation must always pass the fast_op_arg
as the pcm argument. Plugins expect that.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 14:39:26 +01:00
Jaroslav Kysela
78b20e3caa test: latency - use snd_pcm_format_physical_width()
We need to allocate frames using the physical size not
the sample bit size.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-14 12:36:07 +01:00
Jaroslav Kysela
152983f01b include: alsa-symbols.h - use newer gcc symver function attribute
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>
2022-11-09 15:18:43 +01:00
Jaroslav Kysela
161f47da5f include: pcm_old.h - use a macro for the symbol versioning
Make the header file more readable and error prone.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 15:03:09 +01:00
Jaroslav Kysela
39060852d8 pcm: rate - correct the previous fix for snd_pcm_rate_may_wait_for_avail_min()
The previous fix in aa4f56c3 was not correct. The root of the cause is
implementation in snd_pcm_may_wait_for_avail_min() inline function
where the improper pcm argument is passed to the fast_ops function.

Fixes: aa4f56c3 ("pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()")
Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 09:35:05 +01:00
Jaroslav Kysela
aa4f56c3c9 pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()
The pcm argument passed to the conversion function in
snd_pcm_plugin_may_wait_for_avail_min_conv() should be
pcm->fast_op_arg.

Test command: arecord -Dplughw:x -r12000 -c2 -fS16_LE -M temp.wav

Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin")

BugLink: https://lore.kernel.org/alsa-devel/1667793912-18957-1-git-send-email-shengjiu.wang@nxp.com/
Fixes: https://github.com/alsa-project/alsa-lib/issues/282
Reported-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-09 08:18:06 +01:00
Jaroslav Kysela
1b436862ed ucm: fix enhanced ID parsing in snd_use_case_parse_ctl_elem_id()
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-02 15:01:58 +01:00
Jaroslav Kysela
9447e57d7c Release v1.2.8
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-24 10:17:27 +02:00
Jaroslav Kysela
7e678d70c2 control: namehint - do not support 'card' devices
The card: devices do not exist. Do not return -ENOENT,
but -EINVAL in this case.

Fixes: https://github.com/alsa-project/alsa-lib/issues/277
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-24 10:02:54 +02:00
Jaroslav Kysela
3bb9c44375 ucm: do not handle multiple Syntax field updates
It is useful to include a toplevel configuration file from another
toplevel configuration file. Ignore the further Syntax updates
(assuming the that the parent knows what to do).

Also, parse the Syntax field in own function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-20 19:56:50 +02:00
Jaroslav Kysela
4633d35171 control: eld - skip trailing spaces
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-18 15:53:52 +02:00
Jaroslav Kysela
9253f08fb7 pcm: rate: fix the crash for the partial period copy
The size argument in snd_pcm_rate_commit_area can be smaller
than cont in drain. Return the original code. It should
not make things worse. Perhaps, we can fill the rest of
the period with silence in this case.

Fixes: https://github.com/alsa-project/alsa-lib/issues/274
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:58:41 +02:00
Swapnil Devesh
dac9059524 Remove non existent SPDIF output on ThinkPad USB-C Dock Gen2
Fixes: https://github.com/alsa-project/alsa-lib/pull/268
Signed-off-by: Swapnil Devesh <sid.swapnildevesh@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:13:51 +02:00
SASANO Takayoshi
60c1430b43 add DragonFlyBSD build support (except test/)
due to undefined reference to 'environ' error, ucm_exec.c uses workaround.

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>
2022-10-17 13:11:47 +02:00
SASANO Takayoshi
f89245ee66 add FreeBSD build support (except test/)
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>
2022-10-17 13:11:34 +02:00
SASANO Takayoshi
b33ef3f73d add NetBSD/OpenBSD build support (except test/)
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>
2022-10-17 13:11:29 +02:00
Jaroslav Kysela
e288ca7c29 doc: ucm - more volume notes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-17 13:08:11 +02:00
Jaroslav Kysela
595115758b doc: ucm - add sequence graphs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-09-16 19:02:16 +02:00
Jaroslav Kysela
0222f45d11 pcm: hw_params - copy periods and buffer_time to the local variable
It is expected to return the correct numbers for get_periods and
get_buffer_time requests. Copy the appropriate fields in the
hw_params call.

Fixes: https://github.com/alsa-project/alsa-lib/issues/258
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-18 11:23:45 +02:00
Jaroslav Kysela
8033ff9996 pcm: fix the dshare delay reporting
Pulseaudio uses full ring buffer when the incorrect delay is reported.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/198
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-16 17:22:36 +02:00
Jaroslav Kysela
d80616c0c1 ucm: add NULL check for card_name in open
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 22:00:34 +02:00
Jaroslav Kysela
fc86eafa08 ucm: fix few memory-leaks in the error paths
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 21:56:57 +02:00
Jaroslav Kysela
378c6a9215 pcm: direct plugins: make three more symbols private to library
Those symbols should not be exported:
	snd_pcm_direct_poll_descriptors
	snd_pcm_direct_check_xrun
	snd_pcm_direct_slave_recover

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-07-08 21:44:50 +02:00
210 changed files with 7416 additions and 6890 deletions

View file

@ -11,9 +11,9 @@ jobs:
- name: Prepare environment
run: |
dnf -y upgrade
dnf -y install @development-tools libtool bzip2
dnf -y install @development-tools libtool bzip2 awk
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Safe git directory
@ -64,7 +64,7 @@ jobs:
cd alsa-lib-$(cat version)
make install
- name: Archive package
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: alsa-lib-test-package
path: artifacts/
@ -75,7 +75,7 @@ jobs:
image: ubuntu:latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare environment
run: |
export DEBIAN_FRONTEND=noninteractive

4
.gitignore vendored
View file

@ -35,7 +35,6 @@ include/version.h
include/alsa
include/asoundlib.h
utils/alsa-lib.spec
alsalisp/alsalisp
aserver/aserver
m4/libtool.m4
m4/ltoptions.m4
@ -43,6 +42,7 @@ m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
src/Versions
src/Versions.in
src/conf/topology/sklrt286/data/pvt_data
src/control/ctl_symbols_list.c
src/pcm/pcm_symbols_list.c
@ -64,6 +64,8 @@ test/playmidi1
test/queue_timer
test/rawmidi
test/seq
test/seq-ump-example
test/timer
test/umpinfo
test/lsb/config
test/lsb/midi_event

View file

@ -10,11 +10,6 @@ endif
if BUILD_PCM_PLUGIN_SHM
SUBDIRS += aserver
endif
if BUILD_MIXER
if BUILD_ALISP
SUBDIRS += alsalisp
endif
endif
SUBDIRS += test utils
EXTRA_DIST=README.md ChangeLog INSTALL TODO NOTES configure gitcompile libtool \
depcomp version MEMORY-LEAK m4/attributes.m4

View file

@ -1,8 +0,0 @@
noinst_PROGRAMS = alsalisp
alsalisp_SOURCES = alsalisp.c
alsalisp_LDADD = ../src/libasound.la
all: alsalisp
AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src/alisp

View file

@ -1,110 +0,0 @@
/*
* ALSA lisp implementation
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include "asoundlib.h"
#include "alisp.h"
static int verbose = 0;
static int warning = 0;
static int debug = 0;
static void interpret_filename(const char *file)
{
struct alisp_cfg cfg;
snd_input_t *in;
snd_output_t *out;
int err;
memset(&cfg, 0, sizeof(cfg));
if (file != NULL && strcmp(file, "-") != 0) {
if ((err = snd_input_stdio_open(&in, file, "r")) < 0) {
fprintf(stderr, "unable to open filename '%s' (%s)\n", file, snd_strerror(err));
return;
}
} else {
if ((err = snd_input_stdio_attach(&in, stdin, 0)) < 0) {
fprintf(stderr, "unable to attach stdin '%s' (%s)\n", file, snd_strerror(err));
return;
}
}
if (snd_output_stdio_attach(&out, stdout, 0) < 0) {
snd_input_close(in);
fprintf(stderr, "unable to attach stdout (%s)\n", strerror(errno));
return;
}
cfg.verbose = verbose;
cfg.warning = warning;
cfg.debug = debug;
cfg.in = in;
cfg.out = cfg.eout = cfg.vout = cfg.wout = cfg.dout = out;
err = alsa_lisp(&cfg, NULL);
if (err < 0)
fprintf(stderr, "alsa lisp returned error %i (%s)\n", err, strerror(err));
else if (verbose)
printf("file %s passed ok via alsa lisp interpreter\n", file);
snd_output_close(out);
snd_input_close(in);
}
static void usage(void)
{
fprintf(stderr, "usage: alsalisp [-vdw] [file...]\n");
exit(1);
}
int main(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "vdw")) != -1) {
switch (c) {
case 'v':
verbose = 1;
break;
case 'd':
debug = 1;
break;
case 'w':
warning = 1;
break;
case '?':
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;
argv += optind;
if (argc < 1)
interpret_filename(NULL);
else
while (*argv)
interpret_filename(*argv++);
return 0;
}

View file

@ -1,91 +0,0 @@
(setq card (Acall 'card_next -1))
(setq card (Aresult card))
(while (>= card 0)
(progn
(princ "found card: " card "\n")
(princ " name : " (Aresult (Acall 'card_get_name card)) "\n")
(princ " longname: " (Aresult (Acall 'card_get_longname card)) "\n")
(setq card (Acall 'card_next card))
(setq card (Aresult card))
)
)
(unsetq card)
(princ "card_get_index test (SI7018): " (Acall 'card_get_index "SI7018") "\n")
(princ "card_get_index test (ABCD): " (Acall 'card_get_index "ABCD") "\n")
(setq hctl (Acall 'hctl_open 'default nil))
(if (= (Aerror hctl) 0)
(progn
(princ "open success: " hctl "\n")
(setq hctl (Ahandle hctl))
(princ "open hctl: " hctl "\n")
(setq hctl (Acall 'hctl_close hctl))
(if (= hctl 0)
(princ "close success\n")
(princ "close failed: " hctl "\n")
)
)
(progn
(princ "open failed: " hctl "\n")
)
)
(unsetq hctl)
(setq ctl (Acall 'ctl_open 'default nil))
(if (= (Aerror ctl) 0)
(progn
(princ "ctl open success: " ctl "\n")
(setq ctl (Ahandle ctl))
(setq info (Aresult (Acall 'ctl_card_info ctl)))
(princ "ctl card info: " info "\n")
(princ "ctl card info (mixername): " (cdr (assq "mixername" info)) "\n")
(unsetq info)
(setq hctl (Acall 'hctl_open_ctl ctl))
(if (= (Aerror hctl) 0)
(progn
(princ "hctl open success: " hctl "\n")
(setq hctl (Ahandle hctl))
(princ "open hctl: " hctl "\n")
(princ "load hctl: " (Acall 'hctl_load hctl) "\n")
(princ "first : " (Acall 'hctl_first_elem hctl) "\n")
(princ "last : " (Acall 'hctl_last_elem hctl) "\n")
(princ "next (first): " (Acall 'hctl_elem_next (Acall 'hctl_first_elem hctl)) "\n")
(princ "prev (last) : " (Acall 'hctl_elem_prev (Acall 'hctl_last_elem hctl)) "\n")
(setq elem (Acall 'hctl_first_elem hctl))
(while elem
(progn
(setq info (Acall 'hctl_elem_info elem))
(princ info "\n")
(setq value (Acall 'hctl_elem_read elem))
(princ value "\n")
(when (equal (cdr (assq "name" (car (cdr (assq "id" (Aresult info)))))) "Master Playback Volume")
(princ "write Master: " (Acall 'hctl_elem_write elem (20 20)) "\n")
)
(unsetq info value)
(gc)
(setq elem (Acall 'hctl_elem_next elem))
)
)
(unsetq elem)
(setq hctl (Acall 'hctl_close hctl))
(if (= hctl 0)
(princ "hctl close success\n")
(princ "hctl close failed: " hctl "\n")
)
)
(progn
(princ "hctl open failed: " hctl "\n")
(Acall 'ctl_close ctl)
)
)
(unsetq hctl)
)
(progn
(princ "ctl open failed: " ctl "\n")
)
)
(unsetq ctl)
(&stat-memory)
(&dump-memory "memory.dump")

View file

@ -1,26 +0,0 @@
(princ "Hello ALSA world\n")
(princ "One " 1 "\n")
(princ "Two " (+ 1 1) "\n")
(defun myprinc (o) (progn (princ o)))
(myprinc "Printed via myprinc function!\n")
(unsetq myprinc)
(defun printnum (from to) (while (<= from to) (princ " " from) (setq from (+ from 1))))
(princ "Numbers 1-10: ") (printnum 1 10) (princ "\n")
(unsetq printnum)
(defun factorial (n) (if (> n 1) (* n (factorial (- n 1))) 1))
(princ "Factorial of 10: " (factorial 10) "\n")
(princ "Float test 1.1 + 1.35 = " (+ 1.1 1.35) "\n")
(princ "Factorial of 10.0: " (factorial 10.0) "\n")
(princ "Factorial of 20.0: " (factorial 20.0) "\n")
(unsetq factorial)
(setq alist '((one . first) (two . second) (three . third)))
(princ "alist = " alist "\n")
(princ "alist assoc one = " (assoc 'one alist) "\n")
(princ "alist rassoc third = " (rassoc 'third alist) "\n")
(unsetq alist)
(&stat-memory)

View file

@ -1 +0,0 @@
(princ "itest.lisp file included!\n")

View file

@ -1,382 +0,0 @@
;
; Test code for all basic alsa lisp commands.
; The test is indended to find memory leaks.
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
;
; Basic commands
;
(!=) (&check-memory)
(!= 0) (&check-memory)
(!= 0 1) (&check-memory)
(!= 1 1) (&check-memory)
(!= 0 1 2) (&check-memory)
(!= 'aaaa 'bbbb) (&check-memory)
(%) (&check-memory)
(% 11) (&check-memory)
(% 11 5) (&check-memory)
(% 11.5 5.1) (&check-memory)
(% 11.5 5.1 2.2) (&check-memory)
(% 'aaaa 'bbbb) (&check-memory)
(&check-memory) (&check-memory)
(&check-memory "abcd") (&check-memory)
(&dump-memory "-") (&check-memory)
(&dump-memory) (&check-memory)
(&dump-objects "-") (&check-memory)
(&dump-objects) (&check-memory)
(&stat-memory) (&check-memory)
(&stat-memory "abcd") (&check-memory)
(*) (&check-memory)
(* 1) (&check-memory)
(* 1 2) (&check-memory)
(* 1.1 2.2) (&check-memory)
(* 1.1 2.2 3.3) (&check-memory)
(* 'aaaa) (&check-memory)
(+) (&check-memory)
(+ 1) (&check-memory)
(+ 1 2) (&check-memory)
(+ 1.1 2.2) (&check-memory)
(+ 1.1 2.2 3.3) (&check-memory)
(+ 'aaaa) (&check-memory)
(+ 'aaaa 'bbbb) (&check-memory)
(+ "aaaa") (&check-memory)
(+ "aaaa" "bbbb") (&check-memory)
(+ "aaaa" "bbbb" "cccc") (&check-memory)
(-) (&check-memory)
(- 1) (&check-memory)
(- 1 2) (&check-memory)
(- 1.1 2.2) (&check-memory)
(- 1.1 2.2 3.3) (&check-memory)
(- 'aaaa) (&check-memory)
(- 'aaaa 'bbbb) (&check-memory)
(/) (&check-memory)
(/ 1) (&check-memory)
(/ 1 2) (&check-memory)
(/ 1.1 2.2) (&check-memory)
(/ 1.1 2.2 3.3) (&check-memory)
(/ 'aaaa) (&check-memory)
(/ 'aaaa 'bbbb) (&check-memory)
(<) (&check-memory)
(< 0) (&check-memory)
(< 0 1) (&check-memory)
(< 1 0) (&check-memory)
(< 0 1 2) (&check-memory)
(<=) (&check-memory)
(<= 0) (&check-memory)
(<= 0 1) (&check-memory)
(<= 1 0) (&check-memory)
(<= 0 1 2) (&check-memory)
(=) (&check-memory)
(= 0) (&check-memory)
(= 0 1) (&check-memory)
(= 1 1) (&check-memory)
(= 0 1 2) (&check-memory)
(>) (&check-memory)
(> 0) (&check-memory)
(> 0 1) (&check-memory)
(> 1 0) (&check-memory)
(> 0 1 2) (&check-memory)
(>= 0) (&check-memory)
(>= 0 1) (&check-memory)
(>= 1 0) (&check-memory)
(>= 0 1 2) (&check-memory)
(and) (&check-memory)
(and 0) (&check-memory)
(and 1) (&check-memory)
(and 0 0 0) (&check-memory)
(quote a) (&check-memory)
(assoc) (&check-memory)
(assoc 'one) (&check-memory)
(assoc 'one '((one . first))) (&check-memory)
(assoc 'one '((two . second))) (&check-memory)
(assoc 'one '((one . first) (two . second))) (&check-memory)
(assq) (&check-memory)
(assq 'one) (&check-memory)
(assq "one" '(("one" . "first"))) (&check-memory)
(assq "one" '(("two" . "second"))) (&check-memory)
(assq "one" '(("one" . "first") ("two" . "second"))) (&check-memory)
(atom) (&check-memory)
(atom 'one) (&check-memory)
(atom "one") (&check-memory)
(atom "one" 'two) (&check-memory)
(funcall) (&check-memory)
(car) (&check-memory)
(car '(one . two)) (&check-memory)
(cdr) (&check-memory)
(cdr '(one . two)) (&check-memory)
(concat) (&check-memory)
(concat 'aaaa) (&check-memory)
(concat 'aaaa 'bbbb) (&check-memory)
(concat "aaaa") (&check-memory)
(concat "aaaa" "bbbb") (&check-memory)
(concat "aaaa" "bbbb" "cccc") (&check-memory)
(cond) (&check-memory)
(cond 0) (&check-memory)
(cond 0 1) (&check-memory)
(cond 0 1 2) (&check-memory)
(cond 0 1 2 3) (&check-memory)
(cond (0 'a) (1 'b) (0 'd)) (&check-memory)
(cond 1) (&check-memory)
(cond 1 1) (&check-memory)
(cond 1 1 2) (&check-memory)
(cond 1 1 2 3) (&check-memory)
(cons) (&check-memory)
(cons "a") (&check-memory)
(cons "a" "b") (&check-memory)
(cons "a" "b" "c") (&check-memory)
(eq) (&check-memory)
(eq 1) (&check-memory)
(eq 0 0) (&check-memory)
(eq "a" "b") (&check-memory)
(eq "a" "b" "c") (&check-memory)
(equal) (&check-memory)
(equal 1) (&check-memory)
(equal 0 0) (&check-memory)
(equal "a" "b") (&check-memory)
(equal "a" "b" "c") (&check-memory)
(exfun) (&check-memory)
(exfun 'abcd) (&check-memory)
(exfun 'abcd 'ijkl) (&check-memory)
(format) (&check-memory)
(format 1) (&check-memory)
(format 'a) (&check-memory)
(format "a" "b" "c") (&check-memory)
(format "1.2") (&check-memory)
(format "%c" 43) (&check-memory)
(format "%d" 12) (&check-memory)
(format "%i" 12) (&check-memory)
(format "%f" 12.1) (&check-memory)
(format "%s" "abcd") (&check-memory)
(format "%s %i %i" "abcd" 1 2) (&check-memory)
(garbage-collect) (&check-memory)
(gc) (&check-memory)
(if) (&check-memory)
(if t) (&check-memory)
(if t 'a) (&check-memory)
(if t 'a 'b) (&check-memory)
(if nil) (&check-memory)
(if nil 'a) (&check-memory)
(if nil 'a 'b) (&check-memory)
(include "itest.lisp") (&check-memory)
(list) (&check-memory)
(list "a") (&check-memory)
(list "a" "b") (&check-memory)
(list "a" "b" "c") (&check-memory)
(not) (&check-memory)
(not 0) (&check-memory)
(not nil) (&check-memory)
(not t) (&check-memory)
(not 'a) (&check-memory)
(not 'a 'b 'c 'd) (&check-memory)
(nth) (&check-memory)
(nth 2) (&check-memory)
(nth 2 nil) (&check-memory)
(nth 2 '(('one 'two 'three))) (&check-memory)
(null) (&check-memory)
(null 0) (&check-memory)
(null nil) (&check-memory)
(null t) (&check-memory)
(null 'a) (&check-memory)
(null 'a 'b 'c 'd) (&check-memory)
(or) (&check-memory)
(or 0) (&check-memory)
(or 1) (&check-memory)
(or 0 0 0) (&check-memory)
(path) (&check-memory)
(path 0) (&check-memory)
(path 1) (&check-memory)
(path 0 0 0) (&check-memory)
(path "data") (&check-memory)
(princ) (&check-memory)
(princ "\nabcd\n") (&check-memory)
(princ "a" "b" "c\n") (&check-memory)
(prog1) (&check-memory)
(prog1 1) (&check-memory)
(prog1 1 2 3 4) (&check-memory)
(prog2) (&check-memory)
(prog2 1) (&check-memory)
(prog2 1 2 3 4) (&check-memory)
(progn) (&check-memory)
(progn 1) (&check-memory)
(progn 1 2 3 4) (&check-memory)
(quote) (&check-memory)
(quote a) (&check-memory)
(rassoc) (&check-memory)
(rassoc 'first) (&check-memory)
(rassoc 'first '((one . first))) (&check-memory)
(rassoc 'first '((two . second))) (&check-memory)
(rassoc 'first '((one . first) (two . second))) (&check-memory)
(rassq) (&check-memory)
(rassq "first") (&check-memory)
(rassq "first" '(("one" . "first"))) (&check-memory)
(rassq "first" '(("two" . "second"))) (&check-memory)
(rassq "first" '(("one" . "first") ("two" . "second"))) (&check-memory)
(set) (&check-memory)
(set "a") (unset "a") (&check-memory)
(set "a" 1) (unset "a") (&check-memory)
(set a 1) (unset a) (&check-memory)
(set "a" 1 2) (unset "a") (&check-memory)
(setf) (&check-memory)
(setf a) (unsetf a) (&check-memory)
(setf a 1) (unsetf a) (&check-memory)
(setf a 1 2) (unsetf a) (&check-memory)
(setq) (&check-memory)
(setq a) (unsetq a) (&check-memory)
(setq a 1) (unsetq a) (&check-memory)
(setq a 1 2) (unsetq a) (&check-memory)
(string-equal) (&check-memory)
(string-equal 1) (&check-memory)
(string-equal "a") (&check-memory)
(string-equal "a" "a") (&check-memory)
(string-equal "a" "b") (&check-memory)
(string-equal "a" "b" "c") (&check-memory)
(string-to-integer) (&check-memory)
(string-to-integer 1) (&check-memory)
(string-to-integer 1.5) (&check-memory)
(string-to-integer "a") (&check-memory)
(string-to-integer "a" "a") (&check-memory)
(string-to-integer "a" "b") (&check-memory)
(string-to-integer "a" "b" "c") (&check-memory)
(string-to-float) (&check-memory)
(string-to-float 1) (&check-memory)
(string-to-float 1.5) (&check-memory)
(string-to-float "a") (&check-memory)
(string-to-float "a" "a") (&check-memory)
(string-to-float "a" "b") (&check-memory)
(string-to-float "a" "b" "c") (&check-memory)
(string=) (&check-memory)
(string= 1) (&check-memory)
(string= "a") (&check-memory)
(string= "a" "a") (&check-memory)
(string= "a" "b") (&check-memory)
(string= "a" "b" "c") (&check-memory)
(unless) (&check-memory)
(unless 1) (&check-memory)
(unless 0 1 2) (&check-memory)
(unless t 2 3 4) (&check-memory)
(unless nil 2 3 4) (&check-memory)
(unset) (&check-memory)
(unset "a") (&check-memory)
(unsetf) (&check-memory)
(unsetf a) (&check-memory)
(unsetf a b) (&check-memory)
(unsetq) (&check-memory)
(unsetq a) (&check-memory)
(unsetq a b) (&check-memory)
(when) (&check-memory)
(when 0) (&check-memory)
(when 0 1) (&check-memory)
(when t 1) (&check-memory)
(when nil 1) (&check-memory)
(while) (&check-memory)
(while nil) (&check-memory)
(while nil 1) (&check-memory)
(while nil 1 2 3 4) (&check-memory)
;
; more complex command sequences
;
(setq abcd "abcd")
(unsetq abcd)
(&check-memory)
(setq abcd (("abcd" . "efgh") ("1234" . "5678")))
(unsetq abcd)
(&check-memory)
(defun myfun () (princ "a\n"))
(exfun 'myfun)
(unsetq myfun)
(&check-memory)
(defun myfun () (princ "a\n"))
(funcall 'myfun)
(funcall 'myfun 'aaaaa)
(unsetq myfun)
(&check-memory)
(defun myfun (o) (princ o "a\n"))
(funcall 'myfun)
(funcall 'myfun 'aaaaa)
(unsetq myfun)
(&check-memory)
(defun myfun (o p) (princ o p "\n"))
(funcall 'myfun)
(funcall 'myfun 'aaaaa)
(funcall 'myfun 'aaaaa 'bbbbb)
(unsetq myfun)
(&check-memory)
(defun printnum (from to) (while (<= from to) (princ " " from) (setq from (+ from 1))))
(princ "Numbers 1-10:") (printnum 1 10) (princ "\n")
(unsetq printnum)
;
; game over
;
(princ "*********************\n")
(princ "OK, all tests passed!\n")
(princ "*********************\n")
(&stat-memory)

View file

@ -18,6 +18,8 @@
*
*/
#include "aserver.h"
#include <sys/shm.h>
#include <sys/socket.h>
#include <poll.h>
@ -33,7 +35,6 @@
#include <limits.h>
#include <signal.h>
#include "aserver.h"
char *command;
@ -737,7 +738,7 @@ static int snd_client_open(client_t *client)
ans.result = -EINVAL;
goto _answer;
}
name = alloca(req.namelen);
name = alloca(req.namelen + 1);
err = read(client->ctrl_fd, name, req.namelen);
if (err < 0) {
SYSERROR("read failed");
@ -774,6 +775,10 @@ static int snd_client_open(client_t *client)
name[req.namelen] = '\0';
client->transport_type = req.transport_type;
if (sizeof(client->name) < (size_t)(req.namelen + 1)) {
ans.result = -ENOMEM;
goto _answer;
}
strcpy(client->name, name);
client->stream = req.stream;
client->mode = req.mode;

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(alsa-lib, 1.2.7.2)
AC_INIT(alsa-lib, 1.2.14)
AC_CONFIG_SRCDIR([src/control/control.c])
AC_CONFIG_MACRO_DIR([m4])
@ -46,12 +46,16 @@ dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_CHECK_ATTRIBUTE_SYMVER
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS([uselocale])
AC_CHECK_FUNCS([eaccess])
dnl Enable largefile support
AC_SYS_LARGEFILE
SAVE_LIBRARY_VERSION
AC_SUBST(LIBTOOL_VERSION_INFO)
@ -67,6 +71,15 @@ EOF
exit 1
fi
dnl Do not use --with-pic for shared libraries (consider to use PIE)
if test "$enable_static" = "yes" -a "$pic_mode" = "yes"; then
cat <<EOF
Please, do not enable PIC (--with-pic) for static library. Consider
to remove this option or use PIE flags.
EOF
exit 1
fi
dnl ALSA configuration directory
AC_ARG_WITH(configdir,
AS_HELP_STRING([--with-configdir=dir],
@ -255,9 +268,8 @@ AC_ARG_WITH(libdl,
[ have_libdl="$withval" ], [ have_libdl="yes" ])
HAVE_LIBDL=
if test "$have_libdl" = "yes"; then
AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"])
AC_SEARCH_LIBS([dlsym], [dl], [HAVE_LIBDL="yes"])
if test "$HAVE_LIBDL" = "yes" ; then
ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl"
AC_DEFINE([HAVE_LIBDL], 1, [Have libdl])
fi
else
@ -335,7 +347,7 @@ else
fi
dnl Check for headers
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h])
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h malloc.h])
dnl Check for resmgr support...
AC_MSG_CHECKING(for resmgr support)
@ -407,10 +419,6 @@ AC_ARG_ENABLE(ucm,
AC_ARG_ENABLE(topology,
AS_HELP_STRING([--disable-topology], [disable the DSP topology component]),
[build_topology="$enableval"], [build_topology="yes"])
AC_ARG_ENABLE(alisp,
AS_HELP_STRING([--enable-alisp], [enable the alisp component]),
[build_alisp="$enableval"], [build_alisp="no"])
test "$softfloat" = "yes" && build_alisp="no"
AC_ARG_ENABLE(old-symbols,
AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]),
[keep_old_symbols="$enableval"], [keep_old_symbols="yes"])
@ -471,6 +479,12 @@ fi
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_INCLUDES)
if test "$build_rawmidi" != "yes"; then
if test "$build_seq" = "yes"; then
AC_ERROR([Cannot enable sequencer without rawmidi])
fi
fi
AM_CONDITIONAL([BUILD_MIXER], [test x$build_mixer = xyes])
AM_CONDITIONAL([BUILD_PCM], [test x$build_pcm = xyes])
AM_CONDITIONAL([BUILD_RAWMIDI], [test x$build_rawmidi = xyes])
@ -478,7 +492,6 @@ AM_CONDITIONAL([BUILD_HWDEP], [test x$build_hwdep = xyes])
AM_CONDITIONAL([BUILD_SEQ], [test x$build_seq = xyes])
AM_CONDITIONAL([BUILD_UCM], [test x$build_ucm = xyes])
AM_CONDITIONAL([BUILD_TOPOLOGY], [test x$build_topology = xyes])
AM_CONDITIONAL([BUILD_ALISP], [test x$build_alisp = xyes])
AM_CONDITIONAL([BUILD_MIXER_MODULES], [test x$build_mixer_modules = xyes])
AM_CONDITIONAL([BUILD_MIXER_PYMODULES], [test x$build_mixer_pymodules = xyes])
@ -616,6 +629,7 @@ AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSNOOP], [test x$build_pcm_dsnoop = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_ASYM], [test x$build_pcm_asym = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_IEC958], [test x$build_pcm_iec958 = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_SOFTVOL], [test x$build_pcm_softvol = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTERNAL], [test x$build_pcm_extplug = xyes -o x$build_pcm_ioplug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTPLUG], [test x$build_pcm_extplug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_IOPLUG], [test x$build_pcm_ioplug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_MMAP_EMUL], [test x$build_pcm_mmap_emul = xyes])
@ -639,6 +653,9 @@ fi
if test "$build_pcm_alaw" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin])
fi
if test "$build_pcm_iec958" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_IEC958], "1", [Build PCM iec958 plugin])
fi
if test "$build_pcm_mmap_emul" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_MMAP_EMUL], "1", [Build PCM mmap-emul plugin])
fi
@ -744,28 +761,31 @@ if test ! -L "$srcdir"/include/alsa ; then
ln -sf . "$srcdir"/include/alsa
fi
AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
src/Versions src/Makefile \
src/control/Makefile src/mixer/Makefile \
src/pcm/Makefile src/pcm/scopes/Makefile \
src/rawmidi/Makefile src/timer/Makefile \
src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
src/alisp/Makefile src/topology/Makefile \
src/conf/Makefile \
src/conf/cards/Makefile \
src/conf/ctl/Makefile \
src/conf/pcm/Makefile \
modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
alsalisp/Makefile aserver/Makefile \
test/Makefile test/lsb/Makefile \
utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
AC_CONFIG_FILES(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
src/Versions.in src/Makefile \
src/control/Makefile src/mixer/Makefile \
src/pcm/Makefile src/pcm/scopes/Makefile \
src/rawmidi/Makefile src/timer/Makefile \
src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
src/topology/Makefile \
src/conf/Makefile \
src/conf/cards/Makefile \
src/conf/ctl/Makefile \
src/conf/pcm/Makefile \
modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
aserver/Makefile \
test/Makefile test/lsb/Makefile \
utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
AC_OUTPUT()
dnl Create asoundlib.h dynamically according to configure options
echo "Creating asoundlib.h..."
cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h
if test "$ac_cv_header_sys_endian_h" != "yes"; then
test "$ac_cv_header_endian_h" = "yes" && echo "#include <endian.h>" >> include/asoundlib.h
if test "$ac_cv_header_sys_endian_h" = "yes"; then
else
cat >> include/asoundlib.h <<EOF
#include <sys/endian.h>
#ifndef __BYTE_ORDER
@ -781,9 +801,11 @@ EOF
fi
cat >> include/asoundlib.h <<EOF
#ifndef DOC_HIDDEN
#ifndef __GNUC__
#define __inline__ inline
#endif
#endif /* DOC_HIDDEN */
#include <alsa/asoundef.h>
#include <alsa/version.h>
@ -795,10 +817,12 @@ cat >> include/asoundlib.h <<EOF
EOF
test "$build_pcm" = "yes" && echo "#include <alsa/pcm.h>" >> include/asoundlib.h
test "$build_rawmidi" = "yes" && echo "#include <alsa/rawmidi.h>" >> include/asoundlib.h
test "$build_rawmidi" = "yes" && echo "#include <alsa/ump.h>" >> include/asoundlib.h
test "$build_pcm" = "yes" && echo "#include <alsa/timer.h>" >> include/asoundlib.h
test "$build_hwdep" = "yes" && echo "#include <alsa/hwdep.h>" >> include/asoundlib.h
echo "#include <alsa/control.h>" >> include/asoundlib.h
test "$build_mixer" = "yes" && echo "#include <alsa/mixer.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/ump_msg.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seq_event.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seq.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seqmid.h>" >> include/asoundlib.h

View file

@ -9,14 +9,16 @@ doc:
doxygen doxygen.cfg
doc-pack: doc
-chmod a+r $(top_srcdir)/doc/doxygen/html/*
-chmod a-w $(top_srcdir)/doc/doxygen/html/*
-chmod -R a+r $(top_srcdir)/doc/doxygen/html/*
-chmod -R a-w $(top_srcdir)/doc/doxygen/html/*
if ! test -z "$(AMTAR)"; then \
$(AMTAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
else \
$(TAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
fi
-chmod -R u+w $(top_srcdir)/doc/doxygen/html/*
rm -rf $(top_srcdir)/doc/doxygen/html/*
doc-clean:
-chmod -R u+w $(top_srcdir)/doc/doxygen/html/*
rm -rf $(top_srcdir)/doc/doxygen/html/*

View file

@ -17,6 +17,8 @@ INPUT = @top_srcdir@/doc/index.doxygen \
@top_srcdir@/include/control.h \
@top_srcdir@/include/pcm.h \
@top_srcdir@/include/rawmidi.h \
@top_srcdir@/include/ump.h \
@top_srcdir@/include/ump_msg.h \
@top_srcdir@/include/timer.h \
@top_srcdir@/include/hwdep.h \
@top_srcdir@/include/seq.h \
@ -36,18 +38,21 @@ INPUT = @top_srcdir@/doc/index.doxygen \
@top_srcdir@/src/input.c \
@top_srcdir@/src/output.c \
@top_srcdir@/src/conf.c \
@top_srcdir@/src/confeval.c \
@top_srcdir@/src/confmisc.c \
@top_srcdir@/src/names.c \
@top_srcdir@/src/shmarea.c \
@top_srcdir@/src/userfile.c \
@top_srcdir@/src/control/cards.c \
@top_srcdir@/src/control/control.c \
@top_srcdir@/src/control/control_ext.c \
@top_srcdir@/src/control/control_plugin.c \
@top_srcdir@/src/control/control_hw.c \
@top_srcdir@/src/control/control_remap.c \
@top_srcdir@/src/control/control_shm.c \
@top_srcdir@/src/control/ctlparse.c \
@top_srcdir@/src/control/hcontrol.c \
@top_srcdir@/src/control/namehint.c \
@top_srcdir@/src/control/setup.c \
@top_srcdir@/src/control/tlv.c \
@top_srcdir@/src/mixer \
@ -109,8 +114,9 @@ EXCLUDE = @top_srcdir@/src/control/control_local.h \
@top_srcdir@/src/topology/tplg_local.h
RECURSIVE = YES
FILE_PATTERNS = *.c *.h
INCLUDE_PATH = @top_builddir@/include
EXAMPLE_PATH = @top_srcdir@/test
IMAGE_PATH = pictures
IMAGE_PATH = @top_srcdir@/doc/pictures
QUIET = YES
EXTRACT_ALL = NO
@ -126,7 +132,8 @@ PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" \
ALSA_PCM_NEW_HW_PARAMS_API \
_POSIX_C_SOURCE \
"use_default_symbol_version(x,y,z)=" \
"link_warning(x,y)="
"link_warning(x,y)=" \
__attribute__((x))=
OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option
TYPEDEF_HIDES_STRUCT = YES # needed in doxygen >= 1.5.4

View file

@ -1 +1,9 @@
EXTRA_DIST=wave1.gif wave2.gif
GIT_FILES=$(wildcard *.gif)
PUML_FILES=$(wildcard *.puml)
SVG_FILES=$(PUML_FILES:.puml=.svg)
EXTRA_DIST=$(GIT_FILES) $(PUML_FILES) $(SVG_FILES)
all: $(SVG_FILES)
.puml.svg:
plantuml -tsvg $<

View file

@ -0,0 +1,17 @@
@startuml
title "UCM sequence boot order (using udev and alsactl)"
start
:Sound card detected (udev);
:UCM: FixedBootSequence;
if (Card state (/var/lib/alsa/asound.state)) then (not present)
:UCM: BootSequence;
else (present)
:alsactl: Restore state (from asound.state);
endif
:Standard sound card use (with or without UCM);
:Save sound card state (asound.state);
:Sound card detached;
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

@ -0,0 +1,26 @@
@startuml
title "UCM device sequence graph"
start
split
:Enable device;
:EnableSequence;
:Use device;
:Disable device;
:DisableSequence;
split again
:Switch device;
:Disable old device;
if (TransitionSequence) then (present)
:TransitionSequence;
:Enable new device;
else (not present)
:Disable old device;
:DisableSequence;
:Enable new device;
:EnableSequence;
endif
end split
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,30 @@
@startuml
title "UCM verb sequence graph"
start
split
:Enable verb;
:SectionDefaults sequence;
:EnableSequence;
:Enable, use and disable verb devices;
:Disable verb;
:DisableSequence;
split again
:Switch verb;
:Disable old verb;
if (TransitionSequence) then (present)
:TransitionSequence;
:Enable new verb;
else (not present)
:Disable old verb;
:DisableSequence;
:Enable new verb;
:EnableSequence;
endif
end split
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,19 @@
@startuml
title "UCM volume"
start
if (Card state (/var/lib/alsa/asound.state)) then (not present)
:UCM: BootSequence;
else (present)
:alsactl: Restore state (from asound.state);
endif
:UCM application:set device volume;
note right
The application uses (Playback|Capture)MixerElem or
(Playback/Capture)(Volume/Switch) values to get
the controls.
end note
:alsactl: Store state (to asound.state);
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -5,7 +5,6 @@ set -e
bits32=
cbits32=
modules=
alisp=
lto=
if [ $# -ne 0 ]; then
endloop=
@ -20,10 +19,6 @@ if [ $# -ne 0 ]; then
modules=yes
echo "Forced mixer modules build..."
shift ;;
alisp)
alisp=yes
echo "Forced alisp code build..."
shift ;;
python2)
python2=yes
echo "Forced python2 interpreter build..."
@ -32,6 +27,10 @@ if [ $# -ne 0 ]; then
lto="-flto -flto-partition=none"
echo "Forced lto build..."
shift ;;
static)
static=yes
echo "Selected static build..."
shift ;;
*)
endloop=yes
;;
@ -67,14 +66,16 @@ if [ "$modules" = "yes" ]; then
args="$args --enable-mixer-pymods"
fi
if [ "$alisp" = "yes" ]; then
args="$args --enable-alisp"
fi
if [ "$python2" = "yes" ]; then
args="$args --enable-python2"
fi
if [ "$static" = "yes" ]; then
#args="$args --enable-shared=no --enable-static=yes"
args="$args --disable-shared"
fi
touch ltconfig
libtoolize --force --copy --automake
aclocal $ACLOCAL_FLAGS

View file

@ -22,19 +22,20 @@ endif
if BUILD_PCM_PLUGIN_RATE
alsainclude_HEADERS += pcm_rate.h
endif
if BUILD_PCM_PLUGIN_EXTPLUG
alsainclude_HEADERS += pcm_external.h pcm_extplug.h
endif
if BUILD_PCM_PLUGIN_IOPLUG
if !BUILD_PCM_PLUGIN_EXTPLUG
alsainclude_HEADERS += pcm_external.h
endif
alsainclude_HEADERS += pcm_ioplug.h
if BUILD_PCM_PLUGIN_EXTERNAL
# FIXME: pcm_external.h includes both pcm_extplug.h and pcm_ioplug.h
alsainclude_HEADERS += pcm_external.h pcm_extplug.h pcm_ioplug.h
endif
#if BUILD_PCM_PLUGIN_EXTPLUG
#alsainclude_HEADERS += pcm_extplug.h
#endif
#if BUILD_PCM_PLUGIN_IOPLUG
#alsainclude_HEADERS += pcm_ioplug.h
#endif
endif
if BUILD_RAWMIDI
alsainclude_HEADERS += rawmidi.h
alsainclude_HEADERS += rawmidi.h ump.h ump_msg.h
endif
if BUILD_HWDEP
@ -57,10 +58,6 @@ if BUILD_TOPOLOGY
alsainclude_HEADERS += topology.h
endif
if BUILD_ALISP
alsainclude_HEADERS += alisp.h
endif
noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \
asoundlib-head.h asoundlib-tail.h bswap.h type_compat.h

View file

@ -1,55 +0,0 @@
/*
* ALSA lisp implementation
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
struct alisp_cfg {
int verbose: 1,
warning: 1,
debug: 1;
snd_input_t *in; /* program code */
snd_output_t *out; /* program output */
snd_output_t *eout; /* error output */
snd_output_t *vout; /* verbose output */
snd_output_t *wout; /* warning output */
snd_output_t *dout; /* debug output */
};
struct alisp_instance;
struct alisp_object;
struct alisp_seq_iterator;
struct alisp_cfg *alsa_lisp_default_cfg(snd_input_t *input);
void alsa_lisp_default_cfg_free(struct alisp_cfg *cfg);
int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **instance);
void alsa_lisp_free(struct alisp_instance *instance);
int alsa_lisp_function(struct alisp_instance *instance, struct alisp_seq_iterator **result,
const char *id, const char *args, ...)
#ifndef DOC_HIDDEN
__attribute__ ((format (printf, 4, 5)))
#endif
;
void alsa_lisp_result_free(struct alisp_instance *instance,
struct alisp_seq_iterator *result);
int alsa_lisp_seq_first(struct alisp_instance *instance, const char *id,
struct alisp_seq_iterator **seq);
int alsa_lisp_seq_next(struct alisp_seq_iterator **seq);
int alsa_lisp_seq_count(struct alisp_seq_iterator *seq);
int alsa_lisp_seq_integer(struct alisp_seq_iterator *seq, long *val);
int alsa_lisp_seq_pointer(struct alisp_seq_iterator *seq, const char *ptr_id, void **ptr);

View file

@ -29,10 +29,17 @@
#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
#if HAVE_ATTRIBUTE_SYMVER && __GNUC__ > 10
#define symbol_version(real, name, version) \
extern __typeof (real) real __attribute__((symver (#name "@" #version)))
#define default_symbol_version(real, name, version) \
extern __typeof (real) real __attribute__((symver (#name "@@" #version)))
#else
#define symbol_version(real, name, version) \
__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version)
#define default_symbol_version(real, name, version) \
__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version)
#endif
#ifdef __clang__
#define EXPORT_SYMBOL __attribute__((visibility("default")))

View file

@ -18,9 +18,9 @@
*
*/
#include <netdb.h>
#include "../src/pcm/pcm_local.h"
#include "../src/control/control_local.h"
#include <netdb.h>
int snd_receive_fd(int sock, void *data, size_t len, int *fd);

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/asoundef.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_ASOUNDEF_H
#define __ALSA_ASOUNDEF_H
@ -215,6 +221,8 @@ extern "C" {
#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED (1<<7) /**< stereo downmis prohibited */
#define CEA861_AUDIO_INFOFRAME_DB5_LSV (0xf<<3) /**< mask - level-shift values */
/** \} */
/**
* \defgroup MIDI_Interface Constants for MIDI v1.0
* Constants for MIDI v1.0.
@ -224,6 +232,8 @@ extern "C" {
#define MIDI_CHANNELS 16 /**< Number of channels per port/cable. */
#define MIDI_GM_DRUM_CHANNEL (10-1) /**< Channel number for GM drums. */
/** \} */
/**
* \defgroup MIDI_Commands MIDI Commands
* MIDI command codes.
@ -335,8 +345,6 @@ extern "C" {
/** \} */
/** \} */
#ifdef __cplusplus
}
#endif

View file

@ -38,3 +38,5 @@
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <time.h>

View file

@ -27,6 +27,11 @@
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 swap16
#define bswap_32 swap32
#define bswap_64 swap64
#elif defined (__sun)
#include <sys/byteorder.h>
#define bswap_16 BSWAP_16

View file

@ -25,6 +25,11 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_CONF_H
#define __ALSA_CONF_H
@ -33,7 +38,7 @@ extern "C" {
#endif
/**
* \defgroup Config Configuration Interface
* \defgroup Configuration Configuration Interface
* The configuration functions and types allow you to read, enumerate,
* modify and write the contents of ALSA configuration files.
* \{
@ -109,6 +114,16 @@ int snd_config_search_definition(snd_config_t *config,
const char *base, const char *key,
snd_config_t **result);
/**
* \brief custom expansion callback
* \param[out] dst The function puts the handle to the new configuration
* node at the address specified by \a dst.
* \param[in] s string the string to be expanded
* \param[in] private_data Handle to the \c private_data node.
* \return A non-negative value if successful, otherwise a negative error code.
*
* Use a function of this type to define a custom expansion
*/
typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data);
int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/control.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_CONTROL_H
#define __ALSA_CONTROL_H
@ -356,6 +362,9 @@ typedef enum _snd_ctl_type {
/** Read only (flag for open mode) \hideinitializer */
#define SND_CTL_READONLY 0x0004
/** Return EINTR instead blocking (flag for open mode) \hideinitializer */
#define SND_CTL_EINTR 0x0080
/** CTL handle */
typedef struct _snd_ctl snd_ctl_t;
@ -371,10 +380,6 @@ int snd_card_get_index(const char *name);
int snd_card_get_name(int card, char **name);
int snd_card_get_longname(int card, char **name);
int snd_device_name_hint(int card, const char *iface, void ***hints);
int snd_device_name_free_hint(void **hints);
char *snd_device_name_get_hint(const void *hint, const char *id);
int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf);
int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, const char *orig_name, int mode);
@ -415,6 +420,11 @@ int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
#endif
#ifdef __ALSA_UMP_H
int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device);
int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info);
int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info);
#endif
int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state);
int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state);
@ -791,6 +801,20 @@ int snd_sctl_remove(snd_sctl_t *handle);
/** \} */
/**
* \defgroup Hint Name Hint Interface
* \ingroup Configuration
* The name hint interface - get descriptive information about a device
* (name, description, input/output).
* \{
*/
int snd_device_name_hint(int card, const char *iface, void ***hints);
int snd_device_name_free_hint(void **hints);
char *snd_device_name_get_hint(const void *hint, const char *id);
/** \} */
#ifdef __cplusplus
}
#endif

View file

@ -23,10 +23,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_CONTROL_EXTERNAL_H
#define __ALSA_CONTROL_EXTERNAL_H
#include "control.h"
#ifndef __ASOUNDLIB_LOCAL
#include <alsa/asoundlib.h>
#endif
#ifdef __cplusplus
extern "C" {

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/error.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_ERROR_H
#define __ALSA_ERROR_H
@ -40,7 +46,6 @@ extern "C" {
#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */
#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */
#define SND_ERROR_ALISP_NIL (SND_ERROR_BEGIN+1) /**< Lisp encountered an error during acall. */
const char *snd_strerror(int errnum);

View file

@ -25,12 +25,15 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/global.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_GLOBAL_H_
#define __ALSA_GLOBAL_H_
/* for timeval and timespec */
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -51,6 +54,11 @@ const char *snd_asoundlib_version(void);
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
#ifndef __STRING
/** \brief Return 'x' argument as string */
#define __STRING(x) #x
#endif
#ifdef PIC /* dynamic build */
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
@ -82,18 +90,13 @@ extern struct snd_dlsym_link *snd_dlsym_start;
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = __STRING(name); \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
}
#endif
#ifndef __STRING
/** \brief Return 'x' argument as string */
#define __STRING(x) #x
#endif
/** \brief Returns the version of a dynamic symbol as a string. */
#define SND_DLSYM_VERSION(version) __STRING(version)

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/hwdep.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_HWDEP_H
#define __ALSA_HWDEP_H

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/input.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_INPUT_H
#define __ALSA_INPUT_H

View file

@ -30,10 +30,16 @@
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <stdint.h>
/* for timeval and timespec */
#include <time.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
#include <sys/endian.h>
#else
#error Header defining endianness not defined
#endif
#ifndef __BYTE_ORDER
#define __BYTE_ORDER BYTE_ORDER
#endif
@ -43,9 +49,6 @@
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
#else
#error Header defining endianness not defined
#endif
#include <stdarg.h>
#include <poll.h>
#include <sys/types.h>
@ -69,9 +72,11 @@
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define SND_LITTLE_ENDIAN
#define SNDRV_LITTLE_ENDIAN
#define SNDRV_LITTLE_ENDIAN_BITFIELD
#elif __BYTE_ORDER == __BIG_ENDIAN
#define SND_BIG_ENDIAN
#define SNDRV_BIG_ENDIAN
#define SNDRV_BIG_ENDIAN_BITFIELD
#else
#error "Unsupported endian..."
#endif
@ -85,6 +90,8 @@
#define versionsort64 versionsort
#define alphasort64 alphasort
#define ino64_t ino_t
#define fstat64 fstat
#define stat64 stat
#endif
#define _snd_config_iterator list_head
@ -178,10 +185,12 @@
#include "pcm.h"
#include "pcm_plugin.h"
#include "rawmidi.h"
#include "ump.h"
#include "timer.h"
#include "hwdep.h"
#include "control.h"
#include "mixer.h"
#include "ump_msg.h"
#include "seq_event.h"
#include "seq.h"
@ -191,7 +200,9 @@
#define snd_seq_real_time sndrv_seq_real_time
#define snd_seq_timestamp sndrv_seq_timestamp
#define snd_seq_event_type_t sndrv_seq_event_type_t
#define snd_seq_event_data sndrv_seq_event_data
#define snd_seq_event sndrv_seq_event
#define snd_seq_ump_event sndrv_seq_ump_event
#define snd_seq_connect sndrv_seq_connect
#define snd_seq_ev_note sndrv_seq_ev_note
#define snd_seq_ev_ctrl sndrv_seq_ev_ctrl
@ -201,6 +212,7 @@
#define snd_seq_result sndrv_seq_result
#define snd_seq_queue_skew sndrv_seq_queue_skew
#define snd_seq_ev_queue_control sndrv_seq_ev_queue_control
#define snd_seq_ev_ump_notify sndrv_seq_ev_ump_notify
#define snd_seq_client_t sndrv_seq_client_t
#define snd_seq_client_type_t sndrv_seq_client_type_t
@ -255,6 +267,7 @@ int _snd_safe_strtod(const char *str, double *val);
int snd_send_fd(int sock, void *data, size_t len, int fd);
int snd_receive_fd(int sock, void *data, size_t len, int *fd);
size_t snd_strlcpy(char *dst, const char *src, size_t size);
size_t snd_strlcat(char *dst, const char *src, size_t size);
/*
* error messages

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/mixer.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_MIXER_H
#define __ALSA_MIXER_H
@ -47,7 +53,7 @@ typedef struct _snd_mixer_elem snd_mixer_elem_t;
/**
* \brief Mixer callback function
* \param mixer Mixer handle
* \param ctl Mixer handle
* \param mask event mask
* \param elem related mixer element (if any)
* \return 0 on success otherwise a negative error code

View file

@ -97,10 +97,10 @@ struct sm_elem_ops {
int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
int snd_mixer_sbasic_info(const snd_mixer_class_t *class, sm_class_basic_t *info);
void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class);
void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data);
void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class));
int snd_mixer_sbasic_info(const snd_mixer_class_t *mixer_class, sm_class_basic_t *info);
void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *mixer_class);
void snd_mixer_sbasic_set_private(const snd_mixer_class_t *mixer_class, void *private_data);
void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *mixer_class, void (*private_free)(snd_mixer_class_t *mixer_class));
/** \} */

View file

@ -25,11 +25,15 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/input.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_OUTPUT_H
#define __ALSA_OUTPUT_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -26,6 +26,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/pcm.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_PCM_H
#define __ALSA_PCM_H
@ -33,8 +39,6 @@
extern "C" {
#endif
#include <stdint.h>
/**
* \defgroup PCM PCM Interface
* See the \ref pcm page for more details.
@ -282,9 +286,17 @@ typedef enum _snd_pcm_format {
/** PCM sample subformat */
typedef enum _snd_pcm_subformat {
/** Unknown */
SND_PCM_SUBFORMAT_UNKNOWN = -1,
/** Standard */
SND_PCM_SUBFORMAT_STD = 0,
SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
/** Maximum bits based on PCM format */
SND_PCM_SUBFORMAT_MSBITS_MAX = 1,
/** 20 most significant bits */
SND_PCM_SUBFORMAT_MSBITS_20 = 2,
/** 24 most significant bits */
SND_PCM_SUBFORMAT_MSBITS_24 = 3,
SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_MSBITS_24
} snd_pcm_subformat_t;
/** PCM state */
@ -343,6 +355,7 @@ typedef enum _snd_pcm_tstamp {
SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
} snd_pcm_tstamp_t;
/** PCM timestamp type */
typedef enum _snd_pcm_tstamp_type {
SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /**< gettimeofday equivalent */
SND_PCM_TSTAMP_TYPE_MONOTONIC, /**< posix_clock_monotonic equivalent */
@ -350,6 +363,7 @@ typedef enum _snd_pcm_tstamp_type {
SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
} snd_pcm_tstamp_type_t;
/** PCM audio timestamp type */
typedef enum _snd_pcm_audio_tstamp_type {
/**
* first definition for backwards compatibility only,
@ -364,24 +378,22 @@ typedef enum _snd_pcm_audio_tstamp_type {
SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
} snd_pcm_audio_tstamp_type_t;
/** PCM audio timestamp config */
typedef struct _snd_pcm_audio_tstamp_config {
/* 5 of max 16 bits used */
unsigned int type_requested:4;
unsigned int report_delay:1; /* add total delay to A/D or D/A */
unsigned int type_requested:4; /**< requested audio tstamp type */
unsigned int report_delay:1; /**< add total delay to A/D or D/A */
} snd_pcm_audio_tstamp_config_t;
/** PCM audio timestamp report */
typedef struct _snd_pcm_audio_tstamp_report {
/* 6 of max 16 bits used for bit-fields */
/* for backwards compatibility */
unsigned int valid:1;
unsigned int valid:1; /**< for backwards compatibility */
unsigned int actual_type:4; /**< actual type if hardware could not support requested timestamp */
/* actual type if hardware could not support requested timestamp */
unsigned int actual_type:4;
/* accuracy represented in ns units */
unsigned int accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
unsigned int accuracy; /* up to 4.29s, will be packed in separate field */
unsigned int accuracy_report:1; /**< 0 if accuracy unknown, 1 if accuracy field is valid */
unsigned int accuracy; /**< up to 4.29s in ns units, will be packed in separate field */
} snd_pcm_audio_tstamp_report_t;
/** Unsigned frames quantity */
@ -393,6 +405,8 @@ typedef long snd_pcm_sframes_t;
#define SND_PCM_NONBLOCK 0x00000001
/** Async notification (flag for open mode) \hideinitializer */
#define SND_PCM_ASYNC 0x00000002
/** Return EINTR instead blocking (wait operation) */
#define SND_PCM_EINTR 0x00000080
/** In an abort state (internal, not allowed for open) */
#define SND_PCM_ABORT 0x00008000
/** Disable automatic (but not forced!) rate resamplinig */
@ -498,6 +512,16 @@ typedef union _snd_pcm_sync_id {
unsigned int id32[4];
} snd_pcm_sync_id_t;
/** synchronization ID size (see snd_pcm_hw_params_get_sync) */
#define SND_PCM_HW_PARAMS_SYNC_SIZE 16
/** Infinite wait for snd_pcm_wait() */
#define SND_PCM_WAIT_INFINITE (-1)
/** Wait for next i/o in snd_pcm_wait() */
#define SND_PCM_WAIT_IO (-10001)
/** Wait for drain in snd_pcm_wait() */
#define SND_PCM_WAIT_DRAIN (-10002)
/** #SND_PCM_TYPE_METER scope handle */
typedef struct _snd_pcm_scope snd_pcm_scope_t;
@ -722,6 +746,7 @@ int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_is_perfect_drain(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); /* deprecated, use audio_ts_type */
int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type);
int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
@ -729,6 +754,7 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
unsigned int *rate_den);
int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);
const unsigned char * snd_pcm_hw_params_get_sync(const snd_pcm_hw_params_t *params);
#if 0
typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;
@ -821,6 +847,8 @@ int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_drain_silence(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_get_drain_silence(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
@ -1080,6 +1108,7 @@ const char *snd_pcm_format_name(const snd_pcm_format_t format);
const char *snd_pcm_format_description(const snd_pcm_format_t format);
const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);
const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);
snd_pcm_subformat_t snd_pcm_subformat_value(const char* name);
snd_pcm_format_t snd_pcm_format_value(const char* name);
const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);
const char *snd_pcm_state_name(const snd_pcm_state_t state);

View file

@ -26,7 +26,9 @@
#ifndef __ALSA_PCM_EXTERNAL_H
#define __ALSA_PCM_EXTERNAL_H
#include "pcm.h"
#ifndef __ASOUNDLIB_LOCAL
#include <alsa/asoundlib.h>
#endif
#ifdef __cplusplus
extern "C" {

View file

@ -28,6 +28,11 @@
*
*/
#if !defined(__ALSA_PCM_EXTERNAL_H) && !defined(ALSA_LIBRARY_BUILD)
#warning "use #include <alsa/pcm_external.h>, <alsa/pcm_extplug.h> should not be used directly"
#include <alsa/pcm_external.h>
#endif
#ifndef __ALSA_PCM_EXTPLUG_H
#define __ALSA_PCM_EXTPLUG_H

View file

@ -28,6 +28,11 @@
*
*/
#if !defined(__ALSA_PCM_EXTERNAL_H) && !defined(ALSA_LIBRARY_BUILD)
#warning "use #include <alsa/pcm_external.h>, <alsa/pcm_ioplug.h> should not be used directly"
#include <alsa/pcm_external.h>
#endif
#ifndef __ALSA_PCM_IOPLUG_H
#define __ALSA_PCM_IOPLUG_H

View file

@ -1,12 +1,20 @@
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#error "use #include <alsa/asoundlib.h>, <alsa/pcm_old.h> should not be used directly"
#endif
/*
* Old ALSA 0.9.x API
*/
#define ___symbol_version(name, version) \
__asm__ (".symver " #name "," #name "@" version)
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_access, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_access_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_access_last, "ALSA_0.9");
int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
@ -16,9 +24,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_format, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_format_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_format_last, "ALSA_0.9");
int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
@ -28,9 +36,9 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_subformat, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_subformat_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_subformat_last, "ALSA_0.9");
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
@ -40,12 +48,12 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_channels, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_channels_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_channels_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_channels_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_channels_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_channels_last, "ALSA_0.9");
int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
@ -59,12 +67,12 @@ unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_para
unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_rate, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_rate_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_rate_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_rate_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_rate_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_rate_last, "ALSA_0.9");
int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
@ -80,12 +88,12 @@ unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t
int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_time, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_time_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_time_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_time_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_time_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_time_last, "ALSA_0.9");
int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
@ -99,12 +107,12 @@ unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_p
unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_size, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_size_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_size_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_size_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_size_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_size_last, "ALSA_0.9");
snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
@ -119,12 +127,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pc
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_periods, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_periods_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_periods_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_periods_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_periods_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_periods_last, "ALSA_0.9");
int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
@ -139,12 +147,12 @@ unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_para
unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_time, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_time_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_time_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_time_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_time_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_time_last, "ALSA_0.9");
int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
@ -158,12 +166,12 @@ unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_p
unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_size, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_size_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_size_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_size_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_size_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_size_last, "ALSA_0.9");
snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
@ -177,12 +185,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_tick_time, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_tick_time_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_tick_time_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_tick_time_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_tick_time_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_tick_time_last, "ALSA_0.9");
int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
@ -201,14 +209,14 @@ unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_par
#ifdef ALSA_PCM_OLD_SW_PARAMS_API
asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_get_stop_threshold@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_tstamp_mode, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_sleep_min, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_avail_min, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_xfer_align, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_start_threshold, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_stop_threshold, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_silence_threshold, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_silence_size, "ALSA_0.9");
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);

View file

@ -133,6 +133,19 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* IEC958 subframe conversion plugin
*/
int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave,
const unsigned char *status_bits,
const unsigned char *preamble_vals,
int hdmi_mode);
int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Route plugin for linear formats
*/

View file

@ -31,6 +31,10 @@
#ifndef __ALSA_PCM_RATE_H
#define __ALSA_PCM_RATE_H
#ifndef __ASOUNDLIB_LOCAL
#include <alsa/asoundlib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/rawmidi.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_RAWMIDI_H
#define __ALSA_RAWMIDI_H
@ -93,6 +99,10 @@ typedef enum _snd_rawmidi_read_mode {
SND_RAWMIDI_READ_TSTAMP = 1,
} snd_rawmidi_read_mode_t;
/** rawmidi info bit flags */
#define SND_RAWMIDI_INFO_UMP 0x00000008 /**< rawmidi is UMP */
#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010 /**< the selected substream is inactive */
int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
const char *name, int mode);
int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
@ -121,6 +131,7 @@ const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
int snd_rawmidi_info_get_tied_device(const snd_rawmidi_info_t *obj);
void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);

View file

@ -26,6 +26,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seq.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQ_H
#define __ALSA_SEQ_H
@ -130,6 +136,13 @@ typedef enum snd_seq_client_type {
SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
} snd_seq_client_type_t;
/** client MIDI version */
enum {
SND_SEQ_CLIENT_LEGACY_MIDI = 0, /**< Legacy client */
SND_SEQ_CLIENT_UMP_MIDI_1_0 = 1, /**< UMP MIDI 1.0 */
SND_SEQ_CLIENT_UMP_MIDI_2_0 = 2 /**< UMP MIDI 2.0 */
};
size_t snd_seq_client_info_sizeof(void);
/** allocate a #snd_seq_client_info_t container on stack */
#define snd_seq_client_info_alloca(ptr) \
@ -149,11 +162,22 @@ const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_i
int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_midi_version(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_ump_group_enabled(const snd_seq_client_info_t *info,
int group);
int snd_seq_client_info_get_ump_groupless_enabled(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_ump_conversion(const snd_seq_client_info_t *info);
void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
void snd_seq_client_info_set_midi_version(snd_seq_client_info_t *info, int midi_version);
void snd_seq_client_info_set_ump_group_enabled(snd_seq_client_info_t *info,
int group, int enable);
void snd_seq_client_info_set_ump_groupless_enabled(snd_seq_client_info_t *info,
int enable);
void snd_seq_client_info_set_ump_conversion(snd_seq_client_info_t *info, int enable);
void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
@ -165,6 +189,11 @@ int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_in
int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
int snd_seq_get_ump_endpoint_info(snd_seq_t *seq, int client, void *info);
int snd_seq_get_ump_block_info(snd_seq_t *seq, int client, int blk, void *info);
int snd_seq_set_ump_endpoint_info(snd_seq_t *seq, const void *info);
int snd_seq_set_ump_block_info(snd_seq_t *seq, int blk, const void *info);
/*
*/
@ -222,6 +251,14 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */
#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */
#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */
#define SND_SEQ_PORT_CAP_INACTIVE (1<<8) /**< inactive port */
#define SND_SEQ_PORT_CAP_UMP_ENDPOINT (1<<9) /**< UMP Endpoint port */
/** port direction */
#define SND_SEQ_PORT_DIR_UNKNOWN 0 /**< Unknown */
#define SND_SEQ_PORT_DIR_INPUT 1 /**< Input only; sink, receiver */
#define SND_SEQ_PORT_DIR_OUTPUT 2 /**< Output only; source, transmitter */
#define SND_SEQ_PORT_DIR_BIDIRECTION 3 /**< Input/output bidirectional */
/* port type */
/** Messages sent from/to this port have device-specific semantics. */
@ -238,6 +275,8 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)
/** This port is compatible with the General MIDI 2 specification. */
#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)
/** This port is a UMP port. */
#define SND_SEQ_PORT_TYPE_MIDI_UMP (1<<7)
/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages
(these are not MIDI messages). */
#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)
@ -283,6 +322,9 @@ int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_direction(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_ump_group(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_ump_is_midi1(const snd_seq_port_info_t *info);
void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
@ -297,6 +339,9 @@ void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
void snd_seq_port_info_set_direction(snd_seq_port_info_t *info, int direction);
void snd_seq_port_info_set_ump_group(snd_seq_port_info_t *info, int ump_group);
void snd_seq_port_info_set_ump_is_midi1(snd_seq_port_info_t *info, int is_midi1);
int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
int snd_seq_delete_port(snd_seq_t *handle, int port);
@ -469,13 +514,16 @@ unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_tempo_base(const snd_seq_queue_tempo_t *info);
void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);
void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);
void snd_seq_queue_tempo_set_tempo_base(snd_seq_queue_tempo_t *info, unsigned int tempo_base);
int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
int snd_seq_has_queue_tempo_base(snd_seq_t *handle);
/*
*/
@ -572,6 +620,12 @@ void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
int snd_seq_ump_event_output(snd_seq_t *seq, snd_seq_ump_event_t *ev);
int snd_seq_ump_event_output_buffer(snd_seq_t *seq, snd_seq_ump_event_t *ev);
int snd_seq_ump_extract_output(snd_seq_t *seq, snd_seq_ump_event_t **ev_res);
int snd_seq_ump_event_output_direct(snd_seq_t *seq, snd_seq_ump_event_t *ev);
int snd_seq_ump_event_input(snd_seq_t *seq, snd_seq_ump_event_t **ev);
/** \} */
/**
@ -729,6 +783,10 @@ extern const unsigned int snd_seq_event_types[];
#define snd_seq_ev_is_direct(ev) \
((ev)->queue == SND_SEQ_QUEUE_DIRECT)
/** UMP events */
#define snd_seq_ev_is_ump(ev) \
((ev)->flags & SND_SEQ_EVENT_UMP)
/** \} */
#ifdef __cplusplus

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seq_event.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQ_EVENT_H
#define __ALSA_SEQ_EVENT_H
@ -133,6 +139,11 @@ enum snd_seq_event_type {
/** Ports disconnected; event data type = #snd_seq_connect_t */
SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
/** UMP Endpoint info has changed; event data type = #snd_seq_ev_ump_notify_t */
SND_SEQ_EVENT_UMP_EP_CHANGE,
/** UMP Block info has changed; event data type = #snd_seq_ev_ump_notify_t */
SND_SEQ_EVENT_UMP_BLOCK_CHANGE,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR0 = 90,
/** user-defined event; event data type = any (fixed size) */
@ -225,6 +236,7 @@ typedef union snd_seq_timestamp {
#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
#define SND_SEQ_EVENT_UMP (1<<5) /**< UMP packet event */
/** Note event */
typedef struct snd_seq_ev_note {
@ -291,6 +303,26 @@ typedef struct snd_seq_ev_queue_control {
} param; /**< data value union */
} snd_seq_ev_queue_control_t;
/** UMP info change notify */
typedef struct snd_seq_ev_ump_notify {
unsigned char client; /**< Client number */
unsigned char block; /**< Block number (optional) */
} snd_seq_ev_ump_notify_t;
/** Sequencer event data */
typedef union snd_seq_event_data {
snd_seq_ev_note_t note; /**< note information */
snd_seq_ev_ctrl_t control; /**< MIDI control information */
snd_seq_ev_raw8_t raw8; /**< raw8 data */
snd_seq_ev_raw32_t raw32; /**< raw32 data */
snd_seq_ev_ext_t ext; /**< external data */
snd_seq_ev_queue_control_t queue; /**< queue control */
snd_seq_timestamp_t time; /**< timestamp */
snd_seq_addr_t addr; /**< address */
snd_seq_connect_t connect; /**< connect information */
snd_seq_result_t result; /**< operation result code */
snd_seq_ev_ump_notify_t ump_notify; /**< UMP info change notification */
} snd_seq_event_data_t;
/** Sequencer event */
typedef struct snd_seq_event {
@ -304,20 +336,24 @@ typedef struct snd_seq_event {
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
union {
snd_seq_ev_note_t note; /**< note information */
snd_seq_ev_ctrl_t control; /**< MIDI control information */
snd_seq_ev_raw8_t raw8; /**< raw8 data */
snd_seq_ev_raw32_t raw32; /**< raw32 data */
snd_seq_ev_ext_t ext; /**< external data */
snd_seq_ev_queue_control_t queue; /**< queue control */
snd_seq_timestamp_t time; /**< timestamp */
snd_seq_addr_t addr; /**< address */
snd_seq_connect_t connect; /**< connect information */
snd_seq_result_t result; /**< operation result code */
} data; /**< event data... */
snd_seq_event_data_t data; /**< event data... */
} snd_seq_event_t;
/** UMP sequencer event; compatible with legacy sequencer event */
typedef struct snd_seq_ump_event {
snd_seq_event_type_t type; /**< event type */
unsigned char flags; /**< event flags */
unsigned char tag; /**< tag */
unsigned char queue; /**< schedule queue */
snd_seq_timestamp_t time; /**< schedule time */
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
union {
snd_seq_event_data_t data; /**< (shared) legacy data */
unsigned int ump[4]; /**< UMP data bytes */
};
} snd_seq_ump_event_t;
/** \} */

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seq_midi_event.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQ_MIDI_EVENT_H
#define __ALSA_SEQ_MIDI_EVENT_H

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seqmid.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQMID_H
#define __ALSA_SEQMID_H
@ -45,8 +51,21 @@ extern "C" {
*
* This macro clears the given event record pointer to the default status.
*/
#define snd_seq_ev_clear(ev) \
memset(ev, 0, sizeof(snd_seq_event_t))
static inline void snd_seq_ev_clear(snd_seq_event_t *ev)
{
memset(ev, 0, sizeof(*ev));
}
/**
* \brief initialize event record for UMP
* \param ev event record pointer
*
* This macro clears the given UMP event record pointer to the default status.
*/
static inline void snd_seq_ump_ev_clear(snd_seq_ump_event_t *ev)
{
memset(ev, 0, sizeof(*ev));
}
/**
* \brief set the tag for given event
@ -284,6 +303,31 @@ extern "C" {
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.tick = (ttime))
/**
* \brief set the event UMP flag
* \param ev event record
*/
static inline void snd_seq_ev_set_ump(snd_seq_ump_event_t *ev)
{
ev->flags |= SND_SEQ_EVENT_UMP;
ev->type = 0; /* unused for UMP */
}
/**
* \brief set the event UMP flag and fill UMP raw bytes
* \param ev event record
* \param data UMP packet data
* \param bytes UMP packet size in bytes
*/
static inline int snd_seq_ev_set_ump_data(snd_seq_ump_event_t *ev, void *data, size_t bytes)
{
if (bytes > 16)
return -EINVAL;
snd_seq_ev_set_ump(ev);
memcpy(ev->ump, data, bytes);
return 0;
}
/* set and send a queue control event */
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
@ -343,6 +387,8 @@ int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest
*/
int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
int snd_seq_set_client_midi_version(snd_seq_t *seq, int midi_version);
int snd_seq_set_client_ump_conversion(snd_seq_t *seq, int enable);
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
@ -480,6 +526,13 @@ int snd_seq_reset_pool_input(snd_seq_t *seq);
((ev)->type = SND_SEQ_EVENT_SYSEX,\
snd_seq_ev_set_variable(ev, datalen, dataptr))
/* Helper API functions for UMP endpoint and block creations */
int snd_seq_create_ump_endpoint(snd_seq_t *seq,
const snd_ump_endpoint_info_t *info,
unsigned int num_groups);
int snd_seq_create_ump_block(snd_seq_t *seq, int blkid,
const snd_ump_block_info_t *info);
/** \} */
#ifdef __cplusplus

View file

@ -3,7 +3,7 @@
#ifndef DOC_HIDDEN
#include <stdint.h>
#ifdef __linux__
#if defined(__linux__)
#include <linux/types.h>
#else
typedef uint8_t __u8;
@ -15,8 +15,14 @@ typedef int16_t __s16;
typedef int32_t __s32;
typedef int64_t __s64;
#include <endian.h>
#include <byteswap.h>
#if defined(__sun)
#include <sys/byteorder.h>
#define __cpu_to_le32 LE_32(x)
#define __cpu_to_be32 BE_32(x)
#define __cpu_to_le16 LE_16(x)
#define __cpu_to_be16 BE_16(x)
#else
#include <sys/endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define __cpu_to_le32(x) (x)
#define __cpu_to_be32(x) bswap_32(x)
@ -28,20 +34,12 @@ typedef int64_t __s64;
#define __cpu_to_le16(x) bswap_16(x)
#define __cpu_to_be16(x) (x)
#endif
#endif
#define __le32_to_cpu __cpu_to_le32
#define __be32_to_cpu __cpu_to_be32
#define __le16_to_cpu __cpu_to_le16
#define __be16_to_cpu __cpu_to_be16
#define __le64 __u64
#define __le32 __u32
#define __le16 __u16
#define __le8 __u8
#define __be64 __u64
#define __be32 __u32
#define __be16 __u16
#define __be8 __u8
#endif
#ifndef __kernel_long_t

View file

@ -3,22 +3,6 @@
* Main header file for the ALSA sequencer
* Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
* (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_ASEQUENCER_H
#define __SOUND_ASEQUENCER_H
@ -26,7 +10,7 @@
#include <sound/asound.h>
/** version of the sequencer */
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 5)
/**
* definition of sequencer event types
@ -108,6 +92,9 @@
#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
#define SNDRV_SEQ_EVENT_UMP_EP_CHANGE 68 /* UMP EP info has changed */
#define SNDRV_SEQ_EVENT_UMP_BLOCK_CHANGE 69 /* UMP block info has changed */
/* 70-89: synthesizer events - obsoleted */
/** user-defined events with fixed length
@ -190,6 +177,7 @@ struct snd_seq_connect {
#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
#define SNDRV_SEQ_EVENT_UMP (1<<5) /* event holds a UMP packet */
/* note event */
struct snd_seq_ev_note {
@ -268,6 +256,26 @@ struct snd_seq_ev_quote {
struct snd_seq_event *event; /* quoted event */
} __attribute__((packed));
/* UMP info change notify */
struct snd_seq_ev_ump_notify {
unsigned char client; /* Client number */
unsigned char block; /* Block number (optional) */
};
union snd_seq_event_data { /* event data... */
struct snd_seq_ev_note note;
struct snd_seq_ev_ctrl control;
struct snd_seq_ev_raw8 raw8;
struct snd_seq_ev_raw32 raw32;
struct snd_seq_ev_ext ext;
struct snd_seq_ev_queue_control queue;
union snd_seq_timestamp time;
struct snd_seq_addr addr;
struct snd_seq_connect connect;
struct snd_seq_result result;
struct snd_seq_ev_quote quote;
struct snd_seq_ev_ump_notify ump_notify;
};
/* sequencer event */
struct snd_seq_event {
@ -278,25 +286,27 @@ struct snd_seq_event {
unsigned char queue; /* schedule queue */
union snd_seq_timestamp time; /* schedule time */
struct snd_seq_addr source; /* source address */
struct snd_seq_addr dest; /* destination address */
union { /* event data... */
struct snd_seq_ev_note note;
struct snd_seq_ev_ctrl control;
struct snd_seq_ev_raw8 raw8;
struct snd_seq_ev_raw32 raw32;
struct snd_seq_ev_ext ext;
struct snd_seq_ev_queue_control queue;
union snd_seq_timestamp time;
struct snd_seq_addr addr;
struct snd_seq_connect connect;
struct snd_seq_result result;
struct snd_seq_ev_quote quote;
} data;
union snd_seq_event_data data;
};
/* (compatible) event for UMP-capable clients */
struct snd_seq_ump_event {
snd_seq_event_type_t type; /* event type */
unsigned char flags; /* event flags */
char tag;
unsigned char queue; /* schedule queue */
union snd_seq_timestamp time; /* schedule time */
struct snd_seq_addr source; /* source address */
struct snd_seq_addr dest; /* destination address */
union {
union snd_seq_event_data data;
unsigned int ump[4];
};
};
/*
* bounce event - stored as variable size data
@ -344,10 +354,11 @@ typedef int __bitwise snd_seq_client_type_t;
#define KERNEL_CLIENT ((snd_seq_client_type_t) 2)
/* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
#define SNDRV_SEQ_FILTER_NO_CONVERT (1U<<30) /* don't convert UMP events */
#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
struct snd_seq_client_info {
int client; /* client number to inquire */
@ -360,9 +371,18 @@ struct snd_seq_client_info {
int event_lost; /* number of lost events */
int card; /* RO: card number[kernel] */
int pid; /* RO: pid[user] */
char reserved[56]; /* for future use */
unsigned int midi_version; /* MIDI version */
unsigned int group_filter; /* UMP group filter bitmap
* (bit 0 = groupless messages,
* bit 1-16 = messages for groups 1-16)
*/
char reserved[48]; /* for future use */
};
/* MIDI version numbers in client info */
#define SNDRV_SEQ_CLIENT_LEGACY_MIDI 0 /* Legacy client */
#define SNDRV_SEQ_CLIENT_UMP_MIDI_1_0 1 /* UMP MIDI 1.0 */
#define SNDRV_SEQ_CLIENT_UMP_MIDI_2_0 2 /* UMP MIDI 2.0 */
/* client pool size */
struct snd_seq_client_pool {
@ -422,6 +442,8 @@ struct snd_seq_remove_events {
#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
#define SNDRV_SEQ_PORT_CAP_INACTIVE (1<<8) /* inactive port */
#define SNDRV_SEQ_PORT_CAP_UMP_ENDPOINT (1<<9) /* MIDI 2.0 UMP Endpoint port */
/* port type */
#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
@ -431,6 +453,7 @@ struct snd_seq_remove_events {
#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_UMP (1<<7) /* UMP */
/* other standards...*/
#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
@ -448,6 +471,14 @@ struct snd_seq_remove_events {
#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
#define SNDRV_SEQ_PORT_FLG_IS_MIDI1 (1<<3) /* Keep MIDI 1.0 protocol */
/* port direction */
#define SNDRV_SEQ_PORT_DIR_UNKNOWN 0
#define SNDRV_SEQ_PORT_DIR_INPUT 1
#define SNDRV_SEQ_PORT_DIR_OUTPUT 2
#define SNDRV_SEQ_PORT_DIR_BIDIRECTION 3
struct snd_seq_port_info {
struct snd_seq_addr addr; /* client/port numbers */
char name[64]; /* port name */
@ -464,7 +495,9 @@ struct snd_seq_port_info {
void *kernel; /* reserved for kernel use (must be NULL) */
unsigned int flags; /* misc. conditioning */
unsigned char time_queue; /* queue # for timestamping */
char reserved[59]; /* for future use */
unsigned char direction; /* port usage direction (r/w/bidir) */
unsigned char ump_group; /* 0 = UMP EP (no conversion), 1-16 = UMP group number */
char reserved[57]; /* for future use */
};
@ -502,11 +535,12 @@ struct snd_seq_queue_status {
/* queue tempo */
struct snd_seq_queue_tempo {
int queue; /* sequencer queue */
unsigned int tempo; /* current tempo, us/tick */
unsigned int tempo; /* current tempo, us/tick (or different time-base below) */
int ppq; /* time resolution, ticks/quarter */
unsigned int skew_value; /* queue skew */
unsigned int skew_base; /* queue skew base */
char reserved[24]; /* for the future */
unsigned short tempo_base; /* tempo base in nsec unit; either 10 or 1000 */
char reserved[22]; /* for the future */
};
@ -568,6 +602,18 @@ struct snd_seq_query_subs {
char reserved[64]; /* for future use */
};
/*
* UMP-specific information
*/
/* type of UMP info query */
#define SNDRV_SEQ_CLIENT_UMP_INFO_ENDPOINT 0
#define SNDRV_SEQ_CLIENT_UMP_INFO_BLOCK 1
struct snd_seq_client_ump_info {
int client; /* client number to inquire/set */
int type; /* type to inquire/set */
unsigned char info[512]; /* info (either UMP ep or block info) */
} __attribute__((packed));
/*
* IOCTL commands
@ -577,9 +623,12 @@ struct snd_seq_query_subs {
#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
#define SNDRV_SEQ_IOCTL_USER_PVERSION _IOW('S', 0x04, int)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_UMP_INFO _IOWR('S', 0x12, struct snd_seq_client_ump_info)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_UMP_INFO _IOWR('S', 0x13, struct snd_seq_client_ump_info)
#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)

View file

@ -16,7 +16,9 @@
#ifndef __LINUX_UAPI_SND_ASOC_H
#define __LINUX_UAPI_SND_ASOC_H
#if defined(__linux__)
#include <linux/types.h>
#endif
/*
* Maximum number of channels topology kcontrol can represent.

View file

@ -3,22 +3,6 @@
* Advanced Linux Sound Architecture - ALSA - Driver
* Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
* Abramo Bagnara <abramo@alsa-project.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_ASOUND_H
@ -54,8 +38,10 @@
* *
****************************************************************************/
#define AES_IEC958_STATUS_SIZE 24
struct snd_aes_iec958 {
unsigned char status[24]; /* AES/IEC958 channel status bits */
unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
unsigned char subcode[147]; /* AES/IEC958 subcode bits */
unsigned char pad; /* nothing */
unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
@ -154,7 +140,7 @@ struct snd_hwdep_dsp_image {
* *
*****************************************************************************/
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 18)
typedef unsigned long snd_pcm_uframes_t;
typedef signed long snd_pcm_sframes_t;
@ -200,6 +186,11 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_S24_BE ((snd_pcm_format_t) 7) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_LE ((snd_pcm_format_t) 8) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_BE ((snd_pcm_format_t) 9) /* low three bytes */
/*
* For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
* available bit count in most significant bit. It's for the case of so-called 'left-justified' or
* `right-padding` sample which has less width than 32 bit.
*/
#define SNDRV_PCM_FORMAT_S32_LE ((snd_pcm_format_t) 10)
#define SNDRV_PCM_FORMAT_S32_BE ((snd_pcm_format_t) 11)
#define SNDRV_PCM_FORMAT_U32_LE ((snd_pcm_format_t) 12)
@ -274,13 +265,17 @@ typedef int __bitwise snd_pcm_format_t;
typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX ((snd_pcm_subformat_t) 1)
#define SNDRV_PCM_SUBFORMAT_MSBITS_20 ((snd_pcm_subformat_t) 2)
#define SNDRV_PCM_SUBFORMAT_MSBITS_24 ((snd_pcm_subformat_t) 3)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_MSBITS_24
#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */
#define SNDRV_PCM_INFO_PERFECT_DRAIN 0x00000040 /* silencing at the end of stream is not required */
#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
@ -297,7 +292,8 @@ typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
#define SNDRV_PCM_INFO_EXPLICIT_SYNC 0x10000000 /* needs explicit sync of pointers and data */
#define SNDRV_PCM_INFO_NO_REWINDS 0x20000000 /* hardware can only support monotonic changes of appl_ptr */
#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
@ -336,7 +332,7 @@ union snd_pcm_sync_id {
unsigned char id[16];
unsigned short id16[8];
unsigned int id32[4];
};
} __attribute__((deprecated));
struct snd_pcm_info {
unsigned int device; /* RO/WR (control): device number */
@ -350,7 +346,7 @@ struct snd_pcm_info {
int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
unsigned int subdevices_count;
unsigned int subdevices_avail;
union snd_pcm_sync_id sync; /* hardware synchronization ID */
unsigned char pad1[16]; /* was: hardware synchronization ID */
unsigned char reserved[64]; /* reserved for future... */
};
@ -389,6 +385,9 @@ typedef int snd_pcm_hw_param_t;
#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling
* of the silence samples
*/
struct snd_interval {
unsigned int min, max;
@ -415,11 +414,12 @@ struct snd_pcm_hw_params {
unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */
unsigned int info; /* R: Info flags for returned setup */
unsigned int msbits; /* R: used most significant bits */
unsigned int msbits; /* R: used most significant bits (in sample bit-width) */
unsigned int rate_num; /* R: rate numerator */
unsigned int rate_den; /* R: rate denominator */
snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
unsigned char reserved[64]; /* reserved for future */
unsigned char sync[16]; /* R: synchronization ID (perfect sync - one clock source) */
unsigned char reserved[48]; /* reserved for future */
};
enum {
@ -435,9 +435,14 @@ struct snd_pcm_sw_params {
snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
snd_pcm_uframes_t silence_size; /* silence block size */
/*
* The following two thresholds alleviate playback buffer underruns; when
* hw_avail drops below the threshold, the respective action is triggered:
*/
snd_pcm_uframes_t stop_threshold; /* - stop playback */
snd_pcm_uframes_t silence_threshold; /* - pre-fill buffer with silence */
snd_pcm_uframes_t silence_size; /* max size of silence pre-fill; when >= boundary,
* fill played area with silence immediately */
snd_pcm_uframes_t boundary; /* pointers wrap point */
unsigned int proto; /* protocol version */
unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
@ -570,7 +575,8 @@ struct __snd_pcm_mmap_status64 {
struct __snd_pcm_mmap_control64 {
__pad_before_uframe __pad1;
snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
__pad_before_uframe __pad2;
__pad_before_uframe __pad2; // This should be __pad_after_uframe, but binary
// backwards compatibility constraints prevent a fix.
__pad_before_uframe __pad3;
snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
@ -702,7 +708,7 @@ enum {
* Raw MIDI section - /dev/snd/midi??
*/
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2)
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
enum {
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@ -713,6 +719,10 @@ enum {
#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
#define SNDRV_RAWMIDI_INFO_UMP 0x00000008
#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010
#define SNDRV_RAWMIDI_DEVICE_UNKNOWN 0
struct snd_rawmidi_info {
unsigned int device; /* RO/WR (control): device number */
@ -725,7 +735,8 @@ struct snd_rawmidi_info {
unsigned char subname[32]; /* name of active or selected subdevice */
unsigned int subdevices_count;
unsigned int subdevices_avail;
unsigned char reserved[64]; /* reserved for future use */
int tied_device; /* R: tied rawmidi device (UMP/legacy) */
unsigned char reserved[60]; /* reserved for future use */
};
#define SNDRV_RAWMIDI_MODE_FRAMING_MASK (7<<0)
@ -751,7 +762,7 @@ struct snd_rawmidi_framing_tstamp {
__u32 tv_nsec; /* nanoseconds */
__u64 tv_sec; /* seconds */
__u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
} __packed;
} __attribute__((packed));
struct snd_rawmidi_params {
int stream;
@ -771,6 +782,72 @@ struct snd_rawmidi_status {
unsigned char reserved[16]; /* reserved for future use */
};
/* UMP EP info flags */
#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01
/* UMP EP Protocol / JRTS capability bits */
#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */
#define SNDRV_UMP_EP_INFO_PROTO_MIDI2 0x0200 /* MIDI 2.0 */
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX 0x0001 /* JRTS Transmit */
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX 0x0002 /* JRTS Receive */
/* UMP Endpoint information */
struct snd_ump_endpoint_info {
int card; /* card number */
int device; /* device number */
unsigned int flags; /* additional info */
unsigned int protocol_caps; /* protocol capabilities */
unsigned int protocol; /* current protocol */
unsigned int num_blocks; /* # of function blocks */
unsigned short version; /* UMP major/minor version */
unsigned short family_id; /* MIDI device family ID */
unsigned short model_id; /* MIDI family model ID */
unsigned int manufacturer_id; /* MIDI manufacturer ID */
unsigned char sw_revision[4]; /* software revision */
unsigned short padding;
unsigned char name[128]; /* endpoint name string */
unsigned char product_id[128]; /* unique product id string */
unsigned char reserved[32];
} __attribute__((packed));
/* UMP direction */
#define SNDRV_UMP_DIR_INPUT 0x01
#define SNDRV_UMP_DIR_OUTPUT 0x02
#define SNDRV_UMP_DIR_BIDIRECTION 0x03
/* UMP block info flags */
#define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */
#define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */
/* UMP block user-interface hint */
#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00
#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01
#define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02
#define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03
/* UMP groups and blocks */
#define SNDRV_UMP_MAX_GROUPS 16
#define SNDRV_UMP_MAX_BLOCKS 32
/* UMP Block information */
struct snd_ump_block_info {
int card; /* card number */
int device; /* device number */
unsigned char block_id; /* block ID (R/W) */
unsigned char direction; /* UMP direction */
unsigned char active; /* Activeness */
unsigned char first_group; /* first group ID */
unsigned char num_groups; /* number of groups */
unsigned char midi_ci_version; /* MIDI-CI support version */
unsigned char sysex8_streams; /* max number of sysex8 streams */
unsigned char ui_hint; /* user interface hint */
unsigned int flags; /* various info flags */
unsigned char name[128]; /* block name string */
unsigned char reserved[32];
} __attribute__((packed));
#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
@ -778,12 +855,15 @@ struct snd_rawmidi_status {
#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
/* Additional ioctls for UMP rawmidi devices */
#define SNDRV_UMP_IOCTL_ENDPOINT_INFO _IOR('W', 0x40, struct snd_ump_endpoint_info)
#define SNDRV_UMP_IOCTL_BLOCK_INFO _IOR('W', 0x41, struct snd_ump_block_info)
/*
* Timer section - /dev/snd/timer
*/
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
enum {
SNDRV_TIMER_CLASS_NONE = -1,
@ -808,6 +888,7 @@ enum {
#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */
#define SNDRV_TIMER_GLOBAL_HPET 2
#define SNDRV_TIMER_GLOBAL_HRTIMER 3
#define SNDRV_TIMER_GLOBAL_UDRIVEN 4
/* info flags */
#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
@ -886,6 +967,18 @@ struct snd_timer_status {
unsigned char reserved[64]; /* reserved */
};
/*
* This structure describes the userspace-driven timer. Such timers are purely virtual,
* and can only be triggered from software (for instance, by userspace application).
*/
struct snd_timer_uinfo {
/* To pretend being a normal timer, we need to know the resolution in ns. */
__u64 resolution;
int fd;
unsigned int id;
unsigned char reserved[16];
};
#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
@ -902,6 +995,8 @@ struct snd_timer_status {
#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
#define SNDRV_TIMER_IOCTL_CREATE _IOWR('T', 0xa5, struct snd_timer_uinfo)
#define SNDRV_TIMER_IOCTL_TRIGGER _IO('T', 0xa6)
#if __BITS_PER_LONG == 64
#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
@ -949,7 +1044,7 @@ struct snd_timer_tread {
* *
****************************************************************************/
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
struct snd_ctl_card_info {
int card; /* card number */
@ -987,7 +1082,7 @@ typedef int __bitwise snd_ctl_elem_iface_t;
#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
// (1 << 3) is unused.
/* (1 << 3) is unused. */
#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
@ -1084,7 +1179,7 @@ struct snd_ctl_elem_value {
struct snd_ctl_tlv {
unsigned int numid; /* control element numeric identification */
unsigned int length; /* in bytes aligned to 4 */
unsigned int tlv[0]; /* first TLV */
unsigned int tlv[]; /* first TLV */
};
#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
@ -1110,6 +1205,9 @@ struct snd_ctl_tlv {
#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE _IOWR('U', 0x43, int)
#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO _IOWR('U', 0x45, struct snd_ump_block_info)
#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)

View file

@ -25,6 +25,12 @@
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/timer.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_TIMER_H
#define __ALSA_TIMER_H

View file

@ -219,7 +219,7 @@ extern "C" {
*
* <pre>
* SectionData."data element name" {
* index "1" #Index number
* index "1" # Index number
* tuples [
* "id of the 1st vendor tuples section"
* "id of the 2nd vendor tuples section"
@ -254,8 +254,6 @@ extern "C" {
* And data of these sections will be merged in the same order as they are
* in the list, as the element's private data for kernel.
*
* </pre>
*
* <h6>Vendor Tokens</h6>
* A vendor token list is defined as a new section. Each token element is
* a pair of string ID and integer value. And both the ID and value are
@ -419,7 +417,7 @@ extern "C" {
* Values [
* "value1"
* "value2"
"value3"
* "value3"
* ]
* }
* </pre>
@ -504,7 +502,7 @@ extern "C" {
* no_pm "true" # No PM control bit.
* reg "20" # PM bit register offset
* shift "0" # PM bit register shift
* invert "1 # PM bit is inverted
* invert "1" # PM bit is inverted
* subseq "8" # subsequence number
*
* event_type "1" # DAPM widget event type
@ -639,7 +637,7 @@ extern "C" {
* ...
* ]
*
* default_hw_conf_id "1" #default HW config ID for init
* default_hw_conf_id "1" # default HW config ID for init
*
* # Optional boolean flags
* symmetric_rates "true"
@ -842,7 +840,7 @@ struct snd_tplg_tlv_dbscale_template {
int mute; /*!< is min dB value mute ? */
};
/** \struct snd_tplg_channel_template
/** \struct snd_tplg_channel_elem
* \brief Template type for single channel mapping.
*/
struct snd_tplg_channel_elem {
@ -1023,26 +1021,26 @@ struct snd_tplg_pcm_template {
* hardware config, i.e. hardware audio formats.
*/
struct snd_tplg_hw_config_template {
int id; /* unique ID - - used to match */
unsigned int fmt; /* SND_SOC_DAI_FORMAT_ format value */
unsigned char clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */
unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */
unsigned char bclk_provider; /* SND_SOC_TPLG_BCLK_ value */
unsigned char fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */
unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
unsigned short reserved; /* for 32bit alignment */
unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */
unsigned int bclk_rate; /* BCLK freqency in Hz */
unsigned int fsync_rate; /* frame clock in Hz */
unsigned int tdm_slots; /* number of TDM slots in use */
unsigned int tdm_slot_width; /* width in bits for each slot */
unsigned int tx_slots; /* bit mask for active Tx slots */
unsigned int rx_slots; /* bit mask for active Rx slots */
unsigned int tx_channels; /* number of Tx channels */
unsigned int *tx_chanmap; /* array of slot number */
unsigned int rx_channels; /* number of Rx channels */
unsigned int *rx_chanmap; /* array of slot number */
int id; /*!< unique ID - - used to match */
unsigned int fmt; /*!< SND_SOC_DAI_FORMAT_ format value */
unsigned char clock_gated; /*!< SND_SOC_TPLG_DAI_CLK_GATE_ value */
unsigned char invert_bclk; /*!< 1 for inverted BCLK, 0 for normal */
unsigned char invert_fsync; /*!< 1 for inverted frame clock, 0 for normal */
unsigned char bclk_provider; /*!< SND_SOC_TPLG_BCLK_ value */
unsigned char fsync_provider; /*!< SND_SOC_TPLG_FSYNC_ value */
unsigned char mclk_direction; /*!< SND_SOC_TPLG_MCLK_ value */
unsigned short reserved; /*!< for 32bit alignment */
unsigned int mclk_rate; /*!< MCLK or SYSCLK freqency in Hz */
unsigned int bclk_rate; /*!< BCLK freqency in Hz */
unsigned int fsync_rate; /*!< frame clock in Hz */
unsigned int tdm_slots; /*!< number of TDM slots in use */
unsigned int tdm_slot_width; /*!< width in bits for each slot */
unsigned int tx_slots; /*!< bit mask for active Tx slots */
unsigned int rx_slots; /*!< bit mask for active Rx slots */
unsigned int tx_channels; /*!< number of Tx channels */
unsigned int *tx_chanmap; /*!< array of slot number */
unsigned int rx_channels; /*!< number of Rx channels */
unsigned int *rx_chanmap; /*!< array of slot number */
};
/** \struct snd_tplg_dai_template
@ -1073,15 +1071,15 @@ struct snd_tplg_link_template {
struct snd_tplg_stream_template *stream; /*!< supported configs */
struct snd_tplg_hw_config_template *hw_config; /*!< supported HW configs */
int num_hw_configs; /* number of hw configs */
int default_hw_config_id; /* default hw config ID for init */
int num_hw_configs; /*!< number of hw configs */
int default_hw_config_id; /*!< default hw config ID for init */
unsigned int flag_mask; /* bitmask of flags to configure */
unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
unsigned int flag_mask; /*!< bitmask of flags to configure */
unsigned int flags; /*!< SND_SOC_TPLG_LNK_FLGBIT_* flag value */
struct snd_soc_tplg_private *priv; /*!< private data */
};
/** \struct snd_tplg_obj_template
/** \struct snd_tplg_obj_template_t
* \brief Generic Template Object
*/
typedef struct snd_tplg_obj_template {
@ -1154,7 +1152,13 @@ int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
* \brief Save the topology to the text configuration string.
* \param tplg Topology instance.
* \param dst A pointer to string with result (malloc).
* \param flags save mode
* \return Zero on success, otherwise a negative error code
*
* Valid flags are
* - SND_TPLG_SAVE_SORT
* - SND_TPLG_SAVE_GROUPS
* - SND_TPLG_SAVE_NOCHECK
*/
int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags);
@ -1163,11 +1167,12 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags);
* \param tplg Topology instance.
* \param bin Binary topology input buffer.
* \param size Binary topology input buffer size.
* \param dflags - not used, must be set to 0.
* \return Zero on success, otherwise a negative error code
*/
int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags);
/* \} */
/** \} */
#ifdef __cplusplus
}

View file

@ -26,7 +26,7 @@
#define EBADFD EBADF
#endif
#ifndef ESTRPIPE
#define ESTRPIPE EPIPE
#define ESTRPIPE ESPIPE
#endif
#ifndef __u16

189
include/ump.h Normal file
View file

@ -0,0 +1,189 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
/**
* \file include/ump.h
* \brief API library for ALSA rawmidi/UMP interface
*
* API library for ALSA rawmidi/UMP interface
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/ump.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_UMP_H
#define __ALSA_UMP_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup RawMidi RawMidi Interface
* The RawMidi Interface. See \ref rawmidi page for more details.
* \{
*/
/** UMP (Endpoint) RawMIDI device */
typedef struct _snd_ump snd_ump_t;
/** UMP Endpoint information container */
typedef struct snd_ump_endpoint_info snd_ump_endpoint_info_t;
/** UMP Block information container */
typedef struct snd_ump_block_info snd_ump_block_info_t;
int snd_ump_open(snd_ump_t **inputp, snd_ump_t **outputp, const char *name, int mode);
int snd_ump_close(snd_ump_t *ump);
snd_rawmidi_t *snd_ump_rawmidi(snd_ump_t *ump);
const char *snd_ump_name(snd_ump_t *ump);
int snd_ump_poll_descriptors_count(snd_ump_t *ump);
int snd_ump_poll_descriptors(snd_ump_t *ump, struct pollfd *pfds, unsigned int space);
int snd_ump_poll_descriptors_revents(snd_ump_t *ump, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_ump_nonblock(snd_ump_t *ump, int nonblock);
int snd_ump_rawmidi_info(snd_ump_t *ump, snd_rawmidi_info_t *info);
int snd_ump_rawmidi_params(snd_ump_t *ump, snd_rawmidi_params_t *params);
int snd_ump_rawmidi_params_current(snd_ump_t *ump, snd_rawmidi_params_t *params);
int snd_ump_rawmidi_status(snd_ump_t *ump, snd_rawmidi_status_t *status);
int snd_ump_drop(snd_ump_t *ump);
int snd_ump_drain(snd_ump_t *ump);
ssize_t snd_ump_write(snd_ump_t *ump, const void *buffer, size_t size);
ssize_t snd_ump_read(snd_ump_t *ump, void *buffer, size_t size);
ssize_t snd_ump_tread(snd_ump_t *ump, struct timespec *tstamp, void *buffer, size_t size);
/** Max number of UMP Groups */
#define SND_UMP_MAX_GROUPS 16
/** Max number of UMP Blocks */
#define SND_UMP_MAX_BLOCKS 32
/** UMP direction */
enum _snd_ump_direction {
/** Input only */
SND_UMP_DIR_INPUT = 0x01,
/** Output only */
SND_UMP_DIR_OUTPUT = 0x02,
/** Bidirectional */
SND_UMP_DIR_BIDIRECTION = 0x03,
};
/** UMP EP holds only static blocks */
#define SND_UMP_EP_INFO_STATIC_BLOCKS 0x01
/** Bitmask for UMP EP MIDI protocols */
#define SND_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
/** Bit flag for MIDI 1.0 protocol */
#define SND_UMP_EP_INFO_PROTO_MIDI1 0x0100
/** Bit flag for MIDI 2.0 protocol */
#define SND_UMP_EP_INFO_PROTO_MIDI2 0x0200
/** Bitmask for UMP Jitter-reduction timestamp */
#define SND_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003
/** Bit flag for JRTS in Transmit */
#define SND_UMP_EP_INFO_PROTO_JRTS_TX 0x0001
/** Bit flag for JRTS in Receive */
#define SND_UMP_EP_INFO_PROTO_JRTS_RX 0x0002
/** Default version passed to UMP Endpoint info */
#define SND_UMP_EP_INFO_DEFAULT_VERSION 0x0101
size_t snd_ump_endpoint_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ump_endpoint_info_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ump_endpoint_info_alloca(ptr) __snd_alloca(ptr, snd_ump_endpoint_info)
int snd_ump_endpoint_info_malloc(snd_ump_endpoint_info_t **info);
void snd_ump_endpoint_info_free(snd_ump_endpoint_info_t *info);
void snd_ump_endpoint_info_clear(snd_ump_endpoint_info_t *info);
void snd_ump_endpoint_info_copy(snd_ump_endpoint_info_t *dst, const snd_ump_endpoint_info_t *src);
int snd_ump_endpoint_info_get_card(const snd_ump_endpoint_info_t *info);
int snd_ump_endpoint_info_get_device(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_flags(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_protocol_caps(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_protocol(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_num_blocks(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_version(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_manufacturer_id(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_family_id(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_model_id(const snd_ump_endpoint_info_t *info);
const unsigned char *snd_ump_endpoint_info_get_sw_revision(const snd_ump_endpoint_info_t *info);
const char *snd_ump_endpoint_info_get_name(const snd_ump_endpoint_info_t *info);
const char *snd_ump_endpoint_info_get_product_id(const snd_ump_endpoint_info_t *info);
int snd_ump_endpoint_info(snd_ump_t *ump, snd_ump_endpoint_info_t *info);
void snd_ump_endpoint_info_set_card(snd_ump_endpoint_info_t *info, unsigned int card);
void snd_ump_endpoint_info_set_device(snd_ump_endpoint_info_t *info, unsigned int device);
void snd_ump_endpoint_info_set_flags(snd_ump_endpoint_info_t *info, unsigned int flags);
void snd_ump_endpoint_info_set_protocol_caps(snd_ump_endpoint_info_t *info, unsigned int caps);
void snd_ump_endpoint_info_set_protocol(snd_ump_endpoint_info_t *info, unsigned int protocols);
void snd_ump_endpoint_info_set_num_blocks(snd_ump_endpoint_info_t *info, unsigned int num_blocks);
void snd_ump_endpoint_info_set_version(snd_ump_endpoint_info_t *info, unsigned int version);
void snd_ump_endpoint_info_set_manufacturer_id(snd_ump_endpoint_info_t *info, unsigned int id);
void snd_ump_endpoint_info_set_family_id(snd_ump_endpoint_info_t *info, unsigned int id);
void snd_ump_endpoint_info_set_model_id(snd_ump_endpoint_info_t *info, unsigned int id);
void snd_ump_endpoint_info_set_sw_revision(snd_ump_endpoint_info_t *info, const unsigned char *id);
void snd_ump_endpoint_info_set_name(snd_ump_endpoint_info_t *info, const char *name);
void snd_ump_endpoint_info_set_product_id(snd_ump_endpoint_info_t *info, const char *id);
/** Bit flag for MIDI 1.0 port w/o restrict in UMP Block info flags */
#define SND_UMP_BLOCK_IS_MIDI1 (1U << 0)
/** Bit flag for 31.25Kbps B/W MIDI1 port in UMP Block info flags */
#define SND_UMP_BLOCK_IS_LOWSPEED (1U << 1)
/** UMP block user-interface hint */
enum _snd_ump_block_ui_hint {
/** Unknown or undeclared */
SND_UMP_BLOCK_UI_HINT_UNKNOWN = 0x00,
/** Primarily a receiver or a destination for MIDI messages */
SND_UMP_BLOCK_UI_HINT_RECEIVER = 0x01,
/** Primarily a sender or a source of MIDI messages */
SND_UMP_BLOCK_UI_HINT_SENDER = 0x02,
/** Both a sender and receiver of MIDI messages */
SND_UMP_BLOCK_UI_HINT_BOTH = 0x03,
};
/** Default MIDI CI version passed to UMP Block info */
#define SND_UMP_BLOCK_INFO_DEFAULT_MIDI_CI_VERSION 0x01
size_t snd_ump_block_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ump_block_info_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ump_block_info_alloca(ptr) __snd_alloca(ptr, snd_ump_block_info)
int snd_ump_block_info_malloc(snd_ump_block_info_t **info);
void snd_ump_block_info_free(snd_ump_block_info_t *info);
void snd_ump_block_info_clear(snd_ump_block_info_t *info);
void snd_ump_block_info_copy(snd_ump_block_info_t *dst, const snd_ump_block_info_t *src);
int snd_ump_block_info_get_card(const snd_ump_block_info_t *info);
int snd_ump_block_info_get_device(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_block_id(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_active(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_flags(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_direction(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_first_group(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_num_groups(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_midi_ci_version(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_sysex8_streams(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_ui_hint(const snd_ump_block_info_t *info);
const char *snd_ump_block_info_get_name(const snd_ump_block_info_t *info);
int snd_ump_block_info(snd_ump_t *ump, snd_ump_block_info_t *info);
void snd_ump_block_info_set_card(snd_ump_block_info_t *info, unsigned int card);
void snd_ump_block_info_set_device(snd_ump_block_info_t *info, unsigned int device);
void snd_ump_block_info_set_block_id(snd_ump_block_info_t *info, unsigned int id);
void snd_ump_block_info_set_active(snd_ump_block_info_t *info, unsigned int active);
void snd_ump_block_info_set_flags(snd_ump_block_info_t *info, unsigned int flags);
void snd_ump_block_info_set_direction(snd_ump_block_info_t *info, unsigned int direction);
void snd_ump_block_info_set_first_group(snd_ump_block_info_t *info, unsigned int first_group);
void snd_ump_block_info_set_num_groups(snd_ump_block_info_t *info, unsigned int num_groups);
void snd_ump_block_info_set_midi_ci_version(snd_ump_block_info_t *info, unsigned int version);
void snd_ump_block_info_set_sysex8_streams(snd_ump_block_info_t *info, unsigned int streams);
void snd_ump_block_info_set_ui_hint(snd_ump_block_info_t *info, unsigned int hint);
void snd_ump_block_info_set_name(snd_ump_block_info_t *info, const char *name);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_UMP_H */

1135
include/ump_msg.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -139,7 +139,7 @@ extern "C" {
#define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth" /**< Bluetooth Device */
#define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */
#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI Device */
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI / DisplayPort Device */
#define SND_USE_CASE_DEV_USB "USB" /**< USB Device (multifunctional) */
#define SND_USE_CASE_DEV_DIRECT "Direct" /**< Direct Device (no channel remapping), (e.g. ProAudio usage) */
/* add new devices to end of list */
@ -325,10 +325,10 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* - playback control device name
* - PlaybackVolume
* - playback control volume identifier string
* - can be parsed using snd_use_case_parse_ctl_elem_id()
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - PlaybackSwitch
* - playback control switch identifier string
* - can be parsed using snd_use_case_parse_ctl_elem_id()
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - PlaybackPriority
* - priority value (1-10000), higher value means higher priority
* - CaptureRate
@ -345,20 +345,20 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* - capture control device name
* - CaptureVolume
* - capture control volume identifier string
* - can be parsed using snd_use_case_parse_ctl_elem_id()
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - CaptureSwitch
* - capture control switch identifier string
* - can be parsed using snd_use_case_parse_ctl_elem_id()
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - CapturePriority
* - priority value (1-10000), higher value means higher priority
* - PlaybackMixer
* - name of playback mixer
* - PlaybackMixerElem
* - mixer element playback identifier
* - can be parsed using snd_use_case_parse_selem_id()
* - can be parsed using #snd_use_case_parse_selem_id()
* - PlaybackMasterElem
* - mixer element playback identifier for the master control
* - can be parsed using snd_use_case_parse_selem_id()
* - can be parsed using #snd_use_case_parse_selem_id()
* - PlaybackMasterType
* - type of the master volume control
* - Valid values: "soft" (software attenuation)
@ -366,13 +366,16 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* - name of capture mixer
* - CaptureMixerElem
* - mixer element capture identifier
* - can be parsed using snd_use_case_parse_selem_id()
* - can be parsed using #snd_use_case_parse_selem_id()
* - CaptureMasterElem
* - mixer element playback identifier for the master control
* - can be parsed using snd_use_case_parse_selem_id()
* - can be parsed using #snd_use_case_parse_selem_id()
* - CaptureMasterType
* - type of the master volume control
* - Valid values: "soft" (software attenuation)
* - CaptureMicInfoFile
* - json file with the microphone array placement and type description
* (e.g. output from nhlt-dmic-info)
* - EDIDFile
* - Path to EDID file for HDMI devices
* - JackCTL
@ -402,9 +405,9 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* but that's application policy configuration that doesn't belong
* to UCM configuration files.
* - MinBufferLevel
* - This is used on platform where reported buffer level is not accurate.
* E.g. "512", which holds 512 samples in device buffer. Note: this will
* increase latency.
* - This is used on platform where reported buffer level is not accurate.
* E.g. "512", which holds 512 samples in device buffer. Note: this will
* increase latency.
*/
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
@ -433,24 +436,24 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
* \return Zero if success, otherwise a negative error code
*
* Known identifiers:
* - _fboot - execute the fixed boot sequence (value = NULL)
* - _boot - execute the boot sequence (value = NULL)
* - only when driver controls identifiers are changed
* (otherwise the old control values are restored)
* - _defaults - execute the 'defaults' sequence (value = NULL)
* - _verb - set current verb = value
* - _enadev - enable given device = value
* - _disdev - disable given device = value
* - _swdev/{old_device} - new_device = value
* - disable old_device and then enable new_device
* - if old_device is not enabled just return
* - check transmit sequence firstly
* - _enamod - enable given modifier = value
* - _dismod - disable given modifier = value
* - _fboot - execute the fixed boot sequence (value = NULL)
* - _boot - execute the boot sequence (value = NULL)
* - only when driver controls identifiers are changed
* (otherwise the old control values are restored)
* - _defaults - execute the 'defaults' sequence (value = NULL)
* - _verb - set current verb = value
* - _enadev - enable given device = value
* - _disdev - disable given device = value
* - _swdev/{old_device} - new_device = value
* - disable old_device and then enable new_device
* - if old_device is not enabled just return
* - check transmit sequence firstly
* - _enamod - enable given modifier = value
* - _dismod - disable given modifier = value
* - _swmod/{old_modifier} - new_modifier = value
* - disable old_modifier and then enable new_modifier
* - if old_modifier is not enabled just return
* - check transmit sequence firstly
* - disable old_modifier and then enable new_modifier
* - if old_modifier is not enabled just return
* - check transmit sequence firstly
*/
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
@ -531,7 +534,7 @@ static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
/**
* \brief Parse control element identifier
* \param elem_id Element identifier
* \param dst Element identifier
* \param ucm_id Use case identifier
* \param value String value to be parsed
* \return Zero if success, otherwise a negative error code

View file

@ -0,0 +1,24 @@
dnl Check compiler support for symver function attribute
AC_DEFUN([AC_CHECK_ATTRIBUTE_SYMVER], [
saved_CFLAGS=$CFLAGS
CFLAGS="-O0 -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
void _test_attribute_symver(void);
__attribute__((__symver__("sym@VER_1.2.3"))) void _test_attribute_symver(void) {}
]],
[[
_test_attribute_symver()
]]
)],
[
AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], 1, [Define to 1 if __attribute__((symver)) is supported])
],
[
AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], 0, [Define to 0 if __attribute__((symver)) is not supported])
]
)
CFLAGS=$saved_CFLAGS
])

View file

@ -1,10 +1,12 @@
EXTRA_DIST=Versions
EXTRA_DIST = Versions.in.in
COMPATNUM=@LIBTOOL_VERSION_INFO@
if VERSIONED_SYMBOLS
VSYMS = -Wl,--version-script=Versions
BUILT_SOURCES = $(top_builddir)/src/Versions
else
VSYMS =
BUILT_SOURCES =
endif
if SYMBOLIC_FUNCTIONS
@ -13,6 +15,8 @@ else
SYMFUNCS =
endif
VERSION_CPPFLAGS =
lib_LTLIBRARIES = libasound.la
libasound_la_SOURCES = conf.c confeval.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
@ -23,12 +27,16 @@ SUBDIRS += mixer
libasound_la_LIBADD += mixer/libmixer.la
endif
if BUILD_PCM
if VERSIONED_SYMBOLS
VERSION_CPPFLAGS += -DHAVE_PCM_SYMS -DHAVE_TIMER_SYMS
endif
SUBDIRS += pcm timer
libasound_la_LIBADD += pcm/libpcm.la timer/libtimer.la
endif
if BUILD_RAWMIDI
SUBDIRS += rawmidi
libasound_la_LIBADD += rawmidi/librawmidi.la
VERSION_CPPFLAGS += -DHAVE_RAWMIDI_SYMS
endif
if BUILD_HWDEP
SUBDIRS += hwdep
@ -37,20 +45,20 @@ endif
if BUILD_SEQ
SUBDIRS += seq
libasound_la_LIBADD += seq/libseq.la
VERSION_CPPFLAGS += -DHAVE_SEQ_SYMS
endif
if BUILD_UCM
SUBDIRS += ucm
libasound_la_LIBADD += ucm/libucm.la
endif
if BUILD_ALISP
SUBDIRS += alisp
libasound_la_LIBADD += alisp/libalisp.la
endif
SUBDIRS += conf
libasound_la_LIBADD += @ALSA_DEPLIBS@
libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
$(top_builddir)/src/Versions: $(top_builddir)/src/Versions.in
$(COMPILE) -E $(VERSION_CPPFLAGS) -x assembler-with-cpp -o $@ $<
control/libcontrol.la:
$(MAKE) -C control libcontrol.la
@ -87,7 +95,4 @@ topology/libtopology.la:
instr/libinstr.la:
$(MAKE) -C instr libinstr.la
alisp/libalisp.la:
$(MAKE) -C alisp libalisp.la
AM_CPPFLAGS=-I$(top_srcdir)/include

View file

@ -16,6 +16,7 @@ ALSA_0.9 {
};
ALSA_0.9.0rc4 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_hw_params_get_access;
@ -42,6 +43,7 @@ ALSA_0.9.0rc4 {
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time;
@ -85,22 +87,29 @@ ALSA_0.9.0rc4 {
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_last;
#endif
} ALSA_0.9;
ALSA_0.9.0rc8 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_forward;
@SYMBOL_PREFIX@snd_pcm_status_get_trigger_htstamp;
@SYMBOL_PREFIX@snd_pcm_status_get_htstamp;
#endif
} ALSA_0.9.0rc4;
ALSA_0.9.0 {
#if defined HAVE_PCM_SYMS || defined HAVE_TIMER_SYMS
global:
#if defined HAVE_PCM_SYMS
@SYMBOL_PREFIX@snd_pcm_type_name;
#endif
#ifdef HAVE_TIMER_SYMS
@SYMBOL_PREFIX@snd_timer_query_info;
@SYMBOL_PREFIX@snd_timer_query_params;
@SYMBOL_PREFIX@snd_timer_query_status;
@ -108,6 +117,8 @@ ALSA_0.9.0 {
@SYMBOL_PREFIX@snd_timer_params_get_exclusive;
@SYMBOL_PREFIX@snd_timer_params_set_filter;
@SYMBOL_PREFIX@snd_timer_params_get_filter;
#endif
#endif
} ALSA_0.9.0rc8;
ALSA_0.9.3 {
@ -118,15 +129,9 @@ ALSA_0.9.3 {
} ALSA_0.9.0;
ALSA_0.9.5 {
global:
@SYMBOL_PREFIX@alsa_lisp;
} ALSA_0.9.3;
ALSA_0.9.7 {
global:
@SYMBOL_PREFIX@alsa_lisp_*;
} ALSA_0.9.5;
ALSA_1.1.6 {
@ -140,3 +145,72 @@ ALSA_1.2.6 {
@SYMBOL_PREFIX@_snd_safe_strto*;
} ALSA_1.1.6;
ALSA_1.2.9 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_hw_params_is_perfect_drain;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_drain_silence;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_drain_silence;
#endif
} ALSA_1.2.6;
ALSA_1.2.10 {
global:
#ifdef HAVE_RAWMIDI_SYMS
@SYMBOL_PREFIX@snd_ump_*;
#endif
@SYMBOL_PREFIX@snd_ctl_ump_next_device;
@SYMBOL_PREFIX@snd_ctl_ump_endpoint_info;
@SYMBOL_PREFIX@snd_ctl_ump_block_info;
#ifdef HAVE_SEQ_SYMS
@SYMBOL_PREFIX@snd_seq_ump_*;
@SYMBOL_PREFIX@snd_seq_client_info_get_midi_version;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_groupless_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_conversion;
@SYMBOL_PREFIX@snd_seq_client_info_set_midi_version;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_groupless_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_conversion;
@SYMBOL_PREFIX@snd_seq_get_ump_endpoint_info;
@SYMBOL_PREFIX@snd_seq_get_ump_block_info;
@SYMBOL_PREFIX@snd_seq_set_ump_endpoint_info;
@SYMBOL_PREFIX@snd_seq_set_ump_block_info;
@SYMBOL_PREFIX@snd_seq_port_info_get_direction;
@SYMBOL_PREFIX@snd_seq_port_info_get_ump_group;
@SYMBOL_PREFIX@snd_seq_port_info_set_direction;
@SYMBOL_PREFIX@snd_seq_port_info_set_ump_group;
@SYMBOL_PREFIX@snd_seq_set_client_midi_version;
@SYMBOL_PREFIX@snd_seq_set_client_ump_conversion;
#endif
} ALSA_1.2.9;
ALSA_1.2.13 {
#if defined(HAVE_PCM_SYMS) || defined(HAVE_SEQ_SYMS) || defined(HAVE_RAWMIDI_SYMS)
global:
#endif
#ifdef HAVE_PCM_SYMS
@SYMBOL_PREFIX@snd_pcm_hw_params_get_sync;
#endif
#ifdef HAVE_SEQ_SYMS
@SYMBOL_PREFIX@snd_seq_create_ump_endpoint;
@SYMBOL_PREFIX@snd_seq_create_ump_block;
@SYMBOL_PREFIX@snd_seq_queue_tempo_get_tempo_base;
@SYMBOL_PREFIX@snd_seq_queue_tempo_set_tempo_base;
@SYMBOL_PREFIX@snd_seq_has_queue_tempo_base;
@SYMBOL_PREFIX@snd_seq_port_info_get_ump_is_midi1;
@SYMBOL_PREFIX@snd_seq_port_info_set_ump_is_midi1;
#endif
#ifdef HAVE_RAWMIDI_SYMS
@SYMBOL_PREFIX@snd_ump_endpoint_info_clear;
@SYMBOL_PREFIX@snd_ump_endpoint_info_set_*;
@SYMBOL_PREFIX@snd_ump_block_info_clear;
@SYMBOL_PREFIX@snd_ump_block_info_set_*;
@SYMBOL_PREFIX@snd_ump_packet_length;
#endif
} ALSA_1.2.10;

View file

@ -1,11 +0,0 @@
EXTRA_LTLIBRARIES = libalisp.la
EXTRA_DIST = alisp_snd.c
libalisp_la_SOURCES = alisp.c
noinst_HEADERS = alisp_local.h
all: libalisp.la
AM_CPPFLAGS=-I$(top_srcdir)/include

File diff suppressed because it is too large Load diff

View file

@ -1,151 +0,0 @@
/*
* ALSA lisp implementation
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
* Based on work of Sandro Sigala (slisp-1.2)
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "list.h"
enum alisp_tokens {
ALISP_IDENTIFIER,
ALISP_INTEGER,
ALISP_FLOAT,
ALISP_FLOATE,
ALISP_STRING
};
enum alisp_objects {
ALISP_OBJ_INTEGER,
ALISP_OBJ_FLOAT,
ALISP_OBJ_IDENTIFIER,
ALISP_OBJ_STRING,
ALISP_OBJ_POINTER,
ALISP_OBJ_CONS,
ALISP_OBJ_LAST_SEARCH = ALISP_OBJ_CONS,
ALISP_OBJ_NIL,
ALISP_OBJ_T,
};
struct alisp_object;
#define ALISP_TYPE_MASK 0xf0000000
#define ALISP_TYPE_SHIFT 28
#define ALISP_REFS_MASK 0x0fffffff
#define ALISP_REFS_SHIFT 0
#define ALISP_MAX_REFS (ALISP_REFS_MASK>>ALISP_REFS_SHIFT)
#define ALISP_MAX_REFS_LIMIT ((ALISP_MAX_REFS + 1) / 2)
struct alisp_object {
struct list_head list;
unsigned int type_refs; /* type and count of references */
union {
char *s;
long i;
double f;
const void *ptr;
struct {
struct alisp_object *car;
struct alisp_object *cdr;
} c;
} value;
};
static inline enum alisp_objects alisp_get_type(struct alisp_object *p)
{
return (p->type_refs >> ALISP_TYPE_SHIFT);
}
static inline void alisp_set_type(struct alisp_object *p, enum alisp_objects type)
{
p->type_refs &= ~ALISP_TYPE_MASK;
p->type_refs |= (unsigned int)type << ALISP_TYPE_SHIFT;
}
static inline int alisp_compare_type(struct alisp_object *p, enum alisp_objects type)
{
return ((unsigned int)type << ALISP_TYPE_SHIFT) ==
(p->type_refs & ALISP_TYPE_MASK);
}
static inline void alisp_set_refs(struct alisp_object *p, unsigned int refs)
{
p->type_refs &= ~ALISP_REFS_MASK;
p->type_refs |= refs & ALISP_REFS_MASK;
}
static inline unsigned int alisp_get_refs(struct alisp_object *p)
{
return p->type_refs & ALISP_REFS_MASK;
}
static inline unsigned int alisp_inc_refs(struct alisp_object *p)
{
unsigned r = alisp_get_refs(p) + 1;
alisp_set_refs(p, r);
return r;
}
static inline unsigned int alisp_dec_refs(struct alisp_object *p)
{
unsigned r = alisp_get_refs(p) - 1;
alisp_set_refs(p, r);
return r;
}
struct alisp_object_pair {
struct list_head list;
const char *name;
struct alisp_object *value;
};
#define ALISP_LEX_BUF_MAX 16
#define ALISP_OBJ_PAIR_HASH_SHIFT 4
#define ALISP_OBJ_PAIR_HASH_SIZE (1<<ALISP_OBJ_PAIR_HASH_SHIFT)
#define ALISP_OBJ_PAIR_HASH_MASK (ALISP_OBJ_PAIR_HASH_SIZE-1)
#define ALISP_FREE_OBJ_POOL 512 /* free objects above this pool */
struct alisp_instance {
int verbose: 1,
warning: 1,
debug: 1;
/* i/o */
snd_input_t *in;
snd_output_t *out;
snd_output_t *eout; /* error output */
snd_output_t *vout; /* verbose output */
snd_output_t *wout; /* warning output */
snd_output_t *dout; /* debug output */
/* lexer */
int charno;
int lineno;
int lex_buf[ALISP_LEX_BUF_MAX];
int *lex_bufp;
char *token_buffer;
int token_buffer_max;
int thistoken;
/* object allocator / storage */
long free_objs;
long used_objs;
long max_objs;
struct list_head free_objs_list;
struct list_head used_objs_list[ALISP_OBJ_PAIR_HASH_SIZE][ALISP_OBJ_LAST_SEARCH + 1];
/* set object */
struct list_head setobjs_list[ALISP_OBJ_PAIR_HASH_SIZE];
};

View file

@ -1,936 +0,0 @@
/*
* ALSA lisp implementation - sound related commands
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "../control/control_local.h"
struct acall_table {
const char *name;
struct alisp_object * (*func) (struct alisp_instance *instance, struct acall_table * item, struct alisp_object * args);
void * xfunc;
const char *prefix;
};
/*
* helper functions
*/
static inline int get_integer(struct alisp_object * obj)
{
if (alisp_compare_type(obj, ALISP_OBJ_INTEGER))
return obj->value.i;
return 0;
}
static inline const void *get_pointer(struct alisp_object * obj)
{
if (alisp_compare_type(obj, ALISP_OBJ_POINTER))
return obj->value.ptr;
return NULL;
}
static const char *get_string(struct alisp_object * obj, const char * deflt)
{
if (obj == &alsa_lisp_t)
return "true";
if (alisp_compare_type(obj, ALISP_OBJ_STRING) ||
alisp_compare_type(obj, ALISP_OBJ_IDENTIFIER))
return obj->value.s;
return deflt;
}
struct flags {
const char *key;
unsigned int mask;
};
static unsigned int get_flags(struct alisp_instance * instance,
struct alisp_object * obj,
const struct flags * flags,
unsigned int deflt)
{
const char *key;
int invert;
unsigned int result;
const struct flags *ptr;
struct alisp_object *n;
if (obj == &alsa_lisp_nil)
return deflt;
result = deflt;
do {
key = get_string(obj, NULL);
if (key) {
invert = key[0] == '!';
key += invert;
ptr = flags;
while (ptr->key) {
if (!strcmp(ptr->key, key)) {
if (invert)
result &= ~ptr->mask;
else
result |= ptr->mask;
break;
}
ptr++;
}
}
delete_tree(instance, car(obj));
obj = cdr(n = obj);
delete_object(instance, n);
} while (obj != &alsa_lisp_nil);
return result;
}
static const void *get_ptr(struct alisp_instance * instance,
struct alisp_object * obj,
const char *_ptr_id)
{
const char *ptr_id;
const void *ptr;
ptr_id = get_string(car(obj), NULL);
if (ptr_id == NULL) {
delete_tree(instance, obj);
return NULL;
}
if (strcmp(ptr_id, _ptr_id)) {
delete_tree(instance, obj);
return NULL;
}
ptr = get_pointer(cdr(obj));
delete_tree(instance, obj);
return ptr;
}
static struct alisp_object * new_lexpr(struct alisp_instance * instance, int err)
{
struct alisp_object * lexpr;
lexpr = new_object(instance, ALISP_OBJ_CONS);
if (lexpr == NULL)
return NULL;
lexpr->value.c.car = new_integer(instance, err);
if (lexpr->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
if (lexpr->value.c.cdr == NULL) {
delete_object(instance, lexpr->value.c.car);
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * add_cons(struct alisp_instance * instance,
struct alisp_object *lexpr,
int cdr, const char *id,
struct alisp_object *obj)
{
struct alisp_object * p1, * p2;
if (lexpr == NULL || obj == NULL) {
delete_tree(instance, obj);
return NULL;
}
if (cdr) {
p1 = lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
} else {
p1 = lexpr->value.c.car = new_object(instance, ALISP_OBJ_CONS);
}
lexpr = p1;
if (p1 == NULL) {
delete_tree(instance, obj);
return NULL;
}
p1->value.c.car = new_object(instance, ALISP_OBJ_CONS);
if ((p2 = p1->value.c.car) == NULL)
goto __err;
p2->value.c.car = new_string(instance, id);
if (p2->value.c.car == NULL) {
__err:
if (cdr)
lexpr->value.c.cdr = NULL;
else
lexpr->value.c.car = NULL;
delete_tree(instance, p1);
delete_tree(instance, obj);
return NULL;
}
p2->value.c.cdr = obj;
return lexpr;
}
static struct alisp_object * add_cons2(struct alisp_instance * instance,
struct alisp_object *lexpr,
int cdr, struct alisp_object *obj)
{
struct alisp_object * p1;
if (lexpr == NULL || obj == NULL) {
delete_tree(instance, obj);
return NULL;
}
if (cdr) {
p1 = lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
} else {
p1 = lexpr->value.c.car = new_object(instance, ALISP_OBJ_CONS);
}
lexpr = p1;
if (p1 == NULL) {
delete_tree(instance, obj);
return NULL;
}
p1->value.c.car = obj;
return lexpr;
}
static struct alisp_object * new_result1(struct alisp_instance * instance,
int err, const char *ptr_id, void *ptr)
{
struct alisp_object * lexpr, * p1;
if (err < 0)
ptr = NULL;
lexpr = new_object(instance, ALISP_OBJ_CONS);
if (lexpr == NULL)
return NULL;
lexpr->value.c.car = new_integer(instance, err);
if (lexpr->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
p1 = add_cons(instance, lexpr, 1, ptr_id, new_pointer(instance, ptr));
if (p1 == NULL) {
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * new_result2(struct alisp_instance * instance,
int err, int val)
{
struct alisp_object * lexpr, * p1;
if (err < 0)
val = 0;
lexpr = new_lexpr(instance, err);
if (lexpr == NULL)
return NULL;
p1 = lexpr->value.c.cdr;
p1->value.c.car = new_integer(instance, val);
if (p1->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * new_result3(struct alisp_instance * instance,
int err, const char *str)
{
struct alisp_object * lexpr, * p1;
if (err < 0)
str = "";
lexpr = new_lexpr(instance, err);
if (lexpr == NULL)
return NULL;
p1 = lexpr->value.c.cdr;
p1->value.c.car = new_string(instance, str);
if (p1->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
/*
* macros
*/
/*
* HCTL functions
*/
typedef int (*snd_int_pp_strp_int_t)(void **rctl, const char *name, int mode);
typedef int (*snd_int_pp_p_t)(void **rctl, void *handle);
typedef int (*snd_int_p_t)(void *rctl);
typedef char * (*snd_str_p_t)(void *rctl);
typedef int (*snd_int_intp_t)(int *val);
typedef int (*snd_int_str_t)(const char *str);
typedef int (*snd_int_int_strp_t)(int val, char **str);
typedef void *(*snd_p_p_t)(void *handle);
static struct alisp_object * FA_int_pp_strp_int(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
const char *name;
int err, mode;
void *handle;
struct alisp_object *p1, *p2;
static const struct flags flags[] = {
{ "nonblock", SND_CTL_NONBLOCK },
{ "async", SND_CTL_ASYNC },
{ "readonly", SND_CTL_READONLY },
{ NULL, 0 }
};
name = get_string(p1 = eval(instance, car(args)), NULL);
if (name == NULL)
return &alsa_lisp_nil;
mode = get_flags(instance, p2 = eval(instance, car(cdr(args))), flags, 0);
delete_tree(instance, cdr(cdr(args)));
delete_object(instance, cdr(args));
delete_object(instance, args);
delete_tree(instance, p2);
err = ((snd_int_pp_strp_int_t)item->xfunc)(&handle, name, mode);
delete_tree(instance, p1);
return new_result1(instance, err, item->prefix, handle);
}
static struct alisp_object * FA_int_pp_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int err;
void *handle;
const char *prefix1;
struct alisp_object *p1;
if (item->xfunc == &snd_hctl_open_ctl)
prefix1 = "ctl";
else {
delete_tree(instance, args);
return &alsa_lisp_nil;
}
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, prefix1);
if (handle == NULL)
return &alsa_lisp_nil;
err = ((snd_int_pp_p_t)item->xfunc)(&handle, handle);
return new_result1(instance, err, item->prefix, handle);
}
static struct alisp_object * FA_p_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
void *handle;
const char *prefix1;
struct alisp_object * p1;
if (item->xfunc == &snd_hctl_first_elem ||
item->xfunc == &snd_hctl_last_elem ||
item->xfunc == &snd_hctl_elem_next ||
item->xfunc == &snd_hctl_elem_prev)
prefix1 = "hctl_elem";
else if (item->xfunc == &snd_hctl_ctl)
prefix1 = "ctl";
else {
delete_tree(instance, args);
return &alsa_lisp_nil;
}
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
handle = ((snd_p_p_t)item->xfunc)(handle);
return new_cons_pointer(instance, prefix1, handle);
}
static struct alisp_object * FA_int_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
void *handle;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
return new_integer(instance, ((snd_int_p_t)item->xfunc)(handle));
}
static struct alisp_object * FA_str_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
void *handle;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
return new_string(instance, ((snd_str_p_t)item->xfunc)(handle));
}
static struct alisp_object * FA_int_intp(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int val, err;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
val = p1->value.i;
delete_tree(instance, p1);
err = ((snd_int_intp_t)item->xfunc)(&val);
return new_result2(instance, err, val);
}
static struct alisp_object * FA_int_str(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int err;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_STRING) &&
!alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER)) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
err = ((snd_int_str_t)item->xfunc)(p1->value.s);
delete_tree(instance, p1);
return new_integer(instance, err);
}
static struct alisp_object * FA_int_int_strp(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int err;
char *str;
long val;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
val = p1->value.i;
delete_tree(instance, p1);
err = ((snd_int_int_strp_t)item->xfunc)(val, &str);
return new_result3(instance, err, str);
}
static struct alisp_object * FA_card_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_ctl_t *handle;
struct alisp_object * lexpr, * p1;
snd_ctl_card_info_t info = {0};
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_ctl_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_ctl_card_info(handle, &info);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
p1 = add_cons(instance, lexpr->value.c.cdr, 0, "id", new_string(instance, snd_ctl_card_info_get_id(&info)));
p1 = add_cons(instance, p1, 1, "driver", new_string(instance, snd_ctl_card_info_get_driver(&info)));
p1 = add_cons(instance, p1, 1, "name", new_string(instance, snd_ctl_card_info_get_name(&info)));
p1 = add_cons(instance, p1, 1, "longname", new_string(instance, snd_ctl_card_info_get_longname(&info)));
p1 = add_cons(instance, p1, 1, "mixername", new_string(instance, snd_ctl_card_info_get_mixername(&info)));
p1 = add_cons(instance, p1, 1, "components", new_string(instance, snd_ctl_card_info_get_components(&info)));
if (p1 == NULL) {
delete_tree(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * create_ctl_elem_id(struct alisp_instance * instance, snd_ctl_elem_id_t * id, struct alisp_object * cons)
{
cons = add_cons(instance, cons, 0, "numid", new_integer(instance, snd_ctl_elem_id_get_numid(id)));
cons = add_cons(instance, cons, 1, "iface", new_string(instance, snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(id))));
cons = add_cons(instance, cons, 1, "dev", new_integer(instance, snd_ctl_elem_id_get_device(id)));
cons = add_cons(instance, cons, 1, "subdev", new_integer(instance, snd_ctl_elem_id_get_subdevice(id)));
cons = add_cons(instance, cons, 1, "name", new_string(instance, snd_ctl_elem_id_get_name(id)));
cons = add_cons(instance, cons, 1, "index", new_integer(instance, snd_ctl_elem_id_get_index(id)));
return cons;
}
static int parse_ctl_elem_id(struct alisp_instance * instance,
struct alisp_object * cons,
snd_ctl_elem_id_t * id)
{
struct alisp_object *p1;
const char *xid;
if (cons == NULL)
return -ENOMEM;
snd_ctl_elem_id_clear(id);
id->numid = 0;
do {
p1 = car(cons);
if (alisp_compare_type(p1, ALISP_OBJ_CONS)) {
xid = get_string(p1->value.c.car, NULL);
if (xid == NULL) {
/* noop */
} else if (!strcmp(xid, "numid")) {
snd_ctl_elem_id_set_numid(id, get_integer(p1->value.c.cdr));
} else if (!strcmp(xid, "iface")) {
snd_ctl_elem_id_set_interface(id, snd_config_get_ctl_iface_ascii(get_string(p1->value.c.cdr, "0")));
} else if (!strcmp(xid, "dev")) {
snd_ctl_elem_id_set_device(id, get_integer(p1->value.c.cdr));
} else if (!strcmp(xid, "subdev")) {
snd_ctl_elem_id_set_subdevice(id, get_integer(p1->value.c.cdr));
} else if (!strcmp(xid, "name")) {
snd_ctl_elem_id_set_name(id, get_string(p1->value.c.cdr, "?"));
} else if (!strcmp(xid, "index")) {
snd_ctl_elem_id_set_index(id, get_integer(p1->value.c.cdr));
}
}
delete_tree(instance, p1);
cons = cdr(p1 = cons);
delete_object(instance, p1);
} while (cons != &alsa_lisp_nil);
return 0;
}
static struct alisp_object * FA_hctl_find_elem(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_t *handle;
snd_ctl_elem_id_t id = {0};
struct alisp_object *p1;
handle = (snd_hctl_t *)get_ptr(instance, car(args), item->prefix);
if (handle == NULL) {
delete_tree(instance, cdr(args));
delete_object(instance, args);
return &alsa_lisp_nil;
}
p1 = car(cdr(args));
delete_tree(instance, cdr(cdr(args)));
delete_object(instance, cdr(args));
delete_object(instance, args);
if (parse_ctl_elem_id(instance, eval(instance, p1), &id) < 0)
return &alsa_lisp_nil;
return new_cons_pointer(instance, "hctl_elem", snd_hctl_find_elem(handle, &id));
}
static struct alisp_object * FA_hctl_elem_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_elem_t *handle;
struct alisp_object * lexpr, * p1, * p2;
snd_ctl_elem_info_t info = {0};
snd_ctl_elem_id_t id = {0};
snd_ctl_elem_type_t type;
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_hctl_elem_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_hctl_elem_info(handle, &info);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
type = snd_ctl_elem_info_get_type(&info);
p1 = add_cons(instance, lexpr->value.c.cdr, 0, "id", p2 = new_object(instance, ALISP_OBJ_CONS));
snd_ctl_elem_info_get_id(&info, &id);
if (create_ctl_elem_id(instance, &id, p2) == NULL) {
delete_tree(instance, lexpr);
return NULL;
}
p1 = add_cons(instance, p1, 1, "type", new_string(instance, snd_ctl_elem_type_name(type)));
p1 = add_cons(instance, p1, 1, "readable", new_integer(instance, snd_ctl_elem_info_is_readable(&info)));
p1 = add_cons(instance, p1, 1, "writable", new_integer(instance, snd_ctl_elem_info_is_writable(&info)));
p1 = add_cons(instance, p1, 1, "volatile", new_integer(instance, snd_ctl_elem_info_is_volatile(&info)));
p1 = add_cons(instance, p1, 1, "inactive", new_integer(instance, snd_ctl_elem_info_is_inactive(&info)));
p1 = add_cons(instance, p1, 1, "locked", new_integer(instance, snd_ctl_elem_info_is_locked(&info)));
p1 = add_cons(instance, p1, 1, "isowner", new_integer(instance, snd_ctl_elem_info_is_owner(&info)));
p1 = add_cons(instance, p1, 1, "owner", new_integer(instance, snd_ctl_elem_info_get_owner(&info)));
p1 = add_cons(instance, p1, 1, "count", new_integer(instance, snd_ctl_elem_info_get_count(&info)));
err = INTERNAL(snd_ctl_elem_info_get_dimensions)(&info);
if (err > 0) {
int idx;
p1 = add_cons(instance, p1, 1, "dimensions", p2 = new_object(instance, ALISP_OBJ_CONS));
for (idx = 0; idx < err; idx++)
p2 = add_cons2(instance, p2, idx > 0, new_integer(instance, INTERNAL(snd_ctl_elem_info_get_dimension)(&info, idx)));
}
switch (type) {
case SND_CTL_ELEM_TYPE_ENUMERATED: {
unsigned int items, item;
items = snd_ctl_elem_info_get_items(&info);
p1 = add_cons(instance, p1, 1, "items", p2 = new_object(instance, ALISP_OBJ_CONS));
for (item = 0; item < items; item++) {
snd_ctl_elem_info_set_item(&info, item);
err = snd_hctl_elem_info(handle, &info);
if (err < 0) {
p2 = add_cons2(instance, p2, item, &alsa_lisp_nil);
} else {
p2 = add_cons2(instance, p2, item, new_string(instance, snd_ctl_elem_info_get_item_name(&info)));
}
}
break;
}
case SND_CTL_ELEM_TYPE_INTEGER:
p1 = add_cons(instance, p1, 1, "min", new_integer(instance, snd_ctl_elem_info_get_min(&info)));
p1 = add_cons(instance, p1, 1, "max", new_integer(instance, snd_ctl_elem_info_get_max(&info)));
p1 = add_cons(instance, p1, 1, "step", new_integer(instance, snd_ctl_elem_info_get_step(&info)));
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
p1 = add_cons(instance, p1, 1, "min64", new_float(instance, snd_ctl_elem_info_get_min64(&info)));
p1 = add_cons(instance, p1, 1, "max64", new_float(instance, snd_ctl_elem_info_get_max64(&info)));
p1 = add_cons(instance, p1, 1, "step64", new_float(instance, snd_ctl_elem_info_get_step64(&info)));
break;
default:
break;
}
if (p1 == NULL) {
delete_tree(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * FA_hctl_elem_read(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_elem_t *handle;
struct alisp_object * lexpr, * p1 = NULL, * obj;
snd_ctl_elem_info_t info = {0};
snd_ctl_elem_value_t value = {0};
snd_ctl_elem_type_t type;
unsigned int idx, count;
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_hctl_elem_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_hctl_elem_info(handle, &info);
if (err >= 0)
err = snd_hctl_elem_read(handle, &value);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
type = snd_ctl_elem_info_get_type(&info);
count = snd_ctl_elem_info_get_count(&info);
if (type == SND_CTL_ELEM_TYPE_IEC958) {
count = sizeof(snd_aes_iec958_t);
type = SND_CTL_ELEM_TYPE_BYTES;
}
for (idx = 0; idx < count; idx++) {
switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
obj = new_integer(instance, snd_ctl_elem_value_get_boolean(&value, idx));
break;
case SND_CTL_ELEM_TYPE_INTEGER:
obj = new_integer(instance, snd_ctl_elem_value_get_integer(&value, idx));
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
obj = new_integer(instance, snd_ctl_elem_value_get_integer64(&value, idx));
break;
case SND_CTL_ELEM_TYPE_ENUMERATED:
obj = new_integer(instance, snd_ctl_elem_value_get_enumerated(&value, idx));
break;
case SND_CTL_ELEM_TYPE_BYTES:
obj = new_integer(instance, snd_ctl_elem_value_get_byte(&value, idx));
break;
default:
obj = NULL;
break;
}
if (idx == 0) {
p1 = add_cons2(instance, lexpr->value.c.cdr, 0, obj);
} else {
p1 = add_cons2(instance, p1, 1, obj);
}
}
if (p1 == NULL) {
delete_tree(instance, lexpr);
return &alsa_lisp_nil;
}
return lexpr;
}
static struct alisp_object * FA_hctl_elem_write(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_elem_t *handle;
struct alisp_object * p1 = NULL, * obj;
snd_ctl_elem_info_t info = {0};
snd_ctl_elem_value_t value = {0};
snd_ctl_elem_type_t type;
unsigned int idx, count;
int err;
p1 = car(cdr(args));
obj = eval(instance, car(args));
delete_tree(instance, cdr(cdr(args)));
delete_object(instance, cdr(args));
delete_object(instance, args);
handle = (snd_hctl_elem_t *)get_ptr(instance, obj, item->prefix);
if (handle == NULL) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
err = snd_hctl_elem_info(handle, &info);
if (err < 0) {
delete_tree(instance, p1);
return new_integer(instance, err);
}
type = snd_ctl_elem_info_get_type(&info);
count = snd_ctl_elem_info_get_count(&info);
if (type == SND_CTL_ELEM_TYPE_IEC958) {
count = sizeof(snd_aes_iec958_t);
type = SND_CTL_ELEM_TYPE_BYTES;
}
idx = -1;
do {
if (++idx >= count) {
delete_tree(instance, p1);
break;
}
obj = car(p1);
switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
snd_ctl_elem_value_set_boolean(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_INTEGER:
snd_ctl_elem_value_set_integer(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
snd_ctl_elem_value_set_integer64(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_ENUMERATED:
snd_ctl_elem_value_set_enumerated(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_BYTES:
snd_ctl_elem_value_set_byte(&value, idx, get_integer(obj));
break;
default:
break;
}
delete_tree(instance, obj);
p1 = cdr(obj = p1);
delete_object(instance, obj);
} while (p1 != &alsa_lisp_nil);
err = snd_hctl_elem_write(handle, &value);
return new_integer(instance, err);
}
static struct alisp_object * FA_pcm_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_pcm_t *handle;
struct alisp_object * lexpr, * p1;
snd_pcm_info_t info = {0};
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_pcm_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_pcm_info(handle, &info);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
p1 = add_cons(instance, lexpr->value.c.cdr, 0, "card", new_integer(instance, snd_pcm_info_get_card(&info)));
p1 = add_cons(instance, p1, 1, "device", new_integer(instance, snd_pcm_info_get_device(&info)));
p1 = add_cons(instance, p1, 1, "subdevice", new_integer(instance, snd_pcm_info_get_subdevice(&info)));
p1 = add_cons(instance, p1, 1, "id", new_string(instance, snd_pcm_info_get_id(&info)));
p1 = add_cons(instance, p1, 1, "name", new_string(instance, snd_pcm_info_get_name(&info)));
p1 = add_cons(instance, p1, 1, "subdevice_name", new_string(instance, snd_pcm_info_get_subdevice_name(&info)));
p1 = add_cons(instance, p1, 1, "class", new_integer(instance, snd_pcm_info_get_class(&info)));
p1 = add_cons(instance, p1, 1, "subclass", new_integer(instance, snd_pcm_info_get_subclass(&info)));
p1 = add_cons(instance, p1, 1, "subdevices_count", new_integer(instance, snd_pcm_info_get_subdevices_count(&info)));
p1 = add_cons(instance, p1, 1, "subdevices_avail", new_integer(instance, snd_pcm_info_get_subdevices_avail(&info)));
//p1 = add_cons(instance, p1, 1, "sync", new_string(instance, snd_pcm_info_get_sync(&info)));
return lexpr;
}
/*
* main code
*/
static const struct acall_table acall_table[] = {
{ "card_get_index", &FA_int_str, (void *)snd_card_get_index, NULL },
{ "card_get_longname", &FA_int_int_strp, (void *)snd_card_get_longname, NULL },
{ "card_get_name", &FA_int_int_strp, (void *)snd_card_get_name, NULL },
{ "card_next", &FA_int_intp, (void *)&snd_card_next, NULL },
{ "ctl_card_info", &FA_card_info, NULL, "ctl" },
{ "ctl_close", &FA_int_p, (void *)&snd_ctl_close, "ctl" },
{ "ctl_open", &FA_int_pp_strp_int, (void *)&snd_ctl_open, "ctl" },
{ "hctl_close", &FA_int_p, (void *)&snd_hctl_close, "hctl" },
{ "hctl_ctl", &FA_p_p, (void *)&snd_hctl_ctl, "hctl" },
{ "hctl_elem_info", &FA_hctl_elem_info, (void *)&snd_hctl_elem_info, "hctl_elem" },
{ "hctl_elem_next", &FA_p_p, (void *)&snd_hctl_elem_next, "hctl_elem" },
{ "hctl_elem_prev", &FA_p_p, (void *)&snd_hctl_elem_prev, "hctl_elem" },
{ "hctl_elem_read", &FA_hctl_elem_read, (void *)&snd_hctl_elem_read, "hctl_elem" },
{ "hctl_elem_write", &FA_hctl_elem_write, (void *)&snd_hctl_elem_write, "hctl_elem" },
{ "hctl_find_elem", &FA_hctl_find_elem, (void *)&snd_hctl_find_elem, "hctl" },
{ "hctl_first_elem", &FA_p_p, (void *)&snd_hctl_first_elem, "hctl" },
{ "hctl_free", &FA_int_p, (void *)&snd_hctl_free, "hctl" },
{ "hctl_last_elem", &FA_p_p, (void *)&snd_hctl_last_elem, "hctl" },
{ "hctl_load", &FA_int_p, (void *)&snd_hctl_load, "hctl" },
{ "hctl_open", &FA_int_pp_strp_int, (void *)&snd_hctl_open, "hctl" },
{ "hctl_open_ctl", &FA_int_pp_p, (void *)&snd_hctl_open_ctl, "hctl" },
{ "pcm_info", &FA_pcm_info, NULL, "pcm" },
{ "pcm_name", &FA_str_p, (void *)&snd_pcm_name, "pcm" },
};
static int acall_compar(const void *p1, const void *p2)
{
return strcmp(((struct acall_table *)p1)->name,
((struct acall_table *)p2)->name);
}
static struct alisp_object * F_acall(struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object * p1, *p2;
struct acall_table key, *item;
p1 = eval(instance, car(args));
p2 = cdr(args);
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER) &&
!alisp_compare_type(p1, ALISP_OBJ_STRING)) {
delete_tree(instance, p2);
return &alsa_lisp_nil;
}
key.name = p1->value.s;
if ((item = bsearch(&key, acall_table,
sizeof acall_table / sizeof acall_table[0],
sizeof acall_table[0], acall_compar)) != NULL) {
delete_tree(instance, p1);
return item->func(instance, item, p2);
}
delete_tree(instance, p1);
delete_tree(instance, p2);
lisp_warn(instance, "acall function %s' is undefined", p1->value.s);
return &alsa_lisp_nil;
}
static struct alisp_object * F_ahandle(struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object *p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
args = car(cdr(p1));
delete_tree(instance, cdr(cdr(p1)));
delete_object(instance, cdr(p1));
delete_tree(instance, car(p1));
delete_object(instance, p1);
return args;
}
static struct alisp_object * F_aerror(struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object *p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
args = car(p1);
if (args == &alsa_lisp_nil) {
delete_tree(instance, p1);
return new_integer(instance, SND_ERROR_ALISP_NIL);
} else {
delete_tree(instance, cdr(p1));
delete_object(instance, p1);
}
return args;
}
static int common_error(snd_output_t **rout, struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object * p = args, * p1;
snd_output_t *out;
int err;
err = snd_output_buffer_open(&out);
if (err < 0) {
delete_tree(instance, args);
return err;
}
do {
p1 = eval(instance, car(p));
if (alisp_compare_type(p1, ALISP_OBJ_STRING))
snd_output_printf(out, "%s", p1->value.s);
else
princ_object(out, p1);
delete_tree(instance, p1);
p = cdr(p1 = p);
delete_object(instance, p1);
} while (p != &alsa_lisp_nil);
*rout = out;
return 0;
}
static struct alisp_object * F_snderr(struct alisp_instance *instance, struct alisp_object * args)
{
snd_output_t *out;
char *str;
if (common_error(&out, instance, args) < 0)
return &alsa_lisp_nil;
snd_output_buffer_string(out, &str);
SNDERR(str);
snd_output_close(out);
return &alsa_lisp_t;
}
static struct alisp_object * F_syserr(struct alisp_instance *instance, struct alisp_object * args)
{
snd_output_t *out;
char *str;
if (common_error(&out, instance, args) < 0)
return &alsa_lisp_nil;
snd_output_buffer_string(out, &str);
SYSERR(str);
snd_output_close(out);
return &alsa_lisp_t;
}
static const struct intrinsic snd_intrinsics[] = {
{ "Acall", F_acall },
{ "Aerror", F_aerror },
{ "Ahandle", F_ahandle },
{ "Aresult", F_ahandle },
{ "Asnderr", F_snderr },
{ "Asyserr", F_syserr }
};

View file

@ -29,7 +29,9 @@
#include <signal.h>
static struct sigaction previous_action;
#ifndef DOC_HIDDEN
#define MAX_SIG_FUNCTION_CODE 10 /* i.e. SIG_DFL SIG_IGN SIG_HOLD et al */
#endif /* DOC_HIDDEN */
#ifdef SND_ASYNC_RT_SIGNAL
/** async signal number */
@ -54,6 +56,15 @@ static LIST_HEAD(snd_async_handlers);
static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
{
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
/* siginfo_t does not have si_fd */
struct list_head *i;
list_for_each(i, &snd_async_handlers) {
snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
if (h->callback)
h->callback(h);
}
#else
int fd;
struct list_head *i;
//assert(siginfo->si_code == SI_SIGIO);
@ -66,6 +77,7 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo
if (h->fd == fd && h->callback)
h->callback(h);
}
#endif
}
/**
@ -137,12 +149,44 @@ int snd_async_add_handler(snd_async_handler_t **handler, int fd,
*/
int snd_async_del_handler(snd_async_handler_t *handler)
{
int err = 0;
int was_empty = list_empty(&snd_async_handlers);
int err = 0, err2 = 0;
int was_empty;
assert(handler);
if (handler->type != SND_ASYNC_HANDLER_GENERIC) {
struct list_head *alist;
switch (handler->type) {
#ifdef BUILD_PCM
case SND_ASYNC_HANDLER_PCM:
alist = &handler->u.pcm->async_handlers;
break;
#endif
case SND_ASYNC_HANDLER_CTL:
alist = &handler->u.ctl->async_handlers;
break;
default:
assert(0);
}
if (!list_empty(alist))
list_del(&handler->hlist);
if (!list_empty(alist))
goto _glist;
switch (handler->type) {
#ifdef BUILD_PCM
case SND_ASYNC_HANDLER_PCM:
err2 = snd_pcm_async(handler->u.pcm, -1, 1);
break;
#endif
case SND_ASYNC_HANDLER_CTL:
err2 = snd_ctl_async(handler->u.ctl, -1, 1);
break;
default:
assert(0);
}
}
_glist:
was_empty = list_empty(&snd_async_handlers);
list_del(&handler->glist);
if (!was_empty
&& list_empty(&snd_async_handlers)) {
if (!was_empty && list_empty(&snd_async_handlers)) {
err = sigaction(snd_async_signo, &previous_action, NULL);
if (err < 0) {
SYSERR("sigaction");
@ -150,27 +194,8 @@ int snd_async_del_handler(snd_async_handler_t *handler)
}
memset(&previous_action, 0, sizeof(previous_action));
}
if (handler->type == SND_ASYNC_HANDLER_GENERIC)
goto _end;
if (!list_empty(&handler->hlist))
list_del(&handler->hlist);
if (!list_empty(&handler->hlist))
goto _end;
switch (handler->type) {
#ifdef BUILD_PCM
case SND_ASYNC_HANDLER_PCM:
err = snd_pcm_async(handler->u.pcm, -1, 1);
break;
#endif
case SND_ASYNC_HANDLER_CTL:
err = snd_ctl_async(handler->u.ctl, -1, 1);
break;
default:
assert(0);
}
_end:
free(handler);
return err;
return err ? err : err2;
}
/**

View file

@ -527,7 +527,7 @@ static inline void snd_config_unlock(void) { }
#endif
/*
* Add a diretory to the paths to search included files.
* Add a directory to the paths to search included files.
* param fd - File object that owns these paths to search files included by it.
* param dir - Path of the directory to add. Allocated externally and need to
* be freed manually later.
@ -584,6 +584,8 @@ static void free_include_paths(struct filedesc *fd)
}
}
#endif /* DOC_HIDDEN */
/**
* \brief Returns the default top-level config directory
* \return The top-level config directory path string
@ -605,6 +607,8 @@ const char *snd_config_topdir(void)
return topdir;
}
#ifndef DOC_HIDDEN
static char *_snd_config_path(const char *name)
{
const char *root = snd_config_topdir();
@ -814,11 +818,12 @@ static int get_char_skip_comments(input_t *input)
closedir(dirp);
err = add_include_path(input->current, str);
free(str);
if (err < 0) {
SNDERR("Cannot add search dir %s", str);
free(str);
return err;
}
free(str);
continue;
}
@ -1263,13 +1268,13 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
snd_config_t *n = NULL;
if (!skip) {
snd_config_t *g;
char static_id[12];
while (1) {
snprintf(static_id, sizeof(static_id), "%i", *idx);
if (_snd_config_search(parent, static_id, -1, &g) == 0) {
if (_snd_config_search(parent, static_id, -1, &n) == 0) {
if (override) {
snd_config_delete(n);
n = NULL;
} else {
/* merge */
(*idx)++;
@ -1699,7 +1704,7 @@ static int _snd_config_save_children(snd_config_t *config, snd_output_t *out,
}
return 0;
}
#endif
#endif /* DOC_HIDDEN */
/**
@ -1724,7 +1729,7 @@ static int _snd_config_save_children(snd_config_t *config, snd_output_t *out,
*/
int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
{
assert(dst && src);
assert(dst && src && src != dst);
if (dst->type == SND_CONFIG_TYPE_COMPOUND) {
int err = snd_config_delete_compound_members(dst);
if (err < 0)
@ -1743,6 +1748,8 @@ int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
free(dst->id);
if (dst->type == SND_CONFIG_TYPE_STRING)
free(dst->u.string);
if (src->parent) /* like snd_config_remove */
list_del(&src->list);
dst->id = src->id;
dst->type = src->type;
dst->u = src->u;
@ -2054,7 +2061,7 @@ int snd_config_load(snd_config_t *config, snd_input_t *in)
/**
* \brief Loads a configuration tree from a string.
* \param[out] The function puts the handle to the configuration
* \param[out] config The function puts the handle to the configuration
* node loaded from the file(s) at the address specified
* by \a config.
* \param[in] s String with the ASCII configuration
@ -2259,9 +2266,9 @@ static int _snd_config_array_merge(snd_config_t *dst, snd_config_t *src, int ind
/**
* \brief In-place merge of two config handles
* \param dst[out] Config handle for the merged contents
* \param src[in] Config handle to merge into dst (may be NULL)
* \param override[in] Override flag
* \param[out] dst Config handle for the merged contents
* \param[in] src Config handle to merge into dst (may be NULL)
* \param[in] override Override flag
* \return Zero if successful, otherwise a negative error code.
*
* This function merges all fields from the source compound to the destination compound.
@ -2305,7 +2312,6 @@ int snd_config_merge(snd_config_t *dst, snd_config_t *src, int override)
if (override ||
sn->type != SND_CONFIG_TYPE_COMPOUND ||
dn->type != SND_CONFIG_TYPE_COMPOUND) {
snd_config_remove(sn);
err = snd_config_substitute(dn, sn);
if (err < 0)
return err;
@ -2872,6 +2878,26 @@ int snd_config_imake_string(snd_config_t **config, const char *id, const char *v
return 0;
}
/**
* \brief Creates a string configuration node with the given initial value.
* \param[out] config The function puts the handle to the new node at
* the address specified by \a config.
* \param[in] id The id of the new node.
* \param[in] value The initial value of the new node. May be \c NULL.
* \return Zero if successful, otherwise a negative error code.
*
* This function creates a new node of type #SND_CONFIG_TYPE_STRING. The node
* contains with a copy of the string \c value, replacing any character other
* than alphanumeric, space, or '-' with the character '_'.
*
* \par Errors:
* <dl>
* <dt>-ENOMEM<dd>Out of memory.
* </dl>
*
* \par Conforming to:
* LSB 3.2
*/
int snd_config_imake_safe_string(snd_config_t **config, const char *id, const char *value)
{
int err;
@ -3893,7 +3919,6 @@ int snd_config_search_alias_hooks(snd_config_t *config,
#define ALSA_CONFIG_PATH_VAR "ALSA_CONFIG_PATH"
/**
* \ingroup Config
* \brief Configuration top-level node (the global configuration).
*
* This variable contains a handle to the top-level configuration node,
@ -4115,7 +4140,14 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors)
if (!S_ISDIR(st.st_mode))
return config_file_open(root, fn);
#ifndef DOC_HIDDEN
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
#if defined(_GNU_SOURCE) && \
!defined(__NetBSD__) && \
!defined(__FreeBSD__) && \
!defined(__OpenBSD__) && \
!defined(__DragonFly__) && \
!defined(__sun) && \
!defined(__ANDROID__) && \
!defined(__OHOS__)
#define SORTFUNC versionsort64
#else
#define SORTFUNC alphasort64
@ -4294,7 +4326,7 @@ SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK);
int snd_determine_driver(int card, char **driver);
#endif
snd_config_t *_snd_config_hook_private_data(int card, const char *driver)
static snd_config_t *_snd_config_hook_private_data(int card, const char *driver)
{
snd_config_t *private_data, *v;
int err;
@ -5809,6 +5841,7 @@ static void _snd_config_end(void)
}
#endif
#ifndef DOC_HIDDEN
size_t page_size(void)
{
long s = sysconf(_SC_PAGE_SIZE);
@ -5844,3 +5877,4 @@ size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t
*offset = object_offset;
return r;
}
#endif /* DOC_HIDDEN */

View file

@ -1,9 +1,6 @@
SUBDIRS=cards ctl pcm
cfg_files = alsa.conf
if BUILD_ALISP
cfg_files += sndo-mixer.alisp
endif
if BUILD_MODULES
if BUILD_MIXER_MODULES
cfg_files += smixer.conf

View file

@ -26,14 +26,6 @@ Audigy.pcm.front.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -42,15 +34,6 @@ Audigy.pcm.front.0 {
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
]
}
}
@ -79,14 +62,6 @@ Audigy.pcm.rear.0 {
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
]
}
}
@ -115,14 +90,6 @@ Audigy.pcm.center_lfe.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -131,14 +98,6 @@ Audigy.pcm.center_lfe.0 {
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
]
}
}
@ -265,14 +224,6 @@ Audigy.pcm.iec958.0 {
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
# for compatibility with older drivers
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
name "IEC958 Optical Raw Playback Switch"
lock true
@ -287,14 +238,6 @@ Audigy.pcm.iec958.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -303,14 +246,6 @@ Audigy.pcm.iec958.0 {
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
name "Audigy Analog/Digital Output Jack"
lock true

View file

@ -26,14 +26,6 @@ Audigy2.pcm.front.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -42,14 +34,6 @@ Audigy2.pcm.front.0 {
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
]
}
@ -79,14 +63,6 @@ Audigy2.pcm.rear.0 {
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
]
}
}
@ -115,14 +91,6 @@ Audigy2.pcm.center_lfe.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -131,14 +99,6 @@ Audigy2.pcm.center_lfe.0 {
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
]
}
}
@ -167,14 +127,6 @@ Audigy2.pcm.side.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -183,14 +135,6 @@ Audigy2.pcm.side.0 {
optional true
value [ 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 ]
}
]
}
}
@ -374,13 +318,6 @@ Audigy2.pcm.iec958.0 {
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
# for compatibility with older drivers
name "IEC958 Playback Default"
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
name "IEC958 Optical Raw Playback Switch"
lock true
@ -395,14 +332,6 @@ Audigy2.pcm.iec958.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -411,14 +340,6 @@ Audigy2.pcm.iec958.0 {
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
name "Audigy Analog/Digital Output Jack"
lock true

View file

@ -28,14 +28,6 @@ EMU10K1.pcm.front.0 {
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -44,14 +36,6 @@ EMU10K1.pcm.front.0 {
optional true
value [ 8 9 0 0 8 9 0 0 8 9 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 8 9 0 0 8 9 0 0 8 9 0 0 ]
}
]
}
}
@ -87,14 +71,6 @@ EMU10K1.pcm.rear.0 {
optional true
value [ 0 0 255 255 0 0 255 0 0 0 0 255 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 0 0 255 255 0 0 255 0 0 0 0 255 ]
}
]
}
}
@ -152,14 +128,6 @@ EMU10K1.pcm.center_lfe.0 {
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -168,14 +136,6 @@ EMU10K1.pcm.center_lfe.0 {
optional true
value [ 6 7 0 0 6 7 0 0 6 7 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 6 7 0 0 6 7 0 0 6 7 0 0 ]
}
]
}
}
@ -304,14 +264,6 @@ EMU10K1.pcm.iec958.0 {
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
# for compatibility with older drivers
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
name "IEC958 Optical Raw Playback Switch"
lock true

View file

@ -163,8 +163,6 @@ HDA-Intel.pcm.iec958.0 {
hint.device 1
}
<confdir:pcm/hdmi.conf>
HDA-Intel.pcm.hdmi.common {
@args [ CARD DEVICE CTLINDEX AES0 AES1 AES2 AES3 ]
@args.CARD {

View file

@ -2,8 +2,6 @@
# Configuration for the Intel HDMI/DP LPE audio
#
<confdir:pcm/hdmi.conf>
HdmiLpeAudio.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD {

View file

@ -60,22 +60,6 @@ cfg_files = aliases.conf \
VXPocket.conf \
VXPocket440.conf
if BUILD_ALISP
cfg_files += aliases.alisp
endif
alsa_DATA = $(cfg_files)
if BUILD_ALISP
SI7018dir = $(alsaconfigdir)/cards/SI7018
SI7018_files = \
SI7018/sndoc-mixer.alisp \
SI7018/sndop-mixer.alisp
SI7018_DATA = $(SI7018_files)
else
SI7018_files=
endif
EXTRA_DIST = \
$(cfg_files) \
$(SI7018_files)
EXTRA_DIST = $(cfg_files)

View file

@ -1,11 +0,0 @@
;
; SiS SI7018 mixer abstract layer
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
(defun sndoc_mixer_open (hctl pcm)
(princ "sndoc_mixer_open: hctl=" hctl " pcm=" pcm "\n")
0
)

View file

@ -1,11 +0,0 @@
;
; SiS SI7018 mixer abstract layer
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
(defun sndop_mixer_open (hctl pcm)
(princ "sndop_mixer_open: hctl=" hctl " pcm=" pcm "\n")
0
)

View file

@ -27,6 +27,7 @@ USB-Audio.pcm.use_dmix {
USB-Audio.pcm.surround40_type {
"AudioPhile" two_stereo_devices
"Audiophile USB (tm)" two_stereo_devices
"ICUSBAUDIO7D" six_channels
"OmniStudio" two_stereo_devices
"Quattro" two_stereo_devices
"SB Audigy 2 NX" six_channels
@ -52,6 +53,7 @@ USB-Audio.pcm.iec958_device {
"Blue Snowball" 999
"C-Media USB Headphone Set" 999
"Cmedia Audio" 999
"Corsair HS60 PRO Surround USB S" 999
"DELL PROFESSIONAL SOUND BAR AE5" 999
"HP Digital Stereo Headset" 999
"GN 9330" 999
@ -65,8 +67,11 @@ USB-Audio.pcm.iec958_device {
"Plantronics USB Headset" 999
"Plantronics Wireless Audio" 999
"SB WoW Headset" 999
"Scarlett 2i2 4th Gen" 999
"Scarlett 2i2 USB" 999
"Scarlett 2i4 USB" 999
"Scarlett Solo 4th Gen" 999
"Scarlett Solo USB" 999
"Sennheiser USB headset" 999
"SWTOR Gaming Headset by Razer" 999
"ThinkStation P620 Main" 999
@ -77,6 +82,7 @@ USB-Audio.pcm.iec958_device {
"USB Device 0x46d_0x992" 999
"WD15 Dock" 999
"WD19 Dock" 999
"ThinkPad USB-C Dock Gen2 USB Au" 999
}
# Second iec958 device number, if any.

View file

@ -1,29 +0,0 @@
(setq snd_card_aliases_array
(
("YMF724" . "YMF744")
("YMF724F" . "YMF744")
("YMF740" . "YMF744")
("YMF740C" . "YMF744")
("YMF754" . "YMF744")
("CMIPCI" . "CMI8338")
("CMI8738" . "CMI8338")
("CMI8738-MC4" . "CMI8738-MC6")
("E-mu APS" . "EMU10K1")
("GUS Max" . "GUS")
("GUS ACE" . "GUS")
("GUS Extreme" . "GUS")
("AMD InterWave" . "GUS")
("Dynasonic 3-D" . "GUS")
("InterWave STB" . "GUS")
)
)
(defun snd_card_alias (cardname)
(setq r (assq cardname snd_card_aliases_array))
(setq r (if (null r) cardname r))
(unsetq r)
)
(defun snd_card_alias_unset ()
(unsetq snd_card_aliases_array snd_card_alias)
)

View file

@ -57,8 +57,10 @@ CMI8786 cards.CMI8788
CMI8787 cards.CMI8788
pistachio cards.pistachio-card
VC4-HDMI cards.vc4-hdmi
hda-acpi cards.HDA-Intel
<confdir:ctl/default.conf>
<confdir:pcm/default.conf>
<confdir:pcm/dmix.conf>
<confdir:pcm/dsnoop.conf>
<confdir:pcm/hdmi.conf>

View file

@ -3,8 +3,6 @@
# subframe conversion
#
<confdir:pcm/hdmi.conf>
vc4-hdmi.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD {

View file

@ -1,115 +0,0 @@
;
; Toplevel configuration for the ALSA Ordinary Mixer Interface
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
(defun sndo_include (hctl stream)
(setq info (Acall "ctl_card_info" (Acall "hctl_ctl" hctl)))
(if (= (Aerror info) 0)
(progn
(setq info (Aresult info))
(setq driver (cdr (assq "driver" (unsetq info))))
(setq file (concat (path "data") "/alsa/cards/" (snd_card_alias driver) "/sndo" stream "-mixer.alisp"))
(setq r (include file))
(when (= r -2) (Asyserr "unable to find file " file))
)
(setq r (Aerror info))
)
(unsetq info driver file r)
)
(defun sndo_mixer_open_fcn (hctl stream pcm)
(setq fcn (concat "sndo" stream "_mixer_open"))
(setq r (if (exfun fcn) (funcall fcn hctl pcm) 0))
(when (= r 0)
(setq hctls (if hctls (cons hctls (cons hctl)) hctl))
)
(unsetq fcn r)
)
(defun sndo_mixer_open_hctl (name stream pcm)
(setq hctl (Acall "hctl_open" name nil))
(setq r (Aerror hctl))
(when (= r 0)
(setq hctl (Aresult hctl))
(setq r (sndo_include hctl stream))
(if (= r 0)
(setq r (sndo_mixer_open_fcn hctl stream pcm))
(Acall "hctl_close" hctl)
)
)
(unsetq hctl r)
)
(defun sndo_mixer_open_virtual (name stream pcm)
(setq file (concat (path "data") "/alsa/virtual/" name "/sndo" stream "-mixer.alisp"))
(setq r (include file))
(when (= r -2) (Asyserr "unable to find file " file))
(when (= r 0) (setq r (sndo_mixer_open_fcn nil stream pcm)))
(unsetq file r)
)
(defun sndo_mixer_open1 (name stream)
(if (compare-strings name 0 2 "hw:" 0 2)
(sndo_mixer_open_hctl name stream nil)
(sndo_mixer_open_virtual name stream nil)
)
)
(defun sndo_mixer_open (pname cname)
(setq r (sndo_mixer_open1 pname "p"))
(when (= r 0) (setq r (sndo_mixer_open1 cname "c")))
(when (!= r 0) (sndo_mixer_close))
(unsetq sndo_mixer_open
sndo_mixer_open_pcm sndo_mixer_open_pcm1
sndo_mixer_open_virtual sndo_mixer_open_fcn
sndo_include r)
)
(defun sndo_mixer_open_pcm1 (pcm stream)
(setq info (Acall "pcm_info" pcm))
(setq r (Aerror info))
(when (= r 0)
(setq info (Aresult info))
(setq card (cdr (assq "card" info)))
(setq r
(if (< card 0)
(sndo_mixer_open_virtual (Acall "pcm_name" pcm) stream pcm)
(sndo_mixer_open_hctl (format "hw:%i" card) stream pcm)
)
)
)
(unsetq info card r)
)
(defun sndo_mixer_open_pcm (ppcm cpcm)
(setq r (sndo_mixer_open_pcm1 ppcm "p"))
(when (= r 0) (setq r (sndo_mixer_open_pcm1 cpcm "c")))
(when (!= r 0) (sndo_mixer_close))
(unsetq sndo_mixer_open
sndo_mixer_open_pcm sndo_mixer_open_pcm1
sndo_mixer_open_virtual sndo_mixer_open_fcn
sndo_include r)
)
(defun sndo_mixer_close1 (hctl stream)
(when hctl
(progn
(setq fcn (concat "sndo" stream "_mixer_close"))
(when (exfun fcn) (funcall fcn hctl))
(unsetq fcn)
(Acall "hctl_close" hctl)
)
)
)
(defun sndo_mixer_close nil
(sndo_mixer_close1 (nth 1 hctls) "c")
(sndo_mixer_close1 (nth 0 hctls) "p")
(snd_card_alias_unset)
(unsetq hctls)
)
(include (concat (path "data") "/alsa/cards/aliases.alisp"))

View file

@ -31,14 +31,16 @@
*
*/
#include "local.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "local.h"
#ifndef DOC_HIDDEN
typedef long long value_type_t;
#endif /* DOC_HIDDEN */
static const char *_find_end_of_expression(const char *s, char begin, char end)
{
@ -119,6 +121,7 @@ static int _to_integer(value_type_t *val, snd_config_t *c)
return err;
}
#ifndef DOC_HIDDEN
int _snd_eval_string(snd_config_t **dst, const char *s,
snd_config_expand_fcn_t fcn, void *private_data)
{
@ -244,6 +247,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
else
return snd_config_imake_integer(dst, NULL, left);
}
#endif /* DOC_HIDDEN */
/**
* \brief Evaluate an math expression in the string
@ -251,7 +255,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
* node at the address specified by \a dst.
* \param[in] s A string to evaluate
* \param[in] fcn A function to get the variable contents
* \param[in] private_value A private value for the variable contents function
* \param[in] private_data A private value for the variable contents function
* \return 0 if successful, otherwise a negative error code.
*/
int snd_config_evaluate_string(snd_config_t **dst, const char *s,

View file

@ -74,12 +74,12 @@
*/
#include "local.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "local.h"
/**
* \brief Gets the boolean value from the given ASCII string.
@ -645,7 +645,7 @@ static int string_from_integer(char **dst, long v)
}
#endif
int _snd_func_private_data(snd_config_t **dst, snd_config_t *src,
static int _snd_func_private_data(snd_config_t **dst, snd_config_t *src,
snd_config_t **private_data, const char *id)
{
int err;
@ -1031,6 +1031,14 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
#endif
#ifdef DOXYGEN
/* For consistency with the PCM Interface module, include documentation even
* when PCM module is not included in the build. */
#ifndef BUILD_PCM
#define BUILD_PCM
#endif
#endif /* DOXYGEN */
#ifdef BUILD_PCM
/**

View file

@ -25,6 +25,7 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -32,7 +33,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#ifndef DOC_HIDDEN
#define SND_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"

View file

@ -185,6 +185,7 @@ in-kernel implementations utilize this feature for I/O operations. This is
against the original design.
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@ -196,7 +197,6 @@ against the original design.
#include <poll.h>
#include <stdbool.h>
#include <limits.h>
#include "control_local.h"
/**
* \brief get identifier of CTL handle
@ -265,13 +265,14 @@ int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock)
}
#ifndef DOC_HIDDEN
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name)
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mode)
{
snd_ctl_t *ctl;
ctl = calloc(1, sizeof(*ctl));
if (!ctl)
return -ENOMEM;
ctl->type = type;
ctl->mode = mode;
if (name)
ctl->name = strdup(name);
INIT_LIST_HEAD(&ctl->async_handlers);
@ -427,6 +428,7 @@ int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
return ctl->ops->element_info(ctl, info);
}
#ifndef DOC_HIDDEN
#if 0 /* deprecated */
static bool validate_element_member_dimension(snd_ctl_elem_info_t *info)
{
@ -502,6 +504,8 @@ int __snd_ctl_add_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
return ctl->ops->element_add(ctl, info);
}
#endif /* DOC_HIDDEN */
/**
* \brief Create and add some user-defined control elements of integer type.
* \param ctl A handle of backend module for control interface.
@ -1266,6 +1270,49 @@ int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
return ctl->ops->rawmidi_prefer_subdevice(ctl, subdev);
}
/**
* \brief Get next UMP device number
* \param ctl CTL handle
* \param device current device on entry and next device on return
* \return 0 on success otherwise a negative error code
*/
int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device)
{
assert(ctl && device);
if (ctl->ops->ump_next_device)
return ctl->ops->ump_next_device(ctl, device);
return -ENXIO;
}
/**
* \brief Get UMP Endpoint info about a UMP RawMidi device
* \param ctl CTL handle
* \param info UMP Endpoint info pointer
* \return 0 on success otherwise a negative error code
*/
int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info)
{
assert(ctl && info);
fprintf(stderr, "%s:%d\n", __func__, __LINE__);
if (ctl->ops->ump_endpoint_info)
return ctl->ops->ump_endpoint_info(ctl, info);
return -ENXIO;
}
/**
* \brief Get UMP Block info about a UMP RawMidi device
* \param ctl CTL handle
* \param info UMP Block info pointer
* \return 0 on success otherwise a negative error code
*/
int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info)
{
assert(ctl && info);
if (ctl->ops->ump_block_info)
return ctl->ops->ump_block_info(ctl, info);
return -ENXIO;
}
/**
* \brief Set Power State to given SND_CTL_POWER_* value and do the power management
* \param ctl CTL handle
@ -1320,7 +1367,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
npfds = snd_ctl_poll_descriptors_count(ctl);
if (npfds <= 0 || npfds >= 16) {
SNDERR("Invalid poll_fds %d\n", npfds);
SNDERR("Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
@ -1328,7 +1375,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
if (err < 0)
return err;
if (err != npfds) {
SNDMSG("invalid poll descriptors %d\n", err);
SNDMSG("invalid poll descriptors %d", err);
return -EIO;
}
for (;;) {

View file

@ -27,12 +27,12 @@
*
*/
#include "control_local.h"
#include "control_external.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "control_local.h"
#include "control_external.h"
#ifndef PIC
/* entry for static linking */
@ -622,7 +622,7 @@ The rest fields are filled by #snd_ctl_ext_create(). The handle field
is the resultant PCM handle. The others are the current status of the
PCM.
\section ctl_ext_impl Callback Functions of External Control Plugins
\section ctl_ext_impl_cb Callback Functions of External Control Plugins
The callback functions in #snd_ctl_ext_callback_t define the real
behavior of the driver. There are many callbacks but many of them are optional.
@ -712,11 +712,11 @@ int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode)
if (ext->version < SNDRV_PROTOCOL_VERSION(1, 0, 0) ||
ext->version > SND_CTL_EXT_VERSION) {
SNDERR("ctl_ext: Plugin version mismatch\n");
SNDERR("ctl_ext: Plugin version mismatch");
return -ENXIO;
}
err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name, mode);
if (err < 0)
return err;

View file

@ -26,6 +26,7 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -33,18 +34,18 @@
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#ifndef PIC
/* entry for static linking */
const char *_snd_module_control_hw = "";
#endif
#ifndef DOC_HIDDEN
#ifndef F_SETSIG
#define F_SETSIG 10
#endif
#ifndef DOC_HIDDEN
#define SNDRV_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"
#define SNDRV_CTL_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 4)
@ -325,6 +326,32 @@ static int snd_ctl_hw_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev)
return 0;
}
static int snd_ctl_hw_ump_next_device(snd_ctl_t *handle, int *device)
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE, device) < 0)
return -errno;
return 0;
}
static int snd_ctl_hw_ump_endpoint_info(snd_ctl_t *handle,
snd_ump_endpoint_info_t *info)
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO, info) < 0)
return -errno;
return 0;
}
static int snd_ctl_hw_ump_block_info(snd_ctl_t *handle,
snd_ump_block_info_t *info)
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_UMP_BLOCK_INFO, info) < 0)
return -errno;
return 0;
}
static int snd_ctl_hw_set_power_state(snd_ctl_t *handle, unsigned int state)
{
snd_ctl_hw_t *hw = handle->private_data;
@ -348,7 +375,7 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
if (res <= 0)
return -errno;
if (CHECK_SANITY(res != sizeof(*event))) {
SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)\n",
SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)",
sizeof(*event), res);
return -EINVAL;
}
@ -379,6 +406,9 @@ static const snd_ctl_ops_t snd_ctl_hw_ops = {
.rawmidi_next_device = snd_ctl_hw_rawmidi_next_device,
.rawmidi_info = snd_ctl_hw_rawmidi_info,
.rawmidi_prefer_subdevice = snd_ctl_hw_rawmidi_prefer_subdevice,
.ump_next_device = snd_ctl_hw_ump_next_device,
.ump_endpoint_info = snd_ctl_hw_ump_endpoint_info,
.ump_block_info = snd_ctl_hw_ump_block_info,
.set_power_state = snd_ctl_hw_set_power_state,
.get_power_state = snd_ctl_hw_get_power_state,
.read = snd_ctl_hw_read,
@ -444,7 +474,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
hw->fd = fd;
hw->protocol = ver;
err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name, mode);
if (err < 0) {
close(fd);
free(hw);

View file

@ -47,6 +47,9 @@ typedef struct _snd_ctl_ops {
int (*rawmidi_next_device)(snd_ctl_t *handle, int *device);
int (*rawmidi_info)(snd_ctl_t *handle, snd_rawmidi_info_t * info);
int (*rawmidi_prefer_subdevice)(snd_ctl_t *handle, int subdev);
int (*ump_next_device)(snd_ctl_t *handle, int *device);
int (*ump_endpoint_info)(snd_ctl_t *handle, snd_ump_endpoint_info_t *info);
int (*ump_block_info)(snd_ctl_t *handle, snd_ump_block_info_t *info);
int (*set_power_state)(snd_ctl_t *handle, unsigned int state);
int (*get_power_state)(snd_ctl_t *handle, unsigned int *state);
int (*read)(snd_ctl_t *handle, snd_ctl_event_t *event);
@ -62,6 +65,7 @@ struct _snd_ctl {
snd_ctl_type_t type;
const snd_ctl_ops_t *ops;
void *private_data;
int mode;
int nonblock;
int poll_fd;
struct list_head async_handlers;
@ -93,7 +97,7 @@ struct _snd_hctl {
/* make local functions really local */
#define snd_ctl_new snd1_ctl_new
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name);
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mode);
int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
#define _snd_ctl_async_descriptor _snd_ctl_poll_descriptor
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);

File diff suppressed because it is too large Load diff

View file

@ -502,7 +502,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
shm->socket = sock;
shm->ctrl = ctrl;
err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name, mode);
if (err < 0) {
result = err;
goto _err;

View file

@ -25,11 +25,11 @@
*
*/
#include "control_local.h"
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "control_local.h"
/* Function to convert from percentage to volume. val = percentage */

View file

@ -26,12 +26,12 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "control_local.h"
static void __fill_eld_ctl_id(snd_ctl_elem_id_t *id, int dev, int subdev)
{
@ -47,13 +47,13 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
snd_ctl_elem_info_t cinfo = {0};
snd_ctl_elem_value_t value = {0};
unsigned char *eld;
unsigned int l;
unsigned int l, spc;
char *s, c;
int ret, valid;
ret = snd_ctl_hw_open(&ctl, NULL, info->card, 0);
if (ret < 0) {
SYSMSG("Cannot open the associated CTL\n");
SYSMSG("Cannot open the associated CTL");
return ret;
}
@ -66,7 +66,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
if (ret == -ENOENT || cinfo.type != SND_CTL_ELEM_TYPE_BYTES || cinfo.count == 0)
return 0;
if (ret < 0) {
SYSMSG("Cannot read ELD\n");
SYSMSG("Cannot read ELD");
return ret;
}
/* decode connected HDMI device name */
@ -78,24 +78,27 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
/* no monitor name detected */
goto __present;
if (l > 16 || 20 + l > cinfo.count) {
SNDERR("ELD decode failed, using old HDMI output names\n");
SNDERR("ELD decode failed, using old HDMI output names");
return 0;
}
s = alloca(l + 1);
s[l] = '\0';
/* sanitize */
valid = 0;
spc = 0;
while (l > 0) {
l--;
c = eld[20 + l];
if (c < ' ' || c >= 0x7f) {
if (c <= ' ' || c >= 0x7f) {
s[l] = ' ';
} else {
valid += !!isalnum(c);
s[l] = c;
if (spc == 0)
spc = l + 1;
}
}
if (valid > 3) {
s[spc] = '\0';
snd_strlcpy((char *)info->name, s, sizeof(info->name));
} else {
__present:

View file

@ -42,13 +42,13 @@ to reduce overhead accessing the real controls in kernel drivers.
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
@ -680,7 +680,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
npfds = snd_hctl_poll_descriptors_count(hctl);
if (npfds <= 0 || npfds >= 16) {
SNDERR("Invalid poll_fds %d\n", npfds);
SNDERR("Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
@ -689,14 +689,14 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
if (err < 0)
return err;
if (err != npfds) {
SNDMSG("invalid poll descriptors %d\n", err);
SNDMSG("invalid poll descriptors %d", err);
return -EIO;
}
do {
pollio = 0;
err_poll = poll(pfd, npfds, timeout);
if (err_poll < 0) {
if (errno == EINTR && !CTLINABORT(hctl->ctl))
if (errno == EINTR && !CTLINABORT(hctl->ctl) && !(hctl->ctl->mode & SND_CTL_EINTR))
continue;
return -errno;
}

View file

@ -1,5 +1,6 @@
/**
* \file control/namehint.c
* \ingroup Configuration
* \brief Give device name hints
* \author Jaroslav Kysela <perex@perex.cz>
* \date 2006
@ -602,9 +603,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
list.siface = iface;
list.show_all = 0;
list.cardname = NULL;
if (strcmp(iface, "card") == 0)
list.iface = SND_CTL_ELEM_IFACE_CARD;
else if (strcmp(iface, "pcm") == 0)
if (strcmp(iface, "pcm") == 0)
list.iface = SND_CTL_ELEM_IFACE_PCM;
else if (strcmp(iface, "rawmidi") == 0)
list.iface = SND_CTL_ELEM_IFACE_RAWMIDI;

View file

@ -29,13 +29,13 @@
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "local.h"
#ifndef DOC_HIDDEN
typedef struct {
@ -311,7 +311,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
unsigned int idx = 0;
if (len % 2 != 0 || len > count * 2) {
_bad_content:
SNDERR("bad value content\n");
SNDERR("bad value content");
return -EINVAL;
}
while (*buf) {

Some files were not shown because too many files have changed in this diff Show more