Skip to content
Snippets Groups Projects
Commit edc8820a authored by leprob001's avatar leprob001
Browse files

Added ability to remap already applied TOAs to a different soundsource.

parent c6b85c52
No related branches found
No related tags found
No related merge requests found
315 316
\ No newline at end of file \ No newline at end of file
function [] = remapToaToSoundsource(~, ~)
%REMAPTOATOSOUNDSOURCE Remaps the TOAs of the selected soundsource to the new one.
% Detailed explanation goes here
global artoaWorkspace;
%% Check if soundsources are loaded
if ~artoa.controller.soundSourcesLoaded()
warndlg('You need to load a soundsource file first!', 'No sound sources loaded');
return;
end
%% Get all soundsources that have applied toas
soundsourcesWithToa = {};
fnames = fieldnames(artoaWorkspace.filteredSoundsources);
for i = 1:length(fnames)
currentSoundsource = fnames{i};
hasToa = artoa.soundsources.hasAppliedToa( ...
currentSoundsource, ...
artoaWorkspace.toaData.soundSource ...
);
if hasToa
soundsourcesWithToa{end + 1} = currentSoundsource;
end
end
%% Check if empty
if isempty(soundsourcesWithToa)
warndlg('No TOA applied to any soundsource.');
return;
end
%% Let the user select the sound source to remap
[sourceIndex, success] = listdlg( ...
'PromptString', 'Select soundsource to remap:',...
'SelectionMode', 'single',...
'ListString', soundsourcesWithToa ...
);
if ~success
return;
end
%% Let the user select the sound source to remap
[destinationIndex, success] = listdlg( ...
'PromptString', 'Select destination soundsource:',...
'SelectionMode', 'single',...
'ListString', fnames ...
);
if ~success
return;
end
%% Get applied toa of source soundsource
selection = strcmp(soundsourcesWithToa{sourceIndex}, artoaWorkspace.toaData.soundSource);
%% Store
artoaWorkspace.toaData.soundSource(selection) = fnames(destinationIndex);
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plots
artoa.controller.edit.updateAvailablePlots();
%% Update offsets table and recalculate TOAs
artoa.controller.edit.offsets.tableSoundsourceOffsetsEdit();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
end
...@@ -165,7 +165,7 @@ artoaGui.editTimeOfArrival.buttonApply = uicontrol( ... ...@@ -165,7 +165,7 @@ artoaGui.editTimeOfArrival.buttonApply = uicontrol( ...
'Style', 'PushButton', ... 'Style', 'PushButton', ...
'FontSize', 8, ... 'FontSize', 8, ...
'Units', 'normalized', ... 'Units', 'normalized', ...
'Position', [.156 .8 .69 .15], ... 'Position', [.156 .85 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.applySoundSourceToSelectedPoints();' ... 'CallBack', 'artoa.controller.edit.timeOfArrival.applySoundSourceToSelectedPoints();' ...
); );
...@@ -175,7 +175,7 @@ artoaGui.editTimeOfArrival.buttonApplyAllVisible = uicontrol( ... ...@@ -175,7 +175,7 @@ artoaGui.editTimeOfArrival.buttonApplyAllVisible = uicontrol( ...
'Style', 'PushButton', ... 'Style', 'PushButton', ...
'FontSize', 8, ... 'FontSize', 8, ...
'Units', 'normalized', ... 'Units', 'normalized', ...
'Position', [.156 .6 .69 .15], ... 'Position', [.156 .65 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.applySoundSourceToAllVisible();' ... 'CallBack', 'artoa.controller.edit.timeOfArrival.applySoundSourceToAllVisible();' ...
); );
...@@ -185,7 +185,7 @@ artoaGui.editTimeOfArrival.buttonDelete = uicontrol( ... ...@@ -185,7 +185,7 @@ artoaGui.editTimeOfArrival.buttonDelete = uicontrol( ...
'Style', 'PushButton', ... 'Style', 'PushButton', ...
'FontSize', 8, ... 'FontSize', 8, ...
'Units', 'normalized', ... 'Units', 'normalized', ...
'Position', [.156 .4 .69 .15], ... 'Position', [.156 .45 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.removeSoundSourceFromSelectedPoints();' ... 'CallBack', 'artoa.controller.edit.timeOfArrival.removeSoundSourceFromSelectedPoints();' ...
); );
...@@ -195,10 +195,21 @@ artoaGui.editTimeOfArrival.buttonWithdrawAllVisible = uicontrol( ... ...@@ -195,10 +195,21 @@ artoaGui.editTimeOfArrival.buttonWithdrawAllVisible = uicontrol( ...
'Style', 'PushButton', ... 'Style', 'PushButton', ...
'FontSize', 8, ... 'FontSize', 8, ...
'Units', 'normalized', ... 'Units', 'normalized', ...
'Position', [.156 .2 .69 .15], ... 'Position', [.156 .25 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.withdrawSoundSourceToAllVisible();' ... 'CallBack', 'artoa.controller.edit.timeOfArrival.withdrawSoundSourceToAllVisible();' ...
); );
artoaGui.editTimeOfArrival.buttonRemap = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSource, ...
'String', 'Remap', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .05 .69 .15], ...
'CallBack', @artoa.controller.edit.timeOfArrival.remapToaToSoundsource ...
);
%% Shift frame %% Shift frame
artoaGui.editTimeOfArrival.frameControlsShift = uipanel( ... artoaGui.editTimeOfArrival.frameControlsShift = uipanel( ...
'Parent', artoaGui.figures.editTimeOfArrival, ... 'Parent', artoaGui.figures.editTimeOfArrival, ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment