Make fades render better for crossfades.
This commit is contained in:
parent
30c19870d6
commit
6f0af6bf3f
|
@ -93,7 +93,7 @@ Region::init ( void )
|
|||
_color = FL_BLUE;
|
||||
|
||||
_fade_in.length = 256;
|
||||
_fade_in.type = Fade::Cosine;
|
||||
_fade_in.type = Fade::Sigmoid;
|
||||
|
||||
_fade_out = _fade_in;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ changed:
|
|||
portion of the region covered by this draw, which may or may not
|
||||
cover the fade in question. */
|
||||
void
|
||||
Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, int X, int W )
|
||||
Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool filled, int X, int W )
|
||||
{
|
||||
const int dy = y() + Fl::box_dy( box() );
|
||||
const int dh = h() - Fl::box_dh( box() );
|
||||
|
@ -435,15 +435,19 @@ Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, int X, int W )
|
|||
}
|
||||
else
|
||||
{
|
||||
fl_translate( line_x() + abs_w(), dy + height );
|
||||
// fl_translate( line_x() + abs_w(), dy + height );
|
||||
fl_translate( line_x() + abs_w(), dy );
|
||||
fl_scale( width, height );
|
||||
|
||||
/* flip */
|
||||
fl_scale( -1.0, 1.0 );
|
||||
fl_scale( 1.0, -1.0 );
|
||||
// fl_scale( 1.0, -1.0 );
|
||||
}
|
||||
|
||||
fl_begin_polygon();
|
||||
if ( filled )
|
||||
fl_begin_polygon();
|
||||
else
|
||||
fl_begin_line();
|
||||
|
||||
fl_vertex( 0.0, 0.0 );
|
||||
fl_vertex( 0.0, 1.0 );
|
||||
|
@ -456,7 +460,10 @@ Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, int X, int W )
|
|||
fl_vertex( x, y );
|
||||
}
|
||||
|
||||
fl_end_polygon();
|
||||
if ( filled )
|
||||
fl_end_polygon();
|
||||
else
|
||||
fl_end_line();
|
||||
|
||||
fl_pop_matrix();
|
||||
}
|
||||
|
@ -478,8 +485,8 @@ Region::draw_box( int X, int Y, int W, int H )
|
|||
fl_draw_box( box(), x() - 10, y(), w() + 50, h(), _box_color );
|
||||
|
||||
/* draw fades */
|
||||
draw_fade( _fade_in, Fade::In, X, W );
|
||||
draw_fade( _fade_out, Fade::Out, X, W );
|
||||
draw_fade( _fade_in, Fade::In, true, X, W );
|
||||
draw_fade( _fade_out, Fade::Out, true, X, W );
|
||||
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
@ -535,12 +542,11 @@ Region::draw ( int X, int Y, int W, int H )
|
|||
|
||||
assert( pbuf );
|
||||
|
||||
int ch = (h() - Fl::box_dh( box() )) / channels;
|
||||
/* draw fade curve outlines--this is only here because of crossfades */
|
||||
draw_fade( _fade_in, Fade::In, false, X, W );
|
||||
draw_fade( _fade_out, Fade::Out, false, X, W );
|
||||
|
||||
/* FIXME: testing! */
|
||||
Fade fade = _fade_in;
|
||||
fade.length = 20000;
|
||||
fade.type = Fade::Sigmoid;
|
||||
int ch = (h() - Fl::box_dh( box() )) / channels;
|
||||
|
||||
for ( int i = 0; i < channels; ++i )
|
||||
{
|
||||
|
|
|
@ -267,7 +267,7 @@ public:
|
|||
Region ( Audio_File *c, Track *t, nframes_t o );
|
||||
|
||||
int handle ( int m );
|
||||
void draw_fade ( const Fade &fade, Fade::fade_dir_e dir, int X, int W );
|
||||
void draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool filled, int X, int W );
|
||||
|
||||
void draw_box( int X, int Y, int W, int H );
|
||||
void draw ( int X, int Y, int W, int H );
|
||||
|
|
Loading…
Reference in New Issue