topology2: add support for sampling rate

The original calculation will generate 44 sample size for
44.1khz, actually it at least needs 45 sample size.
This patch uses ceil value for such rate, also inlcude
11.025kh, 22.05kh, 88.2khz, 176.4khz.

Signed-off-by: Rander Wang <rander.wang@intel.com>
This commit is contained in:
Rander Wang 2022-06-13 13:20:44 +08:00 committed by Liam Girdwood
parent 2ff1c6f108
commit 3f12097f36
1 changed files with 3 additions and 2 deletions

View File

@ -232,6 +232,7 @@ Class.Base."audio_format" {
out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256)) | ($out_sample_type * 65536)]"
# math expression for computing input/put buffer sizes
ibs "$[($in_channels * ($in_rate / 1000)) * ($in_bit_depth / 8)]"
obs "$[($out_channels * ($out_rate / 1000)) * ($out_bit_depth / 8)]"
# for 11.025 22.05, 44.1, 88.2 and 176.4khz, we need to round it to ceiling value
ibs "$[($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)]"
obs "$[($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)]"
}