Snap trims as well.

This commit is contained in:
Jonathan Moore Liles 2008-05-17 00:14:26 -05:00
parent 4422c354f7
commit 91614d9aa1
3 changed files with 26 additions and 2 deletions

View File

@ -865,6 +865,8 @@ Audio_Region::write ( nframes_t nframes )
bool
Audio_Region::finalize ( nframes_t frame )
{
_range.length = frame - _range.start;
log_end();
_clip->close();
@ -872,8 +874,6 @@ Audio_Region::finalize ( nframes_t frame )
/* FIXME: should we attempt to truncate the file? */
_range.length = frame - _range.start;
redraw();
return true;

View File

@ -92,6 +92,11 @@ Sequence_Region::trim ( enum trim_e t, int X )
_r->trim_left( 0 - td );
nframes_t f;
/* snap to beat/bar lines */
if ( timeline->nearest_line( _r->start, &f ) )
_r->set_left( f );
break;
}
case RIGHT:
@ -109,6 +114,11 @@ Sequence_Region::trim ( enum trim_e t, int X )
_r->trim_right( 0 - td );
nframes_t f;
/* snap to beat/bar lines */
if ( timeline->nearest_line( _r->start + _r->length, &f ) )
_r->set_right( f );
break;
}
default:

View File

@ -62,6 +62,20 @@ struct Range
length += n;
}
void
set_left ( nframes_t f )
{
offset += f - start;
length -= f - start;
start = f;
}
void
set_right ( nframes_t f )
{
length = f - start;
}
Range ( ) : start( 0 ), offset( 0 ), length( 0 )
{
}