mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 23:11:18 +12:00
only increase fadeout sample counter on odd samples
This commit is contained in:
parent
307e166efb
commit
a8ef8b85fa
1 changed files with 4 additions and 3 deletions
|
@ -190,12 +190,13 @@ class BootSoundPlayer
|
||||||
|
|
||||||
void ApplyFadeOutEffect(std::span<sint16> samples, uint64 fadeOutDuration)
|
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 decibel = (float)m_fadeOutSample / fadeOutDuration * -100.0f;
|
||||||
float volumeFactor = pow(10,decibel/20);
|
float volumeFactor = pow(10,decibel/20);
|
||||||
i *= volumeFactor;
|
samples[i] *= volumeFactor;
|
||||||
m_fadeOutSample++;
|
if(i % 2 == 1)
|
||||||
|
m_fadeOutSample++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue