Skip to content

Commit

Permalink
clean up fadeout loop
Browse files Browse the repository at this point in the history
  • Loading branch information
goeiecool9999 committed Dec 9, 2024
1 parent 6b057ae commit 4b78f35
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Cafe/HW/Latte/Core/LatteShaderCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ class BootSoundPlayer

void ApplyFadeOutEffect(std::span<sint16> samples, uint64& fadeOutSample, uint64 fadeOutDuration)
{
for(size_t i = 0; i < samples.size(); i++)
for (size_t i = 0; i < samples.size(); i += 2)
{
float decibel = (float)fadeOutSample / fadeOutDuration * -60.0f;
float volumeFactor = pow(10,decibel/20);
const float decibel = (float)fadeOutSample / fadeOutDuration * -60.0f;
const float volumeFactor = pow(10, decibel / 20);
samples[i] *= volumeFactor;
if(i % 2 == 1)
fadeOutSample++;
samples[i + 1] *= volumeFactor;
fadeOutSample++;
}
}

Expand Down

0 comments on commit 4b78f35

Please sign in to comment.