Skip to content
Snippets Groups Projects
v4234.m 1.54 KiB
Newer Older
%% Rename Empirical to Applied

if ~artoa.data.hasMember(artoaWorkspace, 'editOffsets', 'offsets', 'EmpiricalOffset')
    artoaWorkspace.editOffsets.offsets = addvars( ...
        artoaWorkspace.editOffsets.offsets, ...
        getEmpiricOffset4234(artoaWorkspace.editOffsets.offsets), ...
        'NewVariableNames', {'EmpiricOffset'}, ...
        'After', 5 ...
        );
end

if ~artoa.data.hasMember(artoaWorkspace, 'editOffsets', 'offsets', 'EmpiricalDrift')
    artoaWorkspace.editOffsets.offsets = addvars( ...
        artoaWorkspace.editOffsets.offsets, ...
        getEmpiricDrift4234(artoaWorkspace.editOffsets.offsets), ...
        'NewVariableNames', {'EmpiricDrift'}, ...
        'After', 6 ...
        );
end

%% Helper functions
function [empiricalOffset] = getEmpiricOffset4234(pOffsetTable)
    soundsources = artoa.controller.getSoundsourcesWithAppliedToa();
    fnames = fieldnames(soundsources);
    empiricalOffset = NaN(size(pOffsetTable, 1), 1);
    % get all empirical offsets of soundsources
    for i = 1:length(fnames)
        if length(soundsources.(fnames{i}).empiric_offset) < 4
            continue;
        end
        
    end
end

function [empiricalDrift] = getEmpiricDrift4234(pOffsetTable)
    soundsources = artoa.controller.getSoundsourcesWithAppliedToa();
    fnames = fieldnames(soundsources);
    empiricalDrift = NaN(size(pOffsetTable, 1), 1);
    % get all empirical offsets of soundsources
    for i = 1:length(fnames)
        empiricalDrift(i+1) = artoa.data.getMember(soundsources, {fnames{i}, 'empiric_drift'}, NaN);
    end
end