Browse Source

Improve peak reading efficiency.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
e86123de78
3 changed files with 10 additions and 17 deletions
  1. +1
    -9
      Timeline/Audio_File.C
  2. +9
    -5
      Timeline/Peaks.C
  3. +0
    -3
      Timeline/Region.C

+ 1
- 9
Timeline/Audio_File.C View File

@@ -75,15 +75,7 @@ Audio_File::read_peaks( float fpp, nframes_t start, nframes_t end, int *peaks, P

*channels = this->channels();

*pbuf = new Peak[ *peaks * *channels ];

memcpy( *pbuf, pk.peakbuf(), *peaks * *channels * sizeof( Peak ) );

/* /\* deintereave peaks *\/ */
/* int k = 0; */
/* for ( int i = 0; i < *channels; i++ ) */
/* for ( int j = i; j < *peaks * *channels; j += *channels ) */
/* (*pbuf)[ k++ ] = pk.peakbuf()[ j ]; */
*pbuf = pk.peakbuf();

return true;
}

+ 9
- 5
Timeline/Peaks.C View File

@@ -129,12 +129,16 @@ Peaks::read_peakfile_peaks ( Peak *peaks, nframes_t s, int npeaks, int chunksize
p.min = 0;
p.max = 0;

for ( int k = j; k < len * channels; k += channels )
const Peak *pb = pbuf + j;

for ( int k = len * channels; k--; pb += channels )
{
if ( pbuf[ k ].max > p.max )
p.max = pbuf[ k ].max;
if ( pbuf[ k ].min < p.min )
p.min = pbuf[ k ].min;
const Peak pp = *pb;

if ( pp.max > p.max )
p.max = pp.max;
if ( pp.min < p.min )
p.min = pp.min;
}

}


+ 0
- 3
Timeline/Region.C View File

@@ -656,9 +656,6 @@ Region::draw ( void )
pbuf + i, peaks, channels,
selected() ? fl_invert_color( _color ) : _color );
}

delete[] pbuf;

}

timeline->draw_measure_lines( rx, Y, rw, H, _box_color );


Loading…
Cancel
Save