ucm: add Repeat block - repetitive pattern substitution (Syntax 9)

Implements Repeat blocks for generating repetitive configuration patterns
with variable substitution. This feature allows applying a configuration
block multiple times with different variable values, significantly reducing
duplication in UCM configuration files.

iterator abstraction allows easy extension for future pattern types.

Example:

  Repeat.VolumeInit {
    Pattern {
      Variable 'ch'
      Type Integer
      First 0
      Last 7
      Step 1
    }
    Apply {
      cset "name='PCM Channel ${var:ch} Volume' 100%"
    }
  }

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2026-02-06 13:43:11 +01:00
parent 2943b1e412
commit 27aa3e41ef
5 changed files with 540 additions and 3 deletions

View file

@ -729,9 +729,9 @@ int uc_mgr_evaluate_inplace(snd_use_case_mgr_t *uc_mgr,
snd_config_t *cfg)
{
long iterations = 10000;
int err1 = 0, err2 = 0, err3 = 0, err4 = 0, err5 = 0;
int err1 = 0, err2 = 0, err3 = 0, err4 = 0, err5 = 0, err6 = 0;
while (err1 == 0 || err2 == 0 || err3 == 0 || err4 == 0 || err5 == 0) {
while (err1 == 0 || err2 == 0 || err3 == 0 || err4 == 0 || err5 == 0 || err6 == 0) {
if (iterations == 0) {
snd_error(UCM, "Maximal inplace evaluation iterations number reached (recursive references?)");
return -EINVAL;
@ -768,6 +768,9 @@ int uc_mgr_evaluate_inplace(snd_use_case_mgr_t *uc_mgr,
err5 = evaluate_condition(uc_mgr, cfg);
if (err5 < 0)
return err5;
err6 = uc_mgr_evaluate_repeat(uc_mgr, cfg);
if (err6 < 0)
return err6;
}
return 0;
}