CRAS: iodev - Add device's default per node gain
In commit 08c772a we move to use the stream's gain scaler
instead of the gain on iodev. And that causes a regression
because alsa devices are allowed to configure a default gain
offset per node through UCM config.
Based on current implementation, when 'MaxSoftwareGain' is
specified in UCM, like below example, software gain will be
used, and the 'DefaultNodeGain' specifies the gain offset
to be used on this node.
SectionDevice."Mic".0 {
...
MaxSoftwareGain "2000"
DefaultNodeGain "-1400"
}
To preserve this gain offset behavior, add software_gain_scaler
to iodev and update it base on the active node at open. This
device side gain scaler will be multiplied with the stream
level scaler when reading data in audio thread.
BUG=chromium:935261
TEST=Manual test by changing labels in UCM, and verify
the gain changes as expected.
Change-Id: Ie8da1c4b20c6007222aec0074f745dd3613145a5
Reviewed-on: https://chromium-review.googlesource.com/1559106
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
3 files changed