Commit a641a80b authored by David Reid's avatar David Reid

More optimization experiments.

parent 1a919c05
...@@ -2020,10 +2020,13 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO ...@@ -2020,10 +2020,13 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO
if (pFramesOut != NULL && pFramesIn != NULL) { if (pFramesOut != NULL && pFramesIn != NULL) {
float a = (float)pGainer->t / pGainer->config.smoothTimeInFrames; float a = (float)pGainer->t / pGainer->config.smoothTimeInFrames;
float d = 1.0f / pGainer->config.smoothTimeInFrames; float d = 1.0f / pGainer->config.smoothTimeInFrames;
ma_uint32 channelCount = pGainer->config.channels;
for (iFrame = 0; iFrame < frameCount; iFrame += 1) { for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) { for (iChannel = 0; iChannel < channelCount; iChannel += 1) {
pFramesOutF32[iFrame*pGainer->config.channels + iChannel] = pFramesInF32[iFrame*pGainer->config.channels + iChannel] * ma_mix_f32_fast(pGainer->oldGains[iChannel], pGainer->newGains[iChannel], a); pFramesOutF32[0] = pFramesInF32[0] * ma_mix_f32_fast(pGainer->oldGains[iChannel], pGainer->newGains[iChannel], a);
pFramesOutF32 += 1;
pFramesInF32 += 1;
} }
a += d; a += d;
...@@ -2033,7 +2036,7 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO ...@@ -2033,7 +2036,7 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO
} }
} }
pGainer->t = ma_min(pGainer->t + frameCount, pGainer->config.smoothTimeInFrames); pGainer->t = (ma_uint32)ma_min(pGainer->t + frameCount, pGainer->config.smoothTimeInFrames);
#if 0 #if 0
for (iFrame = 0; iFrame < frameCount; iFrame += 1) { for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment