More tweaking.
This commit is contained in:
parent
8905484cb1
commit
4129714315
12
Peaks.C
12
Peaks.C
|
@ -70,8 +70,16 @@ Peaks::operator[] ( int X ) const
|
||||||
/* Is there a better way to return this? */
|
/* Is there a better way to return this? */
|
||||||
static Peak p;
|
static Peak p;
|
||||||
|
|
||||||
int start = X * timeline.fpp;
|
if ( timeline.fpp < _peaks->chunksize )
|
||||||
int end = (X + 1) * timeline.fpp;
|
{
|
||||||
|
printf( "we need to a smaller chunksize! examine the source!\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = timeline.x_to_ts( X ) / _peaks->chunksize;
|
||||||
|
int end = timeline.x_to_ts( X + 1 ) / _peaks->chunksize;
|
||||||
|
|
||||||
|
/* int start = X * timeline.fpp; */
|
||||||
|
/* int end = (X + 1) * timeline.fpp; */
|
||||||
|
|
||||||
downsample( start, end, &p.max, &p.min );
|
downsample( start, end, &p.max, &p.min );
|
||||||
|
|
||||||
|
|
17
Region.C
17
Region.C
|
@ -71,14 +71,25 @@ Region::trim ( enum trim_e t, int X )
|
||||||
case LEFT:
|
case LEFT:
|
||||||
{
|
{
|
||||||
int d = X - x();
|
int d = X - x();
|
||||||
_start += d;
|
// _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 );
|
||||||
|
|
||||||
resize( x() + d, y(), w() - d, h() );
|
resize( x() + d, y(), w() - d, h() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
{
|
{
|
||||||
int d = (x() + w()) - X;
|
int d = (x() + w()) - X;
|
||||||
_end = _start + w() - d;
|
// _end = _start + w() - d;
|
||||||
|
_end = timeline.x_to_ts( _start + w() - d );
|
||||||
resize( x(), y(), w() - d, h() );
|
resize( x(), y(), w() - d, h() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -204,6 +215,8 @@ Region::handle ( int m )
|
||||||
timeline.scroll->position( pos, timeline.scroll->yposition() );
|
timeline.scroll->position( pos, timeline.scroll->yposition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_offset = timeline.x_to_ts( x() );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
2
Region.H
2
Region.H
|
@ -28,6 +28,8 @@ class Region : public Waveform
|
||||||
|
|
||||||
Track *_track;
|
Track *_track;
|
||||||
|
|
||||||
|
nframes_t _offset;
|
||||||
|
|
||||||
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 );
|
||||||
|
|
19
Waveform.C
19
Waveform.C
|
@ -77,12 +77,13 @@ Waveform::draw ( int X, int Y, int W, int H )
|
||||||
|
|
||||||
// int start = (_start + (X - x())) * 2;
|
// int start = (_start + (X - x())) * 2;
|
||||||
|
|
||||||
j = 0;
|
int start = timeline.ts_to_x( _start ) + (X - x() );
|
||||||
for ( int x = X; x < X + W; ++x )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
j = start;
|
||||||
|
for ( int x = X; x < X + W; ++x, ++j )
|
||||||
|
{
|
||||||
// read_peaks( x, &hi, &lo );
|
// read_peaks( x, &hi, &lo );
|
||||||
Peak p = (*_clip->peaks())[ x ];
|
Peak p = (*_clip->peaks())[ j ];
|
||||||
|
|
||||||
int mid = Y + (H / 2);
|
int mid = Y + (H / 2);
|
||||||
|
|
||||||
|
@ -107,9 +108,10 @@ Waveform::draw ( int X, int Y, int W, int H )
|
||||||
|
|
||||||
fl_begin_line();
|
fl_begin_line();
|
||||||
|
|
||||||
for ( int x = X; x < X + W; ++x )
|
j = start;
|
||||||
|
for ( int x = X; x < X + W; ++x, ++j )
|
||||||
{
|
{
|
||||||
Peak p = (*_clip->peaks())[ x ];
|
Peak p = (*_clip->peaks())[ j ];
|
||||||
|
|
||||||
p.min *= _scale;
|
p.min *= _scale;
|
||||||
|
|
||||||
|
@ -120,9 +122,10 @@ Waveform::draw ( int X, int Y, int W, int H )
|
||||||
|
|
||||||
fl_begin_line();
|
fl_begin_line();
|
||||||
|
|
||||||
for ( int x = X; x < X + W; ++x )
|
j = start;
|
||||||
|
for ( int x = X; x < X + W; ++x, ++j )
|
||||||
{
|
{
|
||||||
Peak p = (*_clip->peaks())[ x ];
|
Peak p = (*_clip->peaks())[ j ];
|
||||||
|
|
||||||
p.max *= _scale;
|
p.max *= _scale;
|
||||||
|
|
||||||
|
|
4
main.C
4
main.C
|
@ -122,8 +122,8 @@ main ( int argc, char **argv )
|
||||||
Fl_Slider *zoom_slider = new Fl_Slider( 0, 0, 800, 24 );
|
Fl_Slider *zoom_slider = new Fl_Slider( 0, 0, 800, 24 );
|
||||||
zoom_slider->type( 1 );
|
zoom_slider->type( 1 );
|
||||||
zoom_slider->callback( cb_zoom, 0 );
|
zoom_slider->callback( cb_zoom, 0 );
|
||||||
zoom_slider->range( 1, 256 );
|
zoom_slider->range( 1, 256 * 256 );
|
||||||
zoom_slider->value( 1 );
|
zoom_slider->value( 256 );
|
||||||
|
|
||||||
main_window->end();
|
main_window->end();
|
||||||
main_window->show();
|
main_window->show();
|
||||||
|
|
Loading…
Reference in New Issue