Clean-up PixTone.cpp
This commit is contained in:
parent
15f711b2ec
commit
e04d3b8592
1 changed files with 7 additions and 7 deletions
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
static signed char gWaveModelTable[6][256];
|
static signed char gWaveModelTable[6][0x100];
|
||||||
|
|
||||||
void MakeWaveTables(void)
|
void MakeWaveTables(void)
|
||||||
{
|
{
|
||||||
int i, a;
|
int i, a;
|
||||||
|
|
||||||
// Sine wave
|
// 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);
|
gWaveModelTable[0][i] = (signed char)(sin(i * 6.283184 / 256.0) * 64.0);
|
||||||
a = gWaveModelTable[0][i];
|
a = gWaveModelTable[0][i];
|
||||||
|
@ -55,7 +55,7 @@ void MakeWaveTables(void)
|
||||||
|
|
||||||
// White noise wave
|
// White noise wave
|
||||||
srand(0);
|
srand(0);
|
||||||
for (i = 0; i < 256; ++i)
|
for (i = 0; i < 0x100; ++i)
|
||||||
gWaveModelTable[5][i] = (signed char)(rand() & 0xFF) / 2;
|
gWaveModelTable[5][i] = (signed char)(rand() & 0xFF) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
|
||||||
}
|
}
|
||||||
|
|
||||||
dEnvelope = ptp->pointCy;
|
dEnvelope = ptp->pointCy;
|
||||||
while (i < 256)
|
while (i < 0x100)
|
||||||
{
|
{
|
||||||
envelopeTable[i] = (signed char)dEnvelope;
|
envelopeTable[i] = (signed char)dEnvelope;
|
||||||
dEnvelope = (double)dEnvelope - ptp->pointCy / (double)(256 - ptp->pointCx);
|
dEnvelope = (double)dEnvelope - ptp->pointCy / (double)(256 - ptp->pointCx);
|
||||||
|
@ -135,9 +135,9 @@ BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData)
|
||||||
|
|
||||||
for (i = 0; i < ptp->size; ++i)
|
for (i = 0; i < ptp->size; ++i)
|
||||||
{
|
{
|
||||||
a = (int)dMain % 256;
|
a = (int)dMain % 0x100;
|
||||||
b = (int)dPitch % 256;
|
b = (int)dPitch % 0x100;
|
||||||
c = (int)dVolume % 256;
|
c = (int)dVolume % 0x100;
|
||||||
d = (int)((double)(i * 0x100) / ptp->size);
|
d = (int)((double)(i * 0x100) / ptp->size);
|
||||||
pData[i] = gWaveModelTable[ptp->oMain.model][a]
|
pData[i] = gWaveModelTable[ptp->oMain.model][a]
|
||||||
* ptp->oMain.top
|
* ptp->oMain.top
|
||||||
|
|
Loading…
Add table
Reference in a new issue