Browse Source

Clean up region splitting code.

tags/non-daw-v1.1.0
Jonathan Moore Liles 16 years ago
parent
commit
71bd1c27d9
4 changed files with 30 additions and 13 deletions
  1. +17
    -13
      Timeline/Audio_Region.C
  2. +1
    -0
      Timeline/Audio_Region.H
  3. +11
    -0
      Timeline/Sequence_Region.C
  4. +1
    -0
      Timeline/Sequence_Region.H

+ 17
- 13
Timeline/Audio_Region.C View File

@@ -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();




+ 1
- 0
Timeline/Audio_Region.H View File

@@ -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;


+ 11
- 0
Timeline/Sequence_Region.C View File

@@ -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


+ 1
- 0
Timeline/Sequence_Region.H View File

@@ -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 );
}; };

Loading…
Cancel
Save