AUDIO: Changed several places that use PI to use M_PI instead

This commit is contained in:
md5 2011-03-19 02:30:32 +02:00
parent 334e1cd675
commit a6aacc73e2
4 changed files with 7 additions and 7 deletions

View File

@ -1253,7 +1253,7 @@ void TownsPC98_FmSynth::generateTables() {
delete[] _oprSinTbl;
_oprSinTbl = new uint32[1024];
for (int i = 0; i < 1024; i++) {
double val = sin((double)(((i << 1) + 1) * PI / 1024.0));
double val = sin((double)(((i << 1) + 1) * M_PI / 1024.0));
double d_dcb = log(1.0 / (double)ABS(val)) / log(2.0) * 256.0;
int32 i_dcb = (int32)(2.0 * d_dcb);
i_dcb = (i_dcb & 1) ? (i_dcb >> 1) + 1 : (i_dcb >> 1);

View File

@ -708,7 +708,7 @@ static int OPLOpenTable(void) {
/* degree 0 = degree 180 = off */
SIN_TABLE[0] = SIN_TABLE[SIN_ENT /2 ] = &TL_TABLE[EG_ENT - 1];
for (s = 1;s <= SIN_ENT / 4; s++) {
pom = sin(2 * PI * s / SIN_ENT); /* sin */
pom = sin(2 * M_PI * s / SIN_ENT); /* sin */
pom = 20 * log10(1 / pom); /* decibel */
j = int(pom / EG_STEP); /* TL_TABLE steps */
@ -739,14 +739,14 @@ static int OPLOpenTable(void) {
ENV_CURVE[EG_OFF >> ENV_BITS]= EG_ENT - 1;
/* make LFO ams table */
for (i=0; i < AMS_ENT; i++) {
pom = (1.0 + sin(2 * PI * i / AMS_ENT)) / 2; /* sin */
pom = (1.0 + sin(2 * M_PI * i / AMS_ENT)) / 2; /* sin */
AMS_TABLE[i] = (int)((1.0 / EG_STEP) * pom); /* 1dB */
AMS_TABLE[AMS_ENT + i] = (int)((4.8 / EG_STEP) * pom); /* 4.8dB */
}
/* make LFO vibrate table */
for (i=0; i < VIB_ENT; i++) {
/* 100cent = 1seminote = 6% ?? */
pom = (double)VIB_RATE * 0.06 * sin(2 * PI * i / VIB_ENT); /* +-100sect step */
pom = (double)VIB_RATE * 0.06 * sin(2 * M_PI * i / VIB_ENT); /* +-100sect step */
VIB_TABLE[i] = (int)(VIB_RATE + (pom * 0.07)); /* +- 7cent */
VIB_TABLE[VIB_ENT + i] = (int)(VIB_RATE + (pom * 0.14)); /* +-14cent */
}

View File

@ -109,7 +109,7 @@ int8 PCSpeaker::generateSine(uint32 x, uint32 oscLength) {
return 0;
// TODO: Maybe using a look-up-table would be better?
return CLIP<int16>((int16) (128 * sin(2.0 * PI * x / oscLength)), -128, 127);
return CLIP<int16>((int16) (128 * sin(2.0 * M_PI * x / oscLength)), -128, 127);
}
int8 PCSpeaker::generateSaw(uint32 x, uint32 oscLength) {

View File

@ -677,14 +677,14 @@ void MidiDriver_YM2612::createLookupTables() {
int i;
sintbl = new int [2048];
for (i = 0; i < 2048; i++)
sintbl[i] = (int)(0xffff * sin(i/2048.0*2.0*PI));
sintbl[i] = (int)(0xffff * sin(i/2048.0 * 2.0 * M_PI));
}
{
int i;
powtbl = new int [1025];
for (i = 0; i <= 1024; i++)
powtbl[i] = (int)(0x10000 * pow(2.0, (i-512)/512.0));
powtbl[i] = (int)(0x10000 * pow(2.0, (i - 512) / 512.0));
}
{