shithub: cstory

Download patch

ref: 46fdc08ecddcbbfc9ce8ebf98895bce10f1f395a
parent: 12f69e3c6c6217477637a94372884fd4812a8b68
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 5 17:39:38 EDT 2019

Fix PixTone sounds missing their ends

I was accidentally replicating a bug from the original code in the
wrong place. I should probably comment on that bug in the accurate
branch.

--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -248,7 +248,7 @@
 		++ptp_pointer;
 	}
 
-	lpSECONDARYBUFFER[no] = AudioBackend_CreateSound(22050, ptp->size);
+	lpSECONDARYBUFFER[no] = AudioBackend_CreateSound(22050, sample_count);
 
 	if (lpSECONDARYBUFFER[no] == NULL)
 		return -1;
@@ -306,7 +306,7 @@
 
 	unsigned char *buffer = AudioBackend_LockSound(lpSECONDARYBUFFER[no], NULL);
 
-	memcpy(buffer, mixed_pcm_buffer, ptp->size);
+	memcpy(buffer, mixed_pcm_buffer, sample_count);
 
 	AudioBackend_UnlockSound(lpSECONDARYBUFFER[no]);
 
--