Compare commits

..

205 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
188 changed files with 6370 additions and 6430 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.9)
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],
@ -406,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"])
@ -470,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])
@ -477,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])
@ -615,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])
@ -638,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
@ -743,22 +761,24 @@ 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..."
@ -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

@ -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,7 +29,7 @@
#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
#if __GNUC__ > 10
#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) \

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

@ -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
@ -374,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);
@ -418,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);
@ -794,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,6 +30,9 @@
#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)
@ -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
@ -180,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"
@ -193,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
@ -203,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
@ -257,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 */
@ -500,6 +512,9 @@ 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() */
@ -739,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;
@ -1092,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,3 +1,8 @@
#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
*/

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,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

@ -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
@ -28,7 +12,7 @@
#include <linux/types.h>
#include <asm/byteorder.h>
#else
#include <sys/endian.h>
#include <endian.h>
#include <sys/ioctl.h>
#endif
@ -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,7 +265,10 @@ 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 */
@ -298,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 */
@ -337,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 */
@ -351,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... */
};
@ -390,8 +385,8 @@ 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 the silence fill
* for draining
#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling
* of the silence samples
*/
struct snd_interval {
@ -419,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 {
@ -439,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) */
@ -574,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 */
@ -706,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,
@ -717,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 */
@ -729,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)
@ -755,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;
@ -775,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)
@ -782,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,
@ -812,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 */
@ -890,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)
@ -906,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
@ -953,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 */
@ -991,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)
@ -1088,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)
@ -1114,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
}

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 {
@ -142,9 +147,70 @@ ALSA_1.2.6 {
} 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 */
@ -147,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");
@ -160,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();
@ -1264,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)++;
@ -1700,7 +1704,7 @@ static int _snd_config_save_children(snd_config_t *config, snd_output_t *out,
}
return 0;
}
#endif
#endif /* DOC_HIDDEN */
/**
@ -1725,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)
@ -1744,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;
@ -2055,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
@ -2260,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.
@ -2306,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;
@ -2873,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;
@ -3894,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,
@ -4116,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(__OpenBSD__) && !defined(__DragonFly__) && !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
@ -4295,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;
@ -5810,6 +5841,7 @@ static void _snd_config_end(void)
}
#endif
#ifndef DOC_HIDDEN
size_t page_size(void)
{
long s = sysconf(_SC_PAGE_SIZE);
@ -5845,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

@ -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

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
@ -428,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)
{
@ -503,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.
@ -1267,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
@ -1321,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);
@ -1329,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,7 +712,7 @@ 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;
}

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,

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);

File diff suppressed because it is too large Load diff

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)
{
@ -53,7 +53,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
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,7 +78,7 @@ 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);

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,7 +689,7 @@ 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 {

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

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) {

View file

@ -26,6 +26,7 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -33,13 +34,14 @@
#ifndef HAVE_SOFT_FLOAT
#include <math.h>
#endif
#include "control_local.h"
#ifndef DOC_HIDDEN
/* convert to index of integer array */
#define int_index(size) (((size) + sizeof(int) - 1) / sizeof(int))
/* max size of a TLV entry for dB information (including compound one) */
#define MAX_TLV_RANGE_SIZE 256
/* min length of a TLV stream to contain type and size */
#define MIN_TLV_STREAM_LEN ((SNDRV_CTL_TLVO_LEN + 1) * sizeof(int))
#endif
/**
@ -47,12 +49,12 @@
* \param tlv the TLV source
* \param tlv_size the byte size of TLV source
* \param db_tlvp the pointer stored the dB TLV information
* \return the byte size of dB TLV information if found in the given
* TLV source, or a negative error code.
* \return The byte size of dB TLV information if found in the given TLV
* source, -ENOENT if not found, or a negative error code in case of an error.
*
* This function parses the given TLV source and stores the TLV start
* point if the TLV information regarding dB conversion is found.
* The stored TLV pointer can be passed to the convesion functions
* The stored TLV pointer can be passed to the conversion functions
* #snd_tlv_convert_to_dB(), #snd_tlv_convert_from_dB() and
* #snd_tlv_get_dB_range().
*/
@ -64,6 +66,13 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
unsigned int size;
int err;
/* Validate that it is possible to read the type and size
* without reading past the end of the buffer. */
if (tlv_size < MIN_TLV_STREAM_LEN) {
SNDERR("TLV stream too short");
return -EINVAL;
}
*db_tlvp = NULL;
type = tlv[SNDRV_CTL_TLVO_TYPE];
size = tlv[SNDRV_CTL_TLVO_LEN];
@ -79,7 +88,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
while (size > 0) {
unsigned int len;
err = snd_tlv_parse_dB_info(tlv, size, db_tlvp);
if (err < 0)
if (err < 0 && err != -ENOENT)
return err; /* error */
if (err > 0)
return err; /* found */
@ -114,7 +123,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
default:
break;
}
return -EINVAL; /* not found */
return -ENOENT;
}
/**

View file

@ -27,8 +27,8 @@
*
*/
#include "list.h"
#include "local.h"
#include "list.h"
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
@ -170,8 +170,10 @@ EXPORT_SYMBOL void *INTERNAL(snd_dlopen_old)(const char *name, int mode)
}
#endif
#ifndef DOC_HIDDEN
use_symbol_version(__snd_dlopen_old, snd_dlopen, ALSA_0.9);
use_default_symbol_version(__snd_dlopen, snd_dlopen, ALSA_1.1.6);
#endif /* DOC_HIDDEN */
/**
* \brief Closes a dynamic library - ALSA wrapper for \c dlclose.

View file

@ -28,11 +28,11 @@
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "local.h"
/**
* Array of error codes in US ASCII.
@ -191,11 +191,38 @@ snd_lib_error_handler_t snd_err_msg = snd_err_msg_default;
*/
size_t snd_strlcpy(char *dst, const char *src, size_t size)
{
size_t ret = strlen(src);
if (size) {
size_t len = ret >= size ? size - 1 : ret;
memcpy(dst, src, len);
dst[len] = '\0';
}
return ret;
size_t ret = strlen(src);
if (size) {
size_t len = ret >= size ? size - 1 : ret;
memcpy(dst, src, len);
dst[len] = '\0';
}
return ret;
}
/**
* \brief Append a C-string into a sized buffer
* \param dst Where to append the string to
* \param src Where to copy the string from
* \param size Size of destination buffer
* \retval The total string length (no trimming)
*
* The result is always a valid NUL-terminated string that fits
* in the buffer (unless, of course, the buffer size is zero).
* It does not pad out the result.
*/
size_t snd_strlcat(char *dst, const char *src, size_t size)
{
size_t dst_len = strlen(dst);
size_t len = strlen(src);
size_t ret = dst_len + len;
if (dst_len < size) {
dst += dst_len;
size -= dst_len;
if (len >= size)
len = size - 1;
memcpy(dst, src, len);
dst[len] = '\0';
}
return ret;
}

View file

@ -28,13 +28,13 @@
*
*/
#include "hwdep_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "hwdep_local.h"
static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
const char *name, snd_config_t *hwdep_root,

View file

@ -19,13 +19,13 @@
*
*/
#include "hwdep_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "hwdep_local.h"
#ifndef PIC
/* entry for static linking */

View file

@ -19,10 +19,10 @@
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "local.h"
typedef struct {
int (*close)(snd_hwdep_t *hwdep);

View file

@ -27,11 +27,11 @@
*
*/
#include "local.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
#ifndef DOC_HIDDEN

View file

@ -68,6 +68,11 @@ int bag_del(bag_t *bag, void *ptr)
void bag_del_all(bag_t *bag)
{
while (!list_empty(bag))
list_del(bag->next);
struct list_head *pos, *npos;
list_for_each_safe(pos, npos, bag) {
bag1_t *b = list_entry(pos, bag1_t, list);
list_del(&b->list);
free(b);
}
}

View file

@ -39,13 +39,13 @@ This is an abstraction layer over the hcontrol layer.
*/
#include "mixer_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "mixer_local.h"
#ifndef DOC_HIDDEN
typedef struct _snd_mixer_slave {
@ -482,7 +482,6 @@ int snd_mixer_elem_remove(snd_mixer_elem_t *elem)
/**
* \brief Free a mixer element
* \param elem Mixer element
* \return 0 on success otherwise a negative error code
*
* For use by mixer element class specific code.
*/

View file

@ -29,6 +29,8 @@
*
*/
#include "mixer_local.h"
#include "mixer_simple.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -36,9 +38,6 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <math.h>
#include "config.h"
#include "mixer_local.h"
#include "mixer_simple.h"
/**
* \brief Register mixer simple element class

View file

@ -27,6 +27,8 @@
*
*/
#include "mixer_local.h"
#include "mixer_simple.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -35,8 +37,6 @@
#include <sys/ioctl.h>
#include <math.h>
#include <dlfcn.h>
#include "mixer_local.h"
#include "mixer_simple.h"
#ifndef DOC_HIDDEN

View file

@ -29,6 +29,8 @@
*
*/
#include "local.h"
#include "mixer_simple.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -38,9 +40,6 @@
#include <assert.h>
#include <math.h>
#include <limits.h>
#include "local.h"
#include "config.h"
#include "mixer_simple.h"
#ifndef DOC_HIDDEN
@ -1156,11 +1155,12 @@ static selem_ctl_t *get_selem_ctl(selem_none_t *s, int dir)
c = &s->ctls[CTL_CAPTURE_VOLUME];
else
return NULL;
if (! c->elem) {
if (! c->elem)
c = &s->ctls[CTL_GLOBAL_VOLUME];
if (! c->elem)
return NULL;
}
if (! c->elem)
c = &s->ctls[CTL_SINGLE];
if (! c->elem)
return NULL;
if (c->type != SND_CTL_ELEM_TYPE_INTEGER)
return NULL;
return c;

View file

@ -30,10 +30,10 @@
*
*/
#include "local.h"
#include <stdarg.h>
#include <limits.h>
#include <sys/stat.h>
#include "local.h"
/**
* \brief This function is unimplemented.

View file

@ -27,11 +27,11 @@
*
*/
#include "local.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
#ifndef DOC_HIDDEN
typedef struct _snd_output_ops {

View file

@ -22,9 +22,9 @@
#define SND_INTERVAL_C
#define SND_INTERVAL_INLINE
#include "pcm_local.h"
#include <sys/types.h>
#include <limits.h>
#include "pcm_local.h"
static inline void div64_32(uint64_t *n, uint32_t d, uint32_t *rem)
{

View file

@ -22,6 +22,7 @@
#define SND_MASK_C
#define SND_MASK_INLINE
#include "config.h"
#include <sys/types.h>
#include <limits.h>
#include "pcm_local.h"

View file

@ -96,7 +96,7 @@ standard C open function - see 'man 2 open'). In non-blocked behaviour,
these I/O functions never stops, they return -EAGAIN error code, when no
data can be transferred (the ring buffer is full in our case). In blocked
behaviour, these I/O functions stop and wait until there is a room in the
ring buffer (playback) or until there are a new samples (capture). The ALSA
ring buffer (playback) or until there are new samples (capture). The ALSA
implementation can be found in the \ref alsa_pcm_rw section.
\subsection pcm_transfer_event Event waiting routines
@ -215,7 +215,8 @@ range, thus you may get the significant bits for linear samples via
#snd_pcm_hw_params_get_sbits() function. The example: ICE1712
chips support 32-bit sample processing, but low byte is ignored (playback)
or zero (capture). The function snd_pcm_hw_params_get_sbits()
returns 24 in this case.
returns 24 in this case. The significant bits are related to the usable
sample bits (width) not the physical sample space.
\section alsa_transfers ALSA transfers
@ -223,7 +224,7 @@ There are two methods to transfer samples in application. The first method
is the standard read / write one. The second method, uses the direct audio
buffer to communicate with the device while ALSA library manages this space
itself. You can find examples of all communication schemes for playback
in \ref example_test_pcm "Sine-wave generator example". To complete the
in \link example_test_pcm Sine-wave generator example \endlink. To complete the
list, we should note that #snd_pcm_wait() function contains
embedded poll waiting implementation.
@ -351,9 +352,9 @@ enumeration.
These parameters - #snd_pcm_sw_params_t can be modified at
any time including the running state.
\par Minimum available count of samples
\par Minimum available count of frames
This parameter controls the wakeup point. If the count of available samples
This parameter controls the wakeup point. If the count of available frames
is equal or greater than this value, then application will be activated.
\par Timestamp mode
@ -372,29 +373,29 @@ is ignored by device. Usually, this value is set to one (no align).
\par Start threshold
The start threshold parameter is used to determine the start point in
stream. For playback, if samples in ring buffer is equal or greater than
the start threshold parameters and the stream is not running, the stream will
be started automatically from the device. For capture, if the application wants
to read count of samples equal or greater then the stream will be started.
If you want to use explicit start (#snd_pcm_start), you can
set this value greater than ring buffer size (in samples), but use the
constant MAXINT is not a bad idea.
stream. For playback, if the frame count in the ring buffer is equal or greater
than the start threshold parameter and the stream is not running, the stream
will be started automatically from the device. For capture, if the application
wants to read count of frames equal or greater then the stream will be started.
If you want to use explicit start (#snd_pcm_start), you can set this value
greater than the ring buffer size (in frames). For that simply using a large
constant such as LONG_MAX or the boundary value is not a bad idea.
\par Stop threshold
Similarly, the stop threshold parameter is used to automatically stop
the running stream, when the available samples crosses this boundary.
the running stream, when the available frames crosses this boundary.
It means, for playback, the empty samples in ring buffer and for capture,
the filled (used) samples in ring buffer.
\par Silence threshold
The silence threshold specifies count of samples filled with silence
ahead of the current application pointer for playback. It is usable
for applications when an overrun is possible (like tasks depending on
network I/O etc.). If application wants to manage the ahead samples itself,
the #snd_pcm_rewind() function allows to forget the last
samples in the stream.
The silence threshold specifies the count of frames before an underrun when the
buffer gets filled with frames of silence according to the silence size parameter
ahead of the current application pointer for playback. It is usable for applications
when an underrun is possible (like tasks depending on network I/O etc.). If
application wants to manage the ahead samples itself, the #snd_pcm_rewind() function
allows to forget the last samples in the stream.
\section pcm_status Obtaining stream status
@ -402,11 +403,11 @@ The stream status is stored in #snd_pcm_status_t structure.
These parameters can be obtained: the current stream state -
#snd_pcm_status_get_state(), timestamp of trigger -
#snd_pcm_status_get_trigger_tstamp(), timestamp of last
pointer update #snd_pcm_status_get_tstamp(), delay in samples -
#snd_pcm_status_get_delay(), available count in samples -
#snd_pcm_status_get_avail(), maximum available samples -
pointer update #snd_pcm_status_get_tstamp(), delay in frames -
#snd_pcm_status_get_delay(), available count in frames -
#snd_pcm_status_get_avail(), maximum available frames -
#snd_pcm_status_get_avail_max(), ADC over-range count in
samples - #snd_pcm_status_get_overrange(). The last two
frames - #snd_pcm_status_get_overrange(). The last two
parameters - avail_max and overrange are reset to zero after the status
call.
@ -414,7 +415,7 @@ call.
<p>
The function #snd_pcm_avail_update() updates the current
available count of samples for writing (playback) or filled samples for
available count of frames for writing (playback) or filled frames for
reading (capture). This call is mandatory for updating actual r/w pointer.
Using standalone, it is a light method to obtain current stream position,
because it does not require the user <-> kernel context switch, but the value
@ -427,10 +428,10 @@ The function #snd_pcm_avail() reads the current hardware pointer
in the ring buffer from hardware and calls #snd_pcm_avail_update() then.
</p>
<p>
The function #snd_pcm_delay() returns the delay in samples.
For playback, it means count of samples in the ring buffer before
the next sample will be sent to DAC. For capture, it means count of samples
in the ring buffer before the next sample will be captured from ADC. It works
The function #snd_pcm_delay() returns the delay in frames.
For playback, it means count of frames in the ring buffer before
the next frames will be sent to DAC. For capture, it means count of frames
in the ring buffer before the next frames will be captured from ADC. It works
only when the stream is in the running or draining (playback only) state.
Note that this function does not update the current r/w pointer for applications,
so the function #snd_pcm_avail_update() must be called afterwards
@ -493,8 +494,8 @@ software parameter.
There are two functions allowing link multiple streams together. In the
case, the linking means that all operations are synchronized. Because the
drivers cannot guarantee the synchronization (sample resolution) on hardware
lacking this feature, the #snd_pcm_info_get_sync() function
returns synchronization ID - #snd_pcm_sync_id_t, which is equal
lacking this feature, the #snd_pcm_hw_params_get_sync() function
returns 16-byte synchronization ID, which is equal
for hardware synchronized streams. When the #snd_pcm_link()
function is called, all operations managing the stream state for these two
streams are joined. The opposite function is #snd_pcm_unlink().
@ -632,32 +633,42 @@ The null device is null plugin. This device has not any arguments.
The full featured examples with cross-links can be found in Examples section
(see top of page):
\anchor example_test_pcm
\par Sine-wave generator
\par
alsa-lib/test/pcm.c example shows various transfer methods for the playback direction.
\link example_test_pcm alsa-lib/test/pcm.c \endlink
example shows various transfer methods for the playback direction.
\par Minimalistic PCM playback code
\par
alsa-lib/test/pcm_min.c example shows the minimal code to produce a sound.
\link example_test_minimal alsa-lib/test/pcm_min.c \endlink
example shows the minimal code to produce a sound.
\par Latency measuring tool
\par
alsa-lib/test/latency.c example shows the measuring of minimal latency between capture and
\link example_test_latency alsa-lib/test/latency.c \endlink
example shows the measuring of minimal latency between capture and
playback devices.
*/
/**
\example ../../test/pcm.c
\anchor example_test_pcm
Shows various transfer methods for the playback direction.
*/
/**
\example ../../test/pcm_min.c
\anchor example_test_minimal
Shows the minimal code to produce a sound.
*/
/**
\example ../../test/latency.c
\anchor example_test_latency
Shows the measuring of minimal latency between capture and
playback devices.
*/
#include "pcm_local.h"
#include <stdio.h>
#include <string.h>
#if HAVE_MALLOC_H
@ -669,7 +680,6 @@ playback devices.
#include <poll.h>
#include <sys/mman.h>
#include <limits.h>
#include "pcm_local.h"
#ifndef DOC_HIDDEN
/* return specific error codes for known bad PCM states */
@ -767,6 +777,10 @@ int snd_pcm_close(snd_pcm_t *pcm)
{
int res = 0, err;
assert(pcm);
while (!list_empty(&pcm->async_handlers)) {
snd_async_handler_t *h = list_entry(pcm->async_handlers.next, snd_async_handler_t, hlist);
snd_async_del_handler(h);
}
if (pcm->setup && !pcm->donot_close) {
snd_pcm_drop(pcm);
err = snd_pcm_hw_free(pcm);
@ -775,10 +789,6 @@ int snd_pcm_close(snd_pcm_t *pcm)
}
if (pcm->mmap_channels)
snd_pcm_munmap(pcm);
while (!list_empty(&pcm->async_handlers)) {
snd_async_handler_t *h = list_entry(pcm->async_handlers.next, snd_async_handler_t, hlist);
snd_async_del_handler(h);
}
if (pcm->ops->close)
err = pcm->ops->close(pcm->op_arg);
else
@ -885,6 +895,7 @@ int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
* \param pcm PCM handle
* \param params Configuration space definition container
* \return 0 on success otherwise a negative error code
* \retval -EBADFD no hardware configuration is set
*/
int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
@ -951,6 +962,8 @@ int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
/** \brief Remove PCM hardware configuration and free associated resources
* \param pcm PCM handle
* \return 0 on success otherwise a negative error code
*
* The function will also report success if no configuration is set.
*/
int snd_pcm_hw_free(snd_pcm_t *pcm)
{
@ -1799,6 +1812,12 @@ static int __snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
* corresponding FD_SET arrays and demangle events using
* \link ::snd_pcm_poll_descriptors_revents() \endlink .
*
* It is guaranteed that for the given PCM handle, the output poll
* descriptor structs (and their count) will not change after
* hardware and software parameters setup. Thus it is valid to call
* the function once when all parameters are set and reuse its output
* for the lifetime of the stream parameters.
*
* The function is thread-safe when built with the proper option.
*/
int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
@ -1834,6 +1853,13 @@ static int __snd_pcm_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds,
* Note: Even if multiple poll descriptors are used (i.e. pfds > 1),
* this function returns only a single event.
*
* The passed in count of poll descriptors must be equal to
* \link ::snd_pcm_poll_descriptors_count() \endlink and the passed in array
* must match the array returned by \link ::snd_pcm_poll_descriptors() \endlink
* (in its full length and original order) with the revent fields updated
* according to the poll() result. This function will not modify the file
* descriptor or event field of any element of the given poll descriptor array.
*
* The function is thread-safe when built with the proper option.
*/
int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
@ -2061,10 +2087,16 @@ static const char *const snd_pcm_type_names[] = {
static const char *const snd_pcm_subformat_names[] = {
SUBFORMAT(STD),
SUBFORMAT(MSBITS_MAX),
SUBFORMAT(MSBITS_20),
SUBFORMAT(MSBITS_24),
};
static const char *const snd_pcm_subformat_descriptions[] = {
SUBFORMATD(STD, "Standard"),
SUBFORMATD(MSBITS_MAX, "Maximum based on PCM format"),
SUBFORMATD(MSBITS_20, "20 most significant bits"),
SUBFORMATD(MSBITS_24, "24 most significant bits"),
};
static const char *const snd_pcm_start_mode_names[] = {
@ -2188,6 +2220,30 @@ const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat)
return snd_pcm_subformat_descriptions[subformat];
}
/**
* \brief get PCM sample subformat from name
* \param name PCM sample subformat name (case insensitive)
* \return PCM sample subformat
*/
snd_pcm_subformat_t snd_pcm_subformat_value(const char* name)
{
snd_pcm_subformat_t subformat;
for (subformat = 0; subformat <= SND_PCM_SUBFORMAT_LAST; subformat++) {
if (snd_pcm_subformat_names[subformat] &&
!strcasecmp(name, snd_pcm_subformat_names[subformat]))
return subformat;
}
for (subformat = 0; subformat <= SND_PCM_SUBFORMAT_LAST; subformat++) {
if (snd_pcm_subformat_descriptions[subformat] &&
!strcasecmp(name, snd_pcm_subformat_descriptions[subformat]))
return subformat;
}
return SND_PCM_SUBFORMAT_UNKNOWN;
}
/**
* \brief (DEPRECATED) get name of PCM start mode setting
* \param mode PCM start mode
@ -2234,7 +2290,7 @@ const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode)
/**
* \brief get name of PCM tstamp type setting
* \param mode PCM tstamp type
* \param type PCM tstamp type
* \return ascii name of PCM tstamp type setting
*/
const char *snd_pcm_tstamp_type_name(snd_pcm_tstamp_type_t type)
@ -2916,7 +2972,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
npfds = __snd_pcm_poll_descriptors_count(pcm);
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);
@ -2924,7 +2980,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, 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;
}
if (timeout == SND_PCM_WAIT_IO)
@ -2932,7 +2988,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
else if (timeout == SND_PCM_WAIT_DRAIN)
timeout = __snd_pcm_wait_drain_timeout(pcm);
else if (timeout < -1)
SNDMSG("invalid snd_pcm_wait timeout argument %d\n", timeout);
SNDMSG("invalid snd_pcm_wait timeout argument %d", timeout);
do {
__snd_pcm_unlock(pcm->fast_op_arg);
err_poll = poll(pfd, npfds, timeout);
@ -3042,7 +3098,7 @@ snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm)
* \param delayp Total I/O latency in frames
* \return zero on success otherwise a negative error code
*
* The avail and delay values retuned are in sync.
* The avail and delay values returned are in sync.
*
* The function is thread-safe when built with the proper option.
*/
@ -3051,7 +3107,7 @@ int snd_pcm_avail_delay(snd_pcm_t *pcm,
snd_pcm_sframes_t *delayp)
{
snd_pcm_sframes_t sf;
int err;
int err, ok = 0;
assert(pcm && availp && delayp);
if (CHECK_SANITY(! pcm->setup)) {
@ -3062,15 +3118,25 @@ int snd_pcm_avail_delay(snd_pcm_t *pcm,
err = __snd_pcm_hwsync(pcm);
if (err < 0)
goto unlock;
sf = __snd_pcm_avail_update(pcm);
if (sf < 0) {
err = (int)sf;
goto unlock;
/*
* Delay value is relative to avail, so we have to
* loop to avoid reporting stale delay data.
*/
while (1) {
sf = __snd_pcm_avail_update(pcm);
if (sf < 0) {
err = (int)sf;
goto unlock;
}
if (ok && sf == *availp)
break;
*availp = sf;
err = __snd_pcm_delay(pcm, delayp);
if (err < 0)
goto unlock;
ok = 1;
}
err = __snd_pcm_delay(pcm, delayp);
if (err < 0)
goto unlock;
*availp = sf;
err = 0;
unlock:
snd_pcm_unlock(pcm->fast_op_arg);
@ -3439,12 +3505,12 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
/**
* \brief Copy one or more areas
* \param dst_areas destination areas specification (one for each channel)
* \param dst_channels destination areas specification (one for each channel)
* \param dst_offset offset in frames inside destination area
* \param dst_size size in frames of the destination buffer
* \param src_areas source areas specification (one for each channel)
* \param src_channels source areas specification (one for each channel)
* \param src_offset offset in frames inside source area
* \param dst_size size in frames of the source buffer
* \param src_size size in frames of the source buffer
* \param channels channels count
* \param frames frames to copy
* \param format PCM sample format
@ -3848,7 +3914,16 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
/**
* \brief Get sample resolution info from a configuration space
* \param params Configuration space
* \return signification bits in sample otherwise a negative error code if the info is not available
* \return sample resolution (in bits) otherwise a negative error code if the info is not available
*
* For linear formats, this function returns sample resolution -
* used bits starting from the first usable significant bit defined by
* the format (e.g. bit 31 for S32_LE format or bit 23 for S24_LE format -
* starting from bit zero). Application may use full sample bit range defined
* by the format, but additional bits (outside this sample resolution) are
* stripped (not processed).
*
* For non-linear formats, this value may have a special meaning which may be defined in future.
*
* This function should only be called when the configuration space
* contains a single configuration. Call #snd_pcm_hw_params to choose
@ -3883,6 +3958,25 @@ int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
return params->fifo_size;
}
/**
* \brief Get hardware synchronization ID from a PCM info container
* \param params Configuration space
* \return 16-byte synchronization ID (use #SND_PCM_HW_PARAMS_SYNC_SIZE)
*
* This synchronization ID determines the similar clocks for the
* PCM stream between multiple devices (including different cards).
* "All zeros" means "not set". The contents of the ID can be used
* only for a comparison with the contents of another ID returned
* from this function. Applications should not do a comparison with
* hard-coded values, because the implementation generating such
* synchronization IDs may be changed in future.
*/
const unsigned char *snd_pcm_hw_params_get_sync(const snd_pcm_hw_params_t *params)
{
assert(params);
return params->sync;
}
/**
* \brief Fill params with a full configuration space for a PCM
* \param pcm PCM handle
@ -3890,6 +3984,11 @@ int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
*
* The configuration space will be filled with all possible ranges
* for the PCM device.
*
* Note that the configuration space may be constrained by the
* currently installed configuration on the PCM device. To remove
* any constrains, free the configuration with #snd_pcm_hw_free
* first.
*/
int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
@ -4456,7 +4555,7 @@ EXPORT_SYMBOL int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_par
int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
#endif
{
return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, (unsigned int *)subformat, NULL);
}
/**
@ -4496,7 +4595,7 @@ EXPORT_SYMBOL int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm
int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
#endif
{
return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, (unsigned int *)subformat, NULL);
}
/**
@ -4512,7 +4611,7 @@ EXPORT_SYMBOL int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm,
int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
#endif
{
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, (unsigned int *)subformat, NULL);
}
/**
@ -6399,7 +6498,7 @@ int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
params->start_threshold = pcm->boundary;
break;
default:
SNDMSG("invalid start mode value %d\n", val);
SNDMSG("invalid start mode value %d", val);
return -EINVAL;
}
return 0;
@ -6447,7 +6546,7 @@ int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
params->stop_threshold = pcm->boundary;
break;
default:
SNDMSG("invalid xrun mode value %d\n", val);
SNDMSG("invalid xrun mode value %d", val);
return -EINVAL;
}
return 0;
@ -6835,6 +6934,10 @@ int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, s
* underrun is nearer than silence threshold (see
* #snd_pcm_sw_params_set_silence_threshold)
*
* When drain silence (see #snd_pcm_hw_params_get_drain_silence) is disabled,
* this will also apply for draining, i.e. silence is written also when the
* drain end is nearer than the silence threshold.
*
* The special case is when silence size value is equal or greater than
* boundary. The unused portion of the ring buffer (initial written samples
* are untouched) is filled with silence at start. Later, only just processed
@ -7022,7 +7125,7 @@ void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimesta
/**
* \brief Get audio_tstamp_report from a PCM status container
* \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to returned report (valid fields are accuracy and type)
* \param audio_tstamp_report Pointer to returned report
*/
void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
snd_pcm_audio_tstamp_report_t *audio_tstamp_report)
@ -7036,7 +7139,7 @@ void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
/**
* \brief set audio_tstamp_config from a PCM status container
* \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to config (valid fields are type and report_analog_delay)
* \param audio_tstamp_config Pointer to config (valid fields are type_requested and report_delay)
*/
void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj,
snd_pcm_audio_tstamp_config_t *audio_tstamp_config)
@ -7258,7 +7361,7 @@ unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj)
}
/**
* \brief Get hardware synchronization ID from a PCM info container
* \brief (DEPRECATED) Get hardware synchronization ID from a PCM info container
* \param obj PCM info container
* \return hardware synchronization ID
*/
@ -7266,9 +7369,12 @@ snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj)
{
snd_pcm_sync_id_t res;
assert(obj);
memcpy(&res, &obj->sync, sizeof(res));
bzero(&res, sizeof(res));
return res;
}
#ifndef DOC_HIDDEN
link_warning(snd_pcm_info_get_sync, "Warning: snd_pcm_info_get_sync is deprecated, consider to use snd_pcm_hw_params_get_sync");
#endif
/**
* \brief Set wanted device inside a PCM info container (see #snd_ctl_pcm_info)
@ -7431,7 +7537,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
_skip:
\endcode
*
* Look to the \ref example_test_pcm "Sine-wave generator" example
* Look to the \link example_test_pcm Sine-wave generator \endlink example
* for more details about the generate_sine function.
*
* The function is thread-safe when built with the proper option.
@ -7661,7 +7767,8 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
/* some plugins might automatically start the stream */
state = __snd_pcm_state(pcm);
if (state == SND_PCM_STATE_PREPARED &&
hw_avail >= (snd_pcm_sframes_t) pcm->start_threshold) {
hw_avail >= 0 &&
(snd_pcm_uframes_t) hw_avail >= pcm->start_threshold) {
err = __snd_pcm_start(pcm);
if (err < 0)
goto _end;
@ -8656,7 +8763,7 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf)
* -EPIPE (overrun or underrun) and -ESTRPIPE (stream is suspended)
* error codes trying to prepare given stream for next I/O.
*
* Note that this function returs the original error code when it is not
* Note that this function returns the original error code when it is not
* handled inside this function (for example -EAGAIN is returned back).
*/
int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)

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