@@ -645,6 +645,22 @@ Audio_Region::draw ( void ) | |||||
} | } | ||||
/** split region at absolute frame /where/ */ | |||||
void | |||||
Audio_Region::split ( nframes_t where ) | |||||
{ | |||||
nframes_t old_fade_in = _fade_in.length; | |||||
_fade_in.length = 256; | |||||
Audio_Region *copy = new Audio_Region( *this ); | |||||
_fade_in.length = old_fade_in; | |||||
_fade_out.length = 256; | |||||
Sequence_Region::split( copy, where ); | |||||
} | |||||
int | int | ||||
Audio_Region::handle ( int m ) | Audio_Region::handle ( int m ) | ||||
{ | { | ||||
@@ -679,19 +695,7 @@ Audio_Region::handle ( int m ) | |||||
{ | { | ||||
Loggable::block_start(); | Loggable::block_start(); | ||||
nframes_t old_fade_in = _fade_in.length; | |||||
_fade_in.length = 256; | |||||
Audio_Region *copy = new Audio_Region( *this ); | |||||
_fade_in.length = old_fade_in; | |||||
trim( RIGHT, X ); | |||||
copy->trim( LEFT, X ); | |||||
_fade_out.length = 256; | |||||
sequence()->add( copy ); | |||||
split( timeline->x_to_offset( X ) ); | |||||
log_end(); | log_end(); | ||||
@@ -154,6 +154,7 @@ public: | |||||
Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); } | Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); } | ||||
void normalize ( void ); | void normalize ( void ); | ||||
void split ( nframes_t where ); | |||||
/* Engine */ | /* Engine */ | ||||
nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const; | nframes_t read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const; | ||||
@@ -124,6 +124,17 @@ Sequence_Region::trim ( enum trim_e t, int X ) | |||||
} | } | ||||
} | } | ||||
/** split region at absolute frame /where/. due to inheritance issues, | |||||
* the copy must be made in the derived classed and passed in */ | |||||
void | |||||
Sequence_Region::split ( Sequence_Region * copy, nframes_t where ) | |||||
{ | |||||
trim_right( where ); | |||||
copy->trim_left( where ); | |||||
sequence()->add( copy ); | |||||
} | |||||
#include "FL/test_press.H" | #include "FL/test_press.H" | ||||
int | int | ||||
@@ -51,4 +51,5 @@ public: | |||||
enum trim_e { NO, LEFT, RIGHT }; | enum trim_e { NO, LEFT, RIGHT }; | ||||
void trim ( enum trim_e t, int X ); | void trim ( enum trim_e t, int X ); | ||||
void split ( Sequence_Region *copy, nframes_t where ); | |||||
}; | }; |