From 4bac61ca325b000934cab12e7d2709827885ecc0 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 10 Jun 2024 13:08:46 +0300 Subject: [PATCH] Audio: Crossover: Fix paths after scripts move The paths to topology and sof-ctl blobs are updated. The paths to other setup scripts (common, eq) are set with a new helper function crossover_paths.m. Signed-off-by: Seppo Ingalsuo --- .../crossover/tune/crossover_coef_quant.m | 3 --- .../crossover/tune/crossover_gen_coefs.m | 3 +-- src/audio/crossover/tune/crossover_paths.m | 23 +++++++++++++++++++ src/audio/crossover/tune/example_crossover.m | 16 ++++++------- 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 src/audio/crossover/tune/crossover_paths.m diff --git a/src/audio/crossover/tune/crossover_coef_quant.m b/src/audio/crossover/tune/crossover_coef_quant.m index f7ff948a1..91c61116f 100644 --- a/src/audio/crossover/tune/crossover_coef_quant.m +++ b/src/audio/crossover/tune/crossover_coef_quant.m @@ -3,8 +3,6 @@ function crossover_quant = crossover_coef_quant(lowpass, highpass); bits_iir = 32; % Q2.30 qf_iir = 30; -addpath ./../eq - if length(lowpass) ~= length(highpass) error("length of lowpass and highpass array do not match"); end @@ -27,5 +25,4 @@ end crossover_quant.lp_coef = cell2mat(crossover_quant.lp_coef); crossover_quant.hp_coef = cell2mat(crossover_quant.hp_coef); -rmpath ./../eq end diff --git a/src/audio/crossover/tune/crossover_gen_coefs.m b/src/audio/crossover/tune/crossover_gen_coefs.m index 99ec9d829..8368ea5c1 100644 --- a/src/audio/crossover/tune/crossover_gen_coefs.m +++ b/src/audio/crossover/tune/crossover_gen_coefs.m @@ -1,13 +1,12 @@ function crossover = crossover_gen_coefs(fs, fc_low, fc_mid, fc_high) -addpath ./../eq/ switch nargin case 2, crossover = crossover_generate_2way(fs, fc_low); case 3, crossover = crossover_generate_3way(fs, fc_low, fc_mid); case 4, crossover = crossover_generate_4way(fs, fc_low, fc_mid, fc_high); otherwise, error("Invalid number of arguments"); end -rmpath ./../eq + end function crossover_2way = crossover_generate_2way(fs, fc) diff --git a/src/audio/crossover/tune/crossover_paths.m b/src/audio/crossover/tune/crossover_paths.m new file mode 100644 index 000000000..307c19299 --- /dev/null +++ b/src/audio/crossover/tune/crossover_paths.m @@ -0,0 +1,23 @@ +function crossover_paths(enable) + +% crossover_paths(enable) +% enable - set to true to enable needed search path +% set to false to disable the search paths +% + +% SPDX-License-Identifier: BSD-3-Clause +% +% Copyright (c) 2024, Intel Corporation. All rights reserved. + + common = '../../../../tools/tune/common'; + eq = '../../../../tools/tune/eq'; + # After #9187 merge use this: + # eq = '../../eq_iir/tune'; + if enable + addpath(common); + addpath(eq); + else + rmpath(common); + rmpath(eq); + end +end diff --git a/src/audio/crossover/tune/example_crossover.m b/src/audio/crossover/tune/example_crossover.m index b33250af4..97ba8e9e2 100644 --- a/src/audio/crossover/tune/example_crossover.m +++ b/src/audio/crossover/tune/example_crossover.m @@ -1,7 +1,5 @@ function example_crossover() -addpath ./../common - % Sampling Frequency and Frequency cut-offs for crossover cr.fs = 48e3; cr.fc_low = 200; @@ -30,17 +28,18 @@ export_crossover(cr); cr.sinks = [0 1 2 3]; export_crossover(cr); -rmpath ./../common - end function export_crossover(cr) +crossover_paths(true); + endian = "little"; -tpath1 = '../../topology/topology1/m4/crossover'; -tpath2 = '../../topology/topology2/include/components/crossover'; -ctlpath3 = '../../ctl/ipc3/crossover'; -ctlpath4 = '../../ctl/ipc4/crossover'; +sof_tools = '../../../../tools'; +tpath1 = fullfile(sof_tools, 'topology/topology1/m4/crossover'); +tpath2 = fullfile(sof_tools, 'topology/topology2/include/components/crossover'); +ctlpath3 = fullfile(sof_tools, 'ctl/ipc3/crossover'); +ctlpath4 = fullfile(sof_tools, 'ctl/ipc4/crossover'); str_way = sprintf('%dway', cr.num_sinks); str_freq = get_str_freq(cr); @@ -100,6 +99,7 @@ alsactl_write(alsa4_fn, blob8_ipc4); % Plot Magnitude and Phase Response of each sink crossover_plot_freq(crossover.lp, crossover.hp, cr.fs, cr.num_sinks); +crossover_paths(false); end % Frequencies part for filename