diff --git a/Timeline/Peaks.C b/Timeline/Peaks.C index 841e916..f5d5e93 100644 --- a/Timeline/Peaks.C +++ b/Timeline/Peaks.C @@ -124,21 +124,19 @@ Peaks::read_peakfile_peaks ( Peak *peaks, nframes_t s, int npeaks, int chunksize /* get the peak for each channel */ for ( int j = 0; j < channels; ++j ) { - Peak &p = pk[ j ]; + Peak *p = &pk[ j ]; - p.min = 0; - p.max = 0; + p->min = 0; + p->max = 0; const Peak *pb = pbuf + j; for ( int k = len * channels; k--; pb += channels ) { - const Peak pp = *pb; - - if ( pp.max > p.max ) - p.max = pp.max; - if ( pp.min < p.min ) - p.min = pp.min; + if ( pb->max > p->max ) + p->max = pb->max; + if ( pb->min < p->min ) + p->min = pb->min; } } diff --git a/Timeline/Waveform.C b/Timeline/Waveform.C index 6c3f51c..03ca6c0 100644 --- a/Timeline/Waveform.C +++ b/Timeline/Waveform.C @@ -82,8 +82,8 @@ Waveform::draw ( int X, int Y, int W, int H, else fl_color( color ); - const int ty = mid + (halfheight * p.min); - const int by = mid + (halfheight * p.max ); + const int ty = mid + ( halfheight * p.min ); + const int by = mid + ( halfheight * p.max ); fl_line( x, ty, x, by ); /* if ( outline ) */ @@ -96,6 +96,8 @@ Waveform::draw ( int X, int Y, int W, int H, } } + const int ty = Y + halfheight; + if ( Waveform::outline ) { @@ -107,11 +109,7 @@ Waveform::draw ( int X, int Y, int W, int H, j = start; for ( int x = X; x < X + W; ++x, j += skip ) - { - const Peak p = pbuf[ j ]; - - fl_vertex( x, Y + (H / 2) + ((float)H / 2 * p.min )); - } + fl_vertex( x, ty + ( halfheight * pbuf[ j ].min ) ); fl_end_line(); @@ -119,11 +117,7 @@ Waveform::draw ( int X, int Y, int W, int H, j = start; for ( int x = X; x < X + W; ++x, j += skip ) - { - const Peak p = pbuf[ j ]; - - fl_vertex( x, Y + (H / 2) + ((float)H / 2 * p.max )); - } + fl_vertex( x, ty + ( halfheight * pbuf[ j ].max ) ); fl_end_line();