shithub: cstory

Download patch

ref: e04d3b8592cadf5ef37df32d42af79318ffaa3c0
parent: 15f711b2ec2717b55867eeced1e4e376827bc1bb
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Nov 13 20:47:51 EST 2019

Clean-up PixTone.cpp

--- a/src/PixTone.cpp
+++ b/src/PixTone.cpp
@@ -6,7 +6,7 @@
 
 #include "WindowsWrapper.h"
 
-static signed char gWaveModelTable[6][256];
+static signed char gWaveModelTable[6][0x100];
 
 void MakeWaveTables(void)
 {
@@ -13,7 +13,7 @@
 	int i, a;
 
 	// Sine wave
-	for (i = 0; i < 256; ++i)
+	for (i = 0; i < 0x100; ++i)
 	{
 		gWaveModelTable[0][i] = (signed char)(sin(i * 6.283184 / 256.0) * 64.0);
 		a = gWaveModelTable[0][i];
@@ -55,7 +55,7 @@
 
 	// White noise wave
 	srand(0);
-	for (i = 0; i < 256; ++i)
+	for (i = 0; i < 0x100; ++i)
 		gWaveModelTable[5][i] = (signed char)(rand() & 0xFF) / 2;
 }
 
@@ -107,7 +107,7 @@
 	}
 
 	dEnvelope = ptp->pointCy;
-	while (i < 256)
+	while (i < 0x100)
 	{
 		envelopeTable[i] = (signed char)dEnvelope;
 		dEnvelope = (double)dEnvelope - ptp->pointCy / (double)(256 - ptp->pointCx);
@@ -135,9 +135,9 @@
 
 	for (i = 0; i < ptp->size; ++i)
 	{
-		a = (int)dMain % 256;
-		b = (int)dPitch % 256;
-		c = (int)dVolume % 256;
+		a = (int)dMain % 0x100;
+		b = (int)dPitch % 0x100;
+		c = (int)dVolume % 0x100;
 		d = (int)((double)(i * 0x100) / ptp->size);
 		pData[i] = gWaveModelTable[ptp->oMain.model][a]
 		         * ptp->oMain.top