function [offsetsTable] = addSoundsource(pOffsetsTable, pSoundsource)
%ADDROW Summary of this function goes here
%   Detailed explanation goes here

%% Initialize return variable
offsetsTable = pOffsetsTable;

%% Check if soundsource already exists
if any(strcmp(pSoundsource.sourcename, pOffsetsTable.Properties.RowNames))
    return;
end

%% Add variable
offsetsTable(end + 1, :) = artoa.offsets.getDefaultRowValues();
offsetsTable.Properties.RowNames{end} = pSoundsource.sourcename;
variableNames = offsetsTable.Properties.VariableNames;
offsetsTable{end, variableNames{1}} = artoa.convert.dmy2rd(pSoundsource.offset(3), pSoundsource.offset(2), pSoundsource.offset(1));
offsetsTable{end, variableNames{2}} = pSoundsource.offset(4);
offsetsTable{end, variableNames{3}} = artoa.convert.dmy2rd(pSoundsource.rcv_offset(3), pSoundsource.rcv_offset(2), pSoundsource.rcv_offset(1));
offsetsTable{end, variableNames{4}} = pSoundsource.rcv_offset(4);
offsetsTable{end, variableNames{5}} = pSoundsource.drift;
offsetsTable{end, variableNames{8}} = pSoundsource.empiric_offset(4);
offsetsTable{end, variableNames{9}} = pSoundsource.empiric_drift;

%% Sort rows
offsetsTable = sortrows(offsetsTable, 'RowNames');

end

