Cleanup some issues with trimming.

pull/3/head
Jonathan Moore Liles 2008-02-17 19:13:20 -06:00
parent d36804ea4e
commit a032a95fad
4 changed files with 15 additions and 19 deletions

View File

@ -47,7 +47,7 @@ Peaks::fill_buffer ( int s, int e ) const
{
/* looks like we're going to have to switch to a higher resolution peak file
or read directly from the source */
read_peaks( s, e, e - s / timeline.fpp, timeline.fpp );
read_peaks( s, e, (e - s) / timeline.fpp, timeline.fpp );
}
else
{
@ -82,7 +82,7 @@ Peaks::downsample ( int s, int e, float *mhi, float *mlo ) const
int
Peaks::clip_read_peaks ( Peak *peaks, int npeaks, int chunksize ) const
{
float *fbuf = new float[ chunksize ];
sample_t *fbuf = new sample_t[ chunksize ];
size_t len;
@ -116,7 +116,7 @@ Peaks::clip_read_peaks ( Peak *peaks, int npeaks, int chunksize ) const
void
Peaks::read_peaks ( int s, int e, int npeaks, int chunksize ) const
{
// printf( "reading peaks %d @ %d\n", npeaks, chunksize );
printf( "reading peaks %d @ %d\n", npeaks, chunksize );
if ( peakbuf.size < npeaks )
{

View File

@ -44,7 +44,8 @@ Region::init ( void )
box( FL_PLASTIC_UP_BOX );
_track = NULL;
_offset = 0;
// _offset = 0;
_offset = timeline.x_to_ts( x() );
}
Region::Region ( const Region & rhs ) : Waveform( rhs )
@ -73,25 +74,21 @@ Region::trim ( enum trim_e t, int X )
case LEFT:
{
int d = X - x();
// _start += d;
if ( d < 0 &&
_start < timeline.x_to_ts( x() + d ) )
{
_start = 0;
break;
}
else
_start = timeline.x_to_ts( x() + d );
// _start += timeline.x_to_ts( d );
_start += timeline.x_to_ts( d );
Fl_Widget::resize( x() + d, y(), w() - d, h() );
_offset = timeline.x_to_ts( x() );
break;
}
case RIGHT:
{
int d = (x() + w()) - X;
// _end = _start + w() - d;
_end = timeline.x_to_ts( _start + w() - d );
_end = _start + timeline.x_to_ts( w() - d );
Fl_Widget::resize( x(), y(), w() - d, h() );
break;
}

View File

@ -65,7 +65,7 @@ Waveform::draw ( int X, int Y, int W, int H )
{
fl_push_clip( X, Y, W, H );
fl_push_matrix();
// fl_push_matrix();
int j;
@ -136,7 +136,7 @@ Waveform::draw ( int X, int Y, int W, int H )
fl_line_style( FL_SOLID, 0 );
fl_pop_matrix();
// fl_pop_matrix();
fl_pop_clip();
}

View File

@ -60,7 +60,6 @@ public:
_clip = rhs._clip;
_start = rhs._start;
_end = rhs._end;
_scale = rhs._scale;
}