diff --git a/matlab/CARFAC_GenerateTestData.m b/matlab/CARFAC_GenerateTestData.m index 66b18b8..71dbedf 100644 --- a/matlab/CARFAC_GenerateTestData.m +++ b/matlab/CARFAC_GenerateTestData.m @@ -140,7 +140,7 @@ function CARFAC_GenerateTestData() function WriteTestData(test_data_dir, test_name, signal, CF_struct, sai_struct, open_loop) % function WriteTestData(test_data_dir, test_name, signal, CF_struct, sai_struct, open_loop) -% +% % Helper function to run CARFAC and SAI over the given signal and % save the results to text files in test_data_dir. @@ -154,8 +154,10 @@ function WriteTestData(test_data_dir, test_name, signal, CF_struct, sai_struct, WriteMatrixToFile([filename_prefix '-audio.txt'], signal); +CF_struct.open_loop = open_loop; + CF_struct = CARFAC_Init(CF_struct); -[CF_struct, nap_decim, nap, bm, ohc, agc] = CARFAC_Run(CF_struct, signal, 0, open_loop); +[CF_struct, nap_decim, nap, bm, ohc, agc] = CARFAC_Run(CF_struct, signal, 0); % Store the data for each ear of each output signal in a separate file. for ear = 1:CF_struct.n_ears diff --git a/matlab/CARFAC_Run.m b/matlab/CARFAC_Run.m index 76358ac..201ee54 100644 --- a/matlab/CARFAC_Run.m +++ b/matlab/CARFAC_Run.m @@ -17,7 +17,7 @@ % limitations under the License. function [CF, decim_naps, naps, BM, ohc, agc] = CARFAC_Run ... - (CF, input_waves, AGC_plot_fig_num, open_loop) + (CF, input_waves, AGC_plot_fig_num) % function [CF, decim_naps, naps, BM, ohc, agc] = CARFAC_Run ... % (CF, input_waves, AGC_plot_fig_num) % This function runs the CARFAC; that is, filters a 1 or more channel @@ -42,10 +42,6 @@ [n_samp, n_ears] = size(input_waves); n_ch = CF.n_ch; -if nargin < 4 - open_loop = 0; -end - if nargin < 3 AGC_plot_fig_num = 0; end @@ -102,46 +98,46 @@ % Process a segment to get a slice of decim_naps, and plot AGC state: if ~isempty(BM) % ask for everything in this case, for laziness: - [seg_naps, CF, seg_BM, seg_ohc, seg_agc] = CARFAC_Run_Segment(CF, input_waves(k_range, :), open_loop); + [seg_naps, CF, seg_BM, seg_ohc, seg_agc] = CARFAC_Run_Segment(CF, input_waves(k_range, :)); else - [seg_naps, CF] = CARFAC_Run_Segment(CF, input_waves(k_range, :), open_loop); + [seg_naps, CF] = CARFAC_Run_Segment(CF, input_waves(k_range, :)); end - + if ~isempty(BM) for ear = 1:n_ears % Accumulate segment BM to make full BM BM(k_range, :, ear) = seg_BM(:, :, ear); end end - + if ~isempty(naps) for ear = 1:n_ears % Accumulate segment naps to make full naps naps(k_range, :, ear) = seg_naps(:, :, ear); end end - + if ~isempty(ohc) for ear = 1:n_ears % Accumulate segment naps to make full naps ohc(k_range, :, ear) = seg_ohc(:, :, ear); end end - + if ~isempty(agc) for ear = 1:n_ears % Accumulate segment naps to make full naps agc(k_range, :, ear) = seg_agc(:, :, ear); end end - + if ~isempty(decim_naps) for ear = 1:n_ears decim_naps(seg_num, :, ear) = CF.ears(ear).IHC_state.ihc_accum / seglen; CF.ears(ear).IHC_state.ihc_accum = zeros(n_ch,1); end end - + if AGC_plot_fig_num figure(AGC_plot_fig_num); hold off; clf maxmax = 0;