Skip to content

Commit

Permalink
Position new tonals within sorted list
Browse files Browse the repository at this point in the history
This probably breaks the undo functionality, but tonals are now inserted into the linked list by start time.  This fixes a display error when we were looking for tonals within an interval.
  • Loading branch information
marie-r committed Mar 5, 2024
1 parent b7a0bda commit e6eeb34
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/matlab/user_interface/dtTonalAnnotate.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@

Filename = '';
data.RelativeFilePath = '';
data.FigureTitle = '';


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -324,11 +325,8 @@
data.Stop_s = data.hdr.Chunks{data.hdr.dataChunk}.nSamples/data.hdr.fs;
data.RemoveTransients = false;


data.operation = [];

data.FigureTitle = '';

data.ms_per_s = 1000;
data.thr.advance_s = data.thr.advance_ms / data.ms_per_s;

Expand Down Expand Up @@ -720,7 +718,21 @@ function Commit_AddMerge(hObject, eventdata, handles)
merged = merged.merge(newtonal);
end
end
data.annotations.add(merged);
% Determine where in list to insert

start_time = merged.getFirst().time;
iter = data.annotations.iterator();
found = false;
idx = 0; % keep count of position
while (~ found && iter.hasNext())
t = iter.next();
if start_time < t.getFirst().time
found = true;
else
idx = idx + 1;
end
end
data.annotations.add(idx, merged);
change.after = {merged};

if ~isempty(handles.Selected)
Expand Down

0 comments on commit e6eeb34

Please sign in to comment.