Tools: Tune: EQ: Fix script compatibility with Matlab

The script mls_freq_resp.m has worked previously with Octave
while failed with Matlab because it does not have source
command. This patch ads function get_config() that reads
the configuration file, evaluates it, and returns the
needed variable.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2022-01-12 15:08:27 +02:00 committed by Liam Girdwood
parent f976333a81
commit 387d74ea6d
1 changed files with 9 additions and 2 deletions

View File

@ -250,7 +250,7 @@ function remote_capture(fn, cfg, t)
end
function play = meas_remote_play_config()
source mls_play_config.txt;
play = get_config('mls_play_config.txt', 'play');
fprintf('\nThe setttings for remote playback are\n');
fprintf('Use ssh : %d\n', play.ssh);
fprintf('User : %s\n', play.user);
@ -260,7 +260,7 @@ function play = meas_remote_play_config()
end
function rec = meas_remote_rec_config(fs, fmt)
source mls_rec_config.txt;
rec = get_config('mls_rec_config.txt', 'rec');
rec.fmt = sprintf('-t wav -c %d -f %s -r %d', ...
rec.nch, fmt, fs);
@ -400,3 +400,10 @@ function [cal_f, cal_m_db] = apply_mic_calibration(f, m_db, rec)
end
end
function ret = get_config(fn, var)
s = fileread(fn);
eval(s);
cmd = sprintf('ret = %s;', var);
eval(cmd);
end