diff --git a/polymer/eduke32/source/jaudiolib/src/pitch.c b/polymer/eduke32/source/jaudiolib/src/pitch.c index b55ea90b5..7cdb63fc6 100644 --- a/polymer/eduke32/source/jaudiolib/src/pitch.c +++ b/polymer/eduke32/source/jaudiolib/src/pitch.c @@ -47,15 +47,9 @@ static int32_t PITCH_Installed = 0; void PITCH_Init(void) { - int32_t note; - int32_t detune; - - if (PITCH_Installed) - return; - - for (note = 0; note < 12; note++) + for (int note = 0; note < 12; note++) { - for (detune = 0; detune < MAXDETUNE; detune++) + for (int detune = 0; detune < MAXDETUNE; detune++) { PitchTable[note][detune] = (uint32_t) (65536.f * powf(2.f, (note * MAXDETUNE + detune) / (12.f * MAXDETUNE))); } @@ -73,25 +67,20 @@ void PITCH_Init(void) uint32_t PITCH_GetScale(int32_t pitchoffset) { - uint32_t scale; - int32_t octaveshift; - int32_t noteshift; - int32_t note; - int32_t detune; - - if ( !PITCH_Installed ) + if (!PITCH_Installed) PITCH_Init(); if (pitchoffset == 0) - return PitchTable[ 0 ][ 0 ]; + return PitchTable[0][0]; + + int noteshift = pitchoffset % 1200; - noteshift = pitchoffset % 1200; if (noteshift < 0) noteshift += 1200; - note = noteshift / 100; - detune = (noteshift % 100) / (100 / MAXDETUNE); - octaveshift = (pitchoffset - noteshift) / 1200; + int note = noteshift / 100; + int detune = (noteshift % 100) / (100 / MAXDETUNE); + int octaveshift = (pitchoffset - noteshift) / 1200; if (detune < 0) { @@ -104,7 +93,7 @@ uint32_t PITCH_GetScale(int32_t pitchoffset) } } - scale = PitchTable[ note ][ detune ]; + uint32_t scale = PitchTable[note][detune]; return (octaveshift < 0) ? (scale >> -octaveshift) : (scale <<= octaveshift); } diff --git a/polymer/eduke32/source/jaudiolib/src/pitch.h b/polymer/eduke32/source/jaudiolib/src/pitch.h index 54e994b55..6204ac9a6 100644 --- a/polymer/eduke32/source/jaudiolib/src/pitch.h +++ b/polymer/eduke32/source/jaudiolib/src/pitch.h @@ -33,15 +33,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "inttypes.h" -enum PITCH_ERRORS - { - PITCH_Warning = -2, - PITCH_Error = -1, - PITCH_Ok = 0, - }; - -//void PITCH_Init( void ); -uint32_t PITCH_GetScale( int32_t pitchoffset ); -void PITCH_UnlockMemory( void ); -int32_t PITCH_LockMemory( void ); +uint32_t PITCH_GetScale(int32_t pitchoffset); #endif