Browse Source

Cleanup some issues with trimming.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
a032a95fad
4 changed files with 15 additions and 19 deletions
  1. +3
    -3
      Peaks.C
  2. +10
    -13
      Region.C
  3. +2
    -2
      Waveform.C
  4. +0
    -1
      Waveform.H

+ 3
- 3
Peaks.C 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 /* looks like we're going to have to switch to a higher resolution peak file
or read directly from the source */ 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 else
{ {
@@ -82,7 +82,7 @@ Peaks::downsample ( int s, int e, float *mhi, float *mlo ) const
int int
Peaks::clip_read_peaks ( Peak *peaks, int npeaks, int chunksize ) const 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; size_t len;


@@ -116,7 +116,7 @@ Peaks::clip_read_peaks ( Peak *peaks, int npeaks, int chunksize ) const
void void
Peaks::read_peaks ( int s, int e, int npeaks, int chunksize ) const 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 ) if ( peakbuf.size < npeaks )
{ {


+ 10
- 13
Region.C View File

@@ -44,7 +44,8 @@ Region::init ( void )
box( FL_PLASTIC_UP_BOX ); box( FL_PLASTIC_UP_BOX );


_track = NULL; _track = NULL;
_offset = 0;
// _offset = 0;
_offset = timeline.x_to_ts( x() );
} }


Region::Region ( const Region & rhs ) : Waveform( rhs ) Region::Region ( const Region & rhs ) : Waveform( rhs )
@@ -73,25 +74,21 @@ Region::trim ( enum trim_e t, int X )
case LEFT: case LEFT:
{ {
int d = X - x(); 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() ); Fl_Widget::resize( x() + d, y(), w() - d, h() );

_offset = timeline.x_to_ts( x() );

break; break;
} }
case RIGHT: case RIGHT:
{ {
int d = (x() + w()) - X; 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() ); Fl_Widget::resize( x(), y(), w() - d, h() );
break; break;
} }


+ 2
- 2
Waveform.C 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_clip( X, Y, W, H );


fl_push_matrix();
// fl_push_matrix();


int j; int j;


@@ -136,7 +136,7 @@ Waveform::draw ( int X, int Y, int W, int H )


fl_line_style( FL_SOLID, 0 ); fl_line_style( FL_SOLID, 0 );


fl_pop_matrix();
// fl_pop_matrix();


fl_pop_clip(); fl_pop_clip();
} }


+ 0
- 1
Waveform.H View File

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

_scale = rhs._scale; _scale = rhs._scale;
} }




Loading…
Cancel
Save