From 0f8269fe6f78ed603a7428e8cdd74ce20a3015f9 Mon Sep 17 00:00:00 2001
From: Alam Ed Arias <alam@srb2.org>
Date: Fri, 2 May 2014 09:33:57 -0400
Subject: [PATCH] merge sdl interface changes into SDL2 interface

---
 src/sdl2/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++--
 src/sdl2/mixer_sound.c                            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/sdl2/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl2/macosx/Srb2mac.xcodeproj/project.pbxproj
index 16a01ee69c..1b1a9fdf6b 100644
--- a/src/sdl2/macosx/Srb2mac.xcodeproj/project.pbxproj
+++ b/src/sdl2/macosx/Srb2mac.xcodeproj/project.pbxproj
@@ -1214,7 +1214,7 @@
 		C01FCF4B08A954540054247B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 2.1.6;
+				CURRENT_PROJECT_VERSION = 2.1.8;
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					"$(inherited)",
 					NORMALSRB2,
@@ -1226,7 +1226,7 @@
 		C01FCF4C08A954540054247B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 2.1.6;
+				CURRENT_PROJECT_VERSION = 2.1.8;
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_PREPROCESSOR_DEFINITIONS = (
diff --git a/src/sdl2/mixer_sound.c b/src/sdl2/mixer_sound.c
index 658a8b5d6e..e8c62d70fe 100644
--- a/src/sdl2/mixer_sound.c
+++ b/src/sdl2/mixer_sound.c
@@ -152,7 +152,7 @@ static Mix_Chunk *ds2chunk(void *stream)
 		if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
 			newsamples = samples * (frac >> FRACBITS);
 		else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
-			newsamples = FixedMul(frac, samples) + 1; // add 1 sample for security! the code below rounds up.
+			newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
 		if (newsamples >= UINT32_MAX>>2)
 			return NULL; // would and/or did wrap, can't store.
 		break;
-- 
GitLab