From: Jaroslav Kysela Date: Tue, 6 Jan 2026 13:37:04 +0000 (+0100) Subject: common: introduce DirectUseCase macro X-Git-Tag: v1.2.15.2~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=72c81c7b91e3fe10b9d797d793cd85f27ca8623c;p=alsa-ucm-conf.git common: introduce DirectUseCase macro The goal is to replace the common/direct.conf with this more universal macro. Signed-off-by: Jaroslav Kysela --- diff --git a/ucm2/common/directm.conf b/ucm2/common/directm.conf new file mode 100644 index 0000000..4939f03 --- /dev/null +++ b/ucm2/common/directm.conf @@ -0,0 +1,77 @@ +# +# Define direct use case (no channel split or routing changes) macros +# + +# +# Macro DirectUseCase +# +# Arguments: +# Id - Use Case identifier (e.g. "Direct" or "Direct1") +# [CardName] - optional, default is global CardName +# [Comment] - optional, default is compibed from identifier and CardName +# [PlaybackChannels] - optional, playback channels or/and +# [CaptureChannels] - optional, capture channels +# [PlaybackRate] - optional, in Hz +# [CaptureRate] - optional, in Hz +# + +DefineMacro.DirectUseCase { + If.cardname { + Condition { + Type String + Empty "${var:-__CardName}" + } + True.Define.__CardName "${CardName}" + } + If.comment { + Condition { + Type String + Empty "${var:-__Comment}" + } + True.Define.__Comment "${var:__Id} ${var:__CardName}" + } + SectionUseCase."${var:__Id}" { + Comment "Direct ${var:__CardName}" + Config.SectionDevice."Direct" { + Comment "Direct ${CardName}" + Value { + If.p { + Condition { + Type String + Empty "${var:-__PlaybackChannels}" + } + False { + PlaybackPriority 1000 + PlaybackChannels "${var:__PlaybackChannels}" + PlaybackPCM "hw:${CardId}" + } + } + If.c { + Condition { + Type String + Empty "${var:-__CaptureChannels}" + } + False { + CapturePriority 1000 + CaptureChannels "${var:__CaptureChannels}" + CapturePCM "hw:${CardId}" + } + } + } + If.prate { + Condition { + Type String + Empty "${var:-__PlaybackRate}" + } + False.Value.PlaybackRate "${var:-__PlaybackRate}" + } + If.crate { + Condition { + Type String + Empty "${var:-__CaptureRate}" + } + False.Value.CaptureRate "${var:-__CaptureRate}" + } + } + } +}