Skip to content

Commit

Permalink
Audio: Crossover: Prefix top level functions names with sof_
Browse files Browse the repository at this point in the history
The names are changed to avoid any collisions with multiple
Octave or Matlab paths enabled.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
  • Loading branch information
singalsu authored and lgirdwood committed Sep 2, 2024
1 parent 4bac61c commit fcf3d65
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function crossover_quant = crossover_coef_quant(lowpass, highpass);
function crossover_quant = sof_crossover_coef_quant(lowpass, highpass);

bits_iir = 32; % Q2.30
qf_iir = 30;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function crossover = crossover_gen_coefs(fs, fc_low, fc_mid, fc_high)
function crossover = sof_crossover_gen_coefs(fs, fc_low, fc_mid, fc_high)

switch nargin
case 2, crossover = crossover_generate_2way(fs, fc_low);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function config = crossover_generate_config(crossover_bqs, num_sinks, assign_sinks);
function config = sof_crossover_generate_config(crossover_bqs, num_sinks, assign_sinks);

config.num_sinks = num_sinks;
config.assign_sinks = assign_sinks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function crossover_paths(enable)
function sof_crossover_paths(enable)

% crossover_paths(enable)
% sof_crossover_paths(enable)
% enable - set to true to enable needed search path
% set to false to disable the search paths
%
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function crossover_plot_freq(lp, hp, fs, num_sinks);
function sof_crossover_plot_freq(lp, hp, fs, num_sinks);
% Plot the transfer function of each sink. We need to reconstruct a filter
% that represents the path the samples go through for each sinks.
% Example 4-way crossover:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function example_crossover()
function sof_example_crossover()

% Sampling Frequency and Frequency cut-offs for crossover
cr.fs = 48e3;
Expand Down Expand Up @@ -32,7 +32,7 @@ function example_crossover()

function export_crossover(cr)

crossover_paths(true);
sof_crossover_paths(true);

endian = "little";
sof_tools = '../../../../tools';
Expand Down Expand Up @@ -64,24 +64,24 @@ function export_crossover(cr)
% Generate zeros, poles and gain for crossover with the given frequencies
switch cr.num_sinks
case 2
crossover = crossover_gen_coefs(cr.fs, cr.fc_low); % 2 way crossover
crossover = sof_crossover_gen_coefs(cr.fs, cr.fc_low); % 2 way crossover
case 3
crossover = crossover_gen_coefs(cr.fs, cr.fc_low, cr.fc_med); % 3 way crossover
crossover = sof_crossover_gen_coefs(cr.fs, cr.fc_low, cr.fc_med); % 3 way crossover
case 4
crossover = crossover_gen_coefs(cr.fs, cr.fc_low, cr.fc_med, cr.fc_high); % 4 way crossover
crossover = sof_crossover_gen_coefs(cr.fs, cr.fc_low, cr.fc_med, cr.fc_high); % 4 way crossover
otherwise
error('Illegal number of sinks %d\n', num_sinks);
end

% Convert the [a,b] coefficients to values usable with SOF
crossover_bqs = crossover_coef_quant(crossover.lp, crossover.hp);
crossover_bqs = sof_crossover_coef_quant(crossover.lp, crossover.hp);

% Convert coefficients to sof_crossover_config struct
config = crossover_generate_config(crossover_bqs, cr.num_sinks, assign_sinks);
config = sof_crossover_generate_config(crossover_bqs, cr.num_sinks, assign_sinks);

% Convert struct to binary blob
blob8 = crossover_build_blob(config, endian, 3);
blob8_ipc4 = crossover_build_blob(config, endian, 4);
blob8 = sof_crossover_build_blob(config, endian, 3);
blob8_ipc4 = sof_crossover_build_blob(config, endian, 4);

% Generate output files

Expand All @@ -97,9 +97,9 @@ function export_crossover(cr)
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);
sof_crossover_plot_freq(crossover.lp, crossover.hp, cr.fs, cr.num_sinks);

crossover_paths(false);
sof_crossover_paths(false);
end

% Frequencies part for filename
Expand Down

0 comments on commit fcf3d65

Please sign in to comment.