shithub: cstory

Download patch

ref: 47543eb382060e858234335158cb6f2d63a7bcc4
parent: 67ee8b982972c8d5a63416a5edbdbbc367f2d162
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 3 10:38:56 EDT 2020

Another Lanczos optimisation

--- a/src/Backends/Audio/SoftwareMixer.cpp
+++ b/src/Backends/Audio/SoftwareMixer.cpp
@@ -195,7 +195,9 @@
 					}
 				}
 
-				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
 				// Perform linear interpolation
 				const unsigned char interpolation_scale = sound->position_subsample >> 8;
@@ -202,11 +204,11 @@
 
 				const short output_sample = sound->samples[sound->position] * (0x100 - interpolation_scale)
 				                          + sound->samples[sound->position + 1] * interpolation_scale;
-			#endif
 
 				// Mix, and apply volume
 				*stream_pointer++ += (output_sample * sound->volume_l) >> 8;
 				*stream_pointer++ += (output_sample * sound->volume_r) >> 8;
+			#endif
 
 				// Increment sample
 				const unsigned long next_position_subsample = sound->position_subsample + sound->advance_delta;