From a6aacc73e2dc00b6cdeaa5ec08e07b9b285b2fb6 Mon Sep 17 00:00:00 2001 From: md5 Date: Sat, 19 Mar 2011 02:30:32 +0200 Subject: AUDIO: Changed several places that use PI to use M_PI instead --- audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp | 2 +- audio/softsynth/opl/mame.cpp | 6 +++--- audio/softsynth/pcspk.cpp | 2 +- audio/softsynth/ym2612.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp index f84fd841a6..67de8fa026 100644 --- a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp +++ b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp @@ -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); diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index c875080e8f..b4bbcb5ab3 100644 --- a/audio/softsynth/opl/mame.cpp +++ b/audio/softsynth/opl/mame.cpp @@ -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 */ } diff --git a/audio/softsynth/pcspk.cpp b/audio/softsynth/pcspk.cpp index 69ba113c8b..947c142b73 100644 --- a/audio/softsynth/pcspk.cpp +++ b/audio/softsynth/pcspk.cpp @@ -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) (128 * sin(2.0 * PI * x / oscLength)), -128, 127); + return CLIP((int16) (128 * sin(2.0 * M_PI * x / oscLength)), -128, 127); } int8 PCSpeaker::generateSaw(uint32 x, uint32 oscLength) { diff --git a/audio/softsynth/ym2612.cpp b/audio/softsynth/ym2612.cpp index 94fcfb97db..6b3c2aab73 100644 --- a/audio/softsynth/ym2612.cpp +++ b/audio/softsynth/ym2612.cpp @@ -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)); } { -- cgit v1.2.3