Skip to content

Commit

Permalink
only increase fadeout sample counter on odd samples
Browse files Browse the repository at this point in the history
  • Loading branch information
goeiecool9999 committed Dec 9, 2024
1 parent 307e166 commit a8ef8b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Cafe/HW/Latte/Core/LatteShaderCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@ class BootSoundPlayer

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

Expand Down

0 comments on commit a8ef8b8

Please sign in to comment.