@@ -865,6 +865,8 @@ Audio_Region::write ( nframes_t nframes ) | |||||
bool | bool | ||||
Audio_Region::finalize ( nframes_t frame ) | Audio_Region::finalize ( nframes_t frame ) | ||||
{ | { | ||||
_range.length = frame - _range.start; | |||||
log_end(); | log_end(); | ||||
_clip->close(); | _clip->close(); | ||||
@@ -872,8 +874,6 @@ Audio_Region::finalize ( nframes_t frame ) | |||||
/* FIXME: should we attempt to truncate the file? */ | /* FIXME: should we attempt to truncate the file? */ | ||||
_range.length = frame - _range.start; | |||||
redraw(); | redraw(); | ||||
return true; | return true; | ||||
@@ -92,6 +92,11 @@ Sequence_Region::trim ( enum trim_e t, int X ) | |||||
_r->trim_left( 0 - td ); | _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; | break; | ||||
} | } | ||||
case RIGHT: | case RIGHT: | ||||
@@ -109,6 +114,11 @@ Sequence_Region::trim ( enum trim_e t, int X ) | |||||
_r->trim_right( 0 - td ); | _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; | break; | ||||
} | } | ||||
default: | default: | ||||
@@ -62,6 +62,20 @@ struct Range | |||||
length += n; | 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 ) | Range ( ) : start( 0 ), offset( 0 ), length( 0 ) | ||||
{ | { | ||||
} | } | ||||