shithub: cstory

Download patch

ref: 777238004e0593f1198845c294371bff8985c78a
parent: eed610e8bed757b193e8d9b17562db3f7775c937
author: Jacob Moody <moody@posixcafe.org>
date: Sun Dec 17 20:31:04 EST 2023

fix difference in sign extension in unix vs plan 9

This fixes the audio

--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -335,9 +335,9 @@
 
 		for (j = 0; j < ptp_pointer->size; j++)
 		{
-			if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 < -0x7F)
+			if ((int)(pcm_buffer[j] + mixed_pcm_buffer[j]) - 0x100 < -0x7F)
 				mixed_pcm_buffer[j] = 0;
-			else if (pcm_buffer[j] + mixed_pcm_buffer[j] - 0x100 > 0x7F)
+			else if ((int)(pcm_buffer[j] + mixed_pcm_buffer[j]) - 0x100 > 0x7F)
 				mixed_pcm_buffer[j] = 0xFF;
 			else
 				mixed_pcm_buffer[j] = mixed_pcm_buffer[j] + pcm_buffer[j] - 0x80;