Another Lanczos optimisation
This commit is contained in:
parent
67ee8b9829
commit
47543eb382
1 changed files with 4 additions and 2 deletions
|
@ -195,18 +195,20 @@ ATTRIBUTE_HOT void Mixer_MixSounds(long *stream, size_t frames_total)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const short output_sample = (short)(accumulator * 0x100);
|
// Mix, and apply volume
|
||||||
|
*stream_pointer++ += (short)(accumulator * sound->volume_l);
|
||||||
|
*stream_pointer++ += (short)(accumulator * sound->volume_r);
|
||||||
#else
|
#else
|
||||||
// Perform linear interpolation
|
// Perform linear interpolation
|
||||||
const unsigned char interpolation_scale = sound->position_subsample >> 8;
|
const unsigned char interpolation_scale = sound->position_subsample >> 8;
|
||||||
|
|
||||||
const short output_sample = sound->samples[sound->position] * (0x100 - interpolation_scale)
|
const short output_sample = sound->samples[sound->position] * (0x100 - interpolation_scale)
|
||||||
+ sound->samples[sound->position + 1] * interpolation_scale;
|
+ sound->samples[sound->position + 1] * interpolation_scale;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Mix, and apply volume
|
// Mix, and apply volume
|
||||||
*stream_pointer++ += (output_sample * sound->volume_l) >> 8;
|
*stream_pointer++ += (output_sample * sound->volume_l) >> 8;
|
||||||
*stream_pointer++ += (output_sample * sound->volume_r) >> 8;
|
*stream_pointer++ += (output_sample * sound->volume_r) >> 8;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Increment sample
|
// Increment sample
|
||||||
const unsigned long next_position_subsample = sound->position_subsample + sound->advance_delta;
|
const unsigned long next_position_subsample = sound->position_subsample + sound->advance_delta;
|
||||||
|
|
Loading…
Add table
Reference in a new issue