mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
fixed (and inlined) the "Antilog" function
svn-id: r42274
This commit is contained in:
parent
a9d9de7db4
commit
d25f481421
@ -165,13 +165,6 @@ void MaxTrax::interrupt() {
|
||||
|
||||
}
|
||||
|
||||
int32 MaxTrax::omgItsAntiLog(uint32 val) {
|
||||
// some really weird exponential function, and some also very nonstandard "standard format" floats
|
||||
// format is 16? bit exponent, 16 bit mantissa. and we need to scale with log(2)
|
||||
const float v = ldexp((float)((val & 0xFFFF) + 0x10000) * (float)(0.69314718055994530942 / 65536), val >> 16);
|
||||
return (uint32)exp(v);
|
||||
}
|
||||
|
||||
void MaxTrax::stopMusic() {
|
||||
}
|
||||
|
||||
@ -249,7 +242,8 @@ int MaxTrax::calcNote(VoiceContext &voice) {
|
||||
tone -= voice.periodOffset;
|
||||
}
|
||||
if (tone < PERIOD_LIMIT)
|
||||
voice.lastPeriod = (uint16)omgItsAntiLog((float)tone);
|
||||
// we need to scale with log(2)
|
||||
voice.lastPeriod = (uint16)exp((float)tone * (float)(0.69314718055994530942 / 65536));
|
||||
|
||||
return octave;
|
||||
}
|
||||
|
@ -205,7 +205,6 @@ public:
|
||||
void freePatches();
|
||||
void freeScores();
|
||||
|
||||
static int32 omgItsAntiLog(uint32 val);
|
||||
int calcNote(VoiceContext &voice);
|
||||
int8 noteOn(ChannelContext &channel, byte note, uint16 volume, uint16 pri);
|
||||
void noteOff(ChannelContext &channel, byte note);
|
||||
|
Loading…
Reference in New Issue
Block a user