- 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();
+ for( int i=0; i<audio_channels; ++i ) {
+ double *current_buffer = audio_out_packed[i];
+ if( speed > 1 ) { // buffer gets shorter
+ int in = 0, out = 0;
+ while( in < len ) {
+ int next = (out+1) * speed;
+ if( next > len) next = len;
+ double sample = current_buffer[in];
+ for( int i=in; ++i<next; ) sample += current_buffer[i];
+ int l = next - in;
+ if( l > 1 ) sample /= l;