It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.
Examples:
$[1 + 1]
$[$[2 + 2] / $var1]
$[0xa0 | 0x05]
As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This reverts partially commit b9a4997e92.
It seems that we have have some users for this very specific function.
Mark it deprecated and keep the softvol implementation separate,
so we can remove this function easily in future.
Fixes: https://github.com/alsa-project/alsa-lib/issues/186
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
We hide the internal data transfers using the data frames. Rename
the snd_rawmidi_framing enum to snd_rawmidi_read_mode to make
API more straight and understandable.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The frame structure is a bit internal thing for the kernel
data transfer implementation. Introduce snd_rawmidi_tread()
function which is straight for the application usage and hides
the framing data transfers (kernel space API).
The current code implements the read cache and does the merging
of the frame reads with the similar timestamps (opposite
to the kernel data split for big chunks).
If the application wants to use super-duper-lighting-fast reads,
the snd_rawmidi_read() may be used, but the structure must be
defined on it's own, because this mechanism is not preferred
and unsupported.
BugLink: https://github.com/alsa-project/alsa-lib/issues/172
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Using the kernel-specific types like __u8 breaks the compilation of
applications. Also we need the packed attribute.
Although we may want to move to an opaque type later, let's put the
workaround at first.
Fixes: https://github.com/alsa-project/alsa-lib/issues/172
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Optionally, incoming rawmidi bytes can be put inside a frame of type
snd_rawmidi_framing_tstamp_t.
The main current benefit is that can enable in-kernel timestamping of
incoming bytes, and that timestamp is likely to be more precise than
what userspace can offer.
Tstamp type framing requires a kernel >= 5.14 and a buffer size that
is a multiple of sizeof(snd_rawmidi_framing_tstamp_t). It is only
available on input streams.
Signed-off-by: David Henningsson <coding@diwic.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In this patch series, I added a description about control interface
handling and how control interfaces are identified.
In addition, I added/improved Doxygen documentation for the
snd_ctl_card_info_t type and related corresponding functions,
e.g. snd_ctl_card_info(). I also documented other card-related like
snd_card_next().
Along the way I did minor documentation improvements.
Signed-off-by: Tanjeff-N. Moos <tanjeff@cccmz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch extends the PCM rate plugin for allowing its converter
plugin to deal with multiple formats. Currently, the converter plugin
is allowed to take different formats only when convert callback is
defined. And for this way (so far only the standard linear rate
plugin does), all linear formats have to be handled, and it's
cumbersome.
OTOH, most other rate plugins are implemented with convert_s16
callback, which accepts only S16 format. This is often not ideal
because many converter engines can handle 32bit formats. Also, the
target format is often 32bit format, hence this would require
additional conversion even if the converter engine can output 32bit
natively.
In this patch, for addressing the problems above, the rate plugin API
is extended in the following way:
- The new get_supported_formats callback is added; this stores the bit
masks of the supported input and output formats, as well as the
behavior flags. Currently only linear formats are allowed.
- When the plugin accepts only the interleaved stream, set
SND_PCM_RATE_FLAG_INTERLEAVED flag bit. Otherwise the code has to
handle snd_pcm_channel_area at each call.
- When both input and output formats have to be identical, pass
SND_PCM_RATE_FLAG_SYNC_FORMATS flag bit.
- When the converter wants to process different formats, use convert
callback instead of convert_s16. You can put both in the ops for
compatibility, too.
The input and output formats are found in the info argument of init
callback.
- Now the PCM rate plugin core will skip the temporary buffer
allocation and conversions for pre- and post-process if not needed
(i.e. matching with the requested input or output format).
The rate plugin API version is bumped to 0x010003.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fixes:
cd alsa-lib
if test -r Makefile; then
make distclean
fi
mkdir build
cd build
../configure
make
Note:
The srcdir is used for the symlinks to generated include files :-(
I've not found a better (easy) way to fix this.
Fixes: https://github.com/alsa-project/alsa-lib/issues/136
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit allows to define private alsa-lib's configuration. When
the configuration is present, the device values ("PlaybackCTL",
"CaptureCTL", "PlaybackMixer", "CaptureMixer", "CapturePCM")
are prefixed with '_ucmHEXA.' string where HEXA is replaced by the
unique hexadecimal number identifying the opened ucm manager handle.
Syntax 4
LibraryConfig.a_label.SubstiConfig {
# substituted library configuration like:
usr_share_dir "${ConfLibDir}"
}
LibraryConfig.b_label.Config {
# non-substituted library configuration like:
usr_share_dir "/usr/share/alsa"
}
The File counterparts:
LibraryConfig.c_label.SubstiFile "/some/path"
LibraryConfig.d_label.File "/some/path"
Note that for files the contents is substituted on the request,
but the file name is always substituted (useful for ${ConfDir} etc.).
The private configuration is not saved or preserved. It's life time
belongs to the opened ucm manager handle.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- add asserts to check if the unsigned integers are in the valid range
- replace tuple with set in the id description
- add const prefix for id1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Actually, the BootSequence is executed only when the driver controls
(identifiers or value types) are changed. It may be handy to have
also a sequence which is executed at _each_ boot without any condition.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The access flags are useful for the user space elements
with the custom access flags.
Introduce snd_ctl_elem_info_set_*() functions to set those flags
in the info structure.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
It was wrongly defined with SNDRV_ prefix. Fix it.
Fixes: ea02dbd20a ("pcm: Add snd_pcm_audio_tstamp_type_t constants")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
These are mostly a copy-paste from the kernel headers. But since functions
snd_pcm_audio_tstamp_config make use of these they should be added to the
public API as well.
Reported-by: Alex Moon <alex.r.moon@gmail.com>
Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use codec_provider and codec_consumer for bclk and fsync
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
use fsync_provider for structure fields, 'codec_provider' and
'codec_consumer' for options and modify #defines to use CP and CC
suffixes.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>