SPU: Run muted voices when IRQ is enabled
Fixes SPU timeout in Casper. We can still optimize for most games where interrupts are not used by completely ignoring muted voices in those.
This commit is contained in:
parent
54abd37daa
commit
08ad5aad53
|
@ -1225,7 +1225,7 @@ void SPU::ReadADPCMBlock(u16 address, ADPCMBlock* block)
|
||||||
std::tuple<s32, s32> SPU::SampleVoice(u32 voice_index)
|
std::tuple<s32, s32> SPU::SampleVoice(u32 voice_index)
|
||||||
{
|
{
|
||||||
Voice& voice = m_voices[voice_index];
|
Voice& voice = m_voices[voice_index];
|
||||||
if (!voice.IsOn())
|
if (!voice.IsOn() && !m_SPUCNT.irq9_enable)
|
||||||
{
|
{
|
||||||
voice.last_volume = 0;
|
voice.last_volume = 0;
|
||||||
return {};
|
return {};
|
||||||
|
@ -1245,6 +1245,10 @@ std::tuple<s32, s32> SPU::SampleVoice(u32 voice_index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip interpolation when the volume is muted anyway
|
||||||
|
s32 volume;
|
||||||
|
if (voice.regs.adsr_volume != 0)
|
||||||
|
{
|
||||||
// interpolate/sample and apply ADSR volume
|
// interpolate/sample and apply ADSR volume
|
||||||
s16 sample;
|
s16 sample;
|
||||||
if (IsVoiceNoiseEnabled(voice_index))
|
if (IsVoiceNoiseEnabled(voice_index))
|
||||||
|
@ -1252,10 +1256,16 @@ std::tuple<s32, s32> SPU::SampleVoice(u32 voice_index)
|
||||||
else
|
else
|
||||||
sample = voice.Interpolate();
|
sample = voice.Interpolate();
|
||||||
|
|
||||||
const s32 volume = ApplyVolume(sample, voice.regs.adsr_volume);
|
volume = ApplyVolume(sample, voice.regs.adsr_volume);
|
||||||
// if (voice_index == 3 || voice_index == 4)
|
}
|
||||||
// Log_WarningPrintf("voice %u %d", voice_index, volume);
|
else
|
||||||
|
{
|
||||||
|
volume = 0;
|
||||||
|
}
|
||||||
|
|
||||||
voice.last_volume = volume;
|
voice.last_volume = volume;
|
||||||
|
|
||||||
|
if (voice.adsr_phase != ADSRPhase::Off)
|
||||||
voice.TickADSR();
|
voice.TickADSR();
|
||||||
|
|
||||||
// Pitch modulation
|
// Pitch modulation
|
||||||
|
|
Loading…
Reference in New Issue