From 387d74ea6d0c53a452d2a03b189b6f583a236e03 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Wed, 12 Jan 2022 15:08:27 +0200 Subject: [PATCH] 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 --- tools/tune/eq/mls_freq_resp.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/tune/eq/mls_freq_resp.m b/tools/tune/eq/mls_freq_resp.m index 983fd099c..2185bf797 100644 --- a/tools/tune/eq/mls_freq_resp.m +++ b/tools/tune/eq/mls_freq_resp.m @@ -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