It is useful to do simple integer math in UCM configurations, too.
Use snd_config_evaluate_string() string for this job.
Example:
${eval:1+1}
${eval:100*$var1}
${eval:$[$var2+1]/5}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
The bellow commit caused regression for the SectionModifier parser. Revert
the single line change.
Fixes: 251bc204 ("ucm: implement RenameDevice and RemoveDevice verb management")
Fixes: https://github.com/alsa-project/alsa-lib/issues/167
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>
Introduce safe_strtol_base() function and redirects all
strtol calls there. Also, improve error and value handling
in callers.
BugLink: https://github.com/alsa-project/alsa-lib/issues/187
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
It seems that users are confused when the UCM configuration
is not ready for the particular hardware. Actually, we don't
allow a fine grained message classification in alsa-lib and
UCM API. Allow suppression of this specific type of messages
on the application request (typically alsactl).
BugLink: https://github.com/alsa-project/alsa-utils/issues/111
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
It is better to allocate the read buffer for the framing stream
in the params setup call.
Suggested-by: David Henningsson <coding@diwic.se>
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>
When doing rewind or forward operations, application pointer needs to
be properly adjusted, in the same way when doing commit/write
operations.
Fixes: https://github.com/alsa-project/alsa-lib/pull/161
Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The safe_strtol() function use strtol() which expects
to have the '0x' prefix for the hexadecimal number (when
base argument is zero).
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1553
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>
Adds a "clock type" parameter to the "rawmidi" test program, that when
used and combined with -i (and -v to be useful), activates tstamp type
framing with the specified clock type.
Signed-off-by: David Henningsson <coding@diwic.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>