while(current && current->position > position) current = PREVIOUS;
}
- if(!current)
+ if(!current && first && first->position <= position)
{
for(current = last;
current && current->position > position;
while(current && current->position < position) current = NEXT;
}
- if(!current)
+ if(!current && last && last->position >= position)
{
for(current = first;
current && current->position < position;
Auto* Autos::get_auto_for_editing(double position)
{
- if(position < 0)
- {
+ if(position < 0) {
position = edl->local_session->get_selectionstart(1);
}
Auto *result = 0;
- position = edl->align_to_frame(position, 0);
-
-
-
-
-//printf("Autos::get_auto_for_editing %p %p\n", first, default_auto);
-
- if(edl->session->auto_keyframes)
- {
- result = insert_auto(track->to_units(position, 0));
+ get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result);
+//printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result);
+ if( !result || !EQUIV(track->from_units(result->position), position) ) {
+ if( edl->session->auto_keyframes ) {
+ position = edl->align_to_frame(position, 0);
+ result = insert_auto(track->to_units(position, 0));
+ }
}
- else
- result = get_prev_auto(track->to_units(position, 0),
- PLAY_FORWARD,
- result);
+//printf("Autos::get_auto_for_editing %p %p\n", first, default_auto);
-//printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result);
return result;
}
while(current && current->position < position) current = NEXT;
}
- if(!current)
+ if(!current && last && last->position > position)
{
for(current = first;
current && current->position <= position;
while(current && current->position > position) current = PREVIOUS;
}
- if(!current)
+ if(!current && first && first->position <= position)
{
for(current = last;
current && current->position > position;