1
function out = ssr_helper(in, func)
2
% Run the SSR block-wise on an input signal
3
% 'func' is the SSR function, e.g. @ssr_nfc_hoa
4
% 'func' must be initialized already
6
block_size = func('block_size');
7
out_channels = func('out_channels');
8
in_channels = size(in, 2);
10
% calculate (and discard) one block with empty input
11
garbage = func('process', single(zeros(block_size, in_channels)));
13
% now all parameters are up-to-date
15
signallength = size(in, 1);
17
blocks = ceil(signallength/block_size);
19
out = zeros(signallength, out_channels);
22
block_start = (idx-1) * block_size + 1;
23
block_end = block_start + block_size - 1;
24
inputblock = in(block_start:block_end, :);
25
out(block_start:block_end, :) = func('process', inputblock);
28
% TODO: handle last block!