Lua: All usage of double converted to float (#4502)
* Lua: All usage of double converted to float. printf("%f") still uses promotion to double, (floating point va_args are always promoted to double)
Speed improvements:
* reordering of rotable to put most used tables at the top
* caching of last found global table
Use real pointer to rotable instead of misusing void* to pass integer value
Lua internal traces now turned on by TRACE_LUA_INTERNALS cmake option
* Replaced floating point division with multiplication (where possible), the hardware FPU is much faster at multiplication vs division.
stb_image: enabled STBI_NO_HDR and STBI_NO_LINEAR (removes code that we don't need)
This commit is contained in:
committed by
Bertrand Songis
parent
3b149a22d1
commit
a1a58ad8f8
@@ -661,8 +661,8 @@ int ToneContext::mixBuffer(AudioBuffer * buffer, int volume, unsigned int fade)
|
||||
|
||||
if (fragment.tone.freq != state.freq) {
|
||||
state.freq = fragment.tone.freq;
|
||||
state.step = limit<float>(1, float(DIM(sineValues)*fragment.tone.freq) / AUDIO_SAMPLE_RATE, 512);
|
||||
state.volume = evalVolumeRatio(fragment.tone.freq, volume);
|
||||
state.step = limit<float>(1, float(fragment.tone.freq) * (float(DIM(sineValues))/float(AUDIO_SAMPLE_RATE)), 512);
|
||||
state.volume = 1.0f / evalVolumeRatio(fragment.tone.freq, volume);
|
||||
}
|
||||
|
||||
if (fragment.tone.freqIncr) {
|
||||
@@ -699,7 +699,7 @@ int ToneContext::mixBuffer(AudioBuffer * buffer, int volume, unsigned int fade)
|
||||
}
|
||||
|
||||
for (int i=0; i<points; i++) {
|
||||
int16_t sample = sineValues[int(toneIdx)] / state.volume;
|
||||
int16_t sample = sineValues[int(toneIdx)] * state.volume;
|
||||
mixSample(&buffer->data[i], sample, fade);
|
||||
toneIdx += state.step;
|
||||
if ((unsigned int)toneIdx >= DIM(sineValues))
|
||||
|
||||
Reference in New Issue
Block a user