- if(renderengine->command->get_speed() > 1)
- {
-// Number of samples in real output buffer for each to sample rendered.
- int interpolate_len = (int)renderengine->command->get_speed();
- for(in = 0, out = 0; in < len; )
- {
- sample = 0;
- for(k = 0; k < interpolate_len; k++)
- {
- sample += current_buffer[in++];
- }
-
- sample /= renderengine->command->get_speed();
+ if( speed > 1 ) {
+ int out = 0;
+ for( int in=0; in<len; ) {
+// samples in real output buffer for each to sample rendered.
+ int end = (out+1) * speed;
+ if( end > len ) end = len;
+ int k = end - in;
+ double sample = 0;
+ while( in < end ) sample += current_buffer[in++];
+ if( k > 0 ) sample /= k;